diff --git a/Back/Services/servSendMsg.cs b/Back/Services/servSendMsg.cs index b7f06f6..9b8bc6c 100644 --- a/Back/Services/servSendMsg.cs +++ b/Back/Services/servSendMsg.cs @@ -3,23 +3,35 @@ public class servSendMsg { private readonly mpNuget.RestClient _restClient; - public servSendMsg(mpNuget.RestClient restClient)=> _restClient = restClient; + public servSendMsg(mpNuget.RestClient restClient) => _restClient = restClient; //private void SendMsgByPatern(string Text, string To, int bodyID) {/*_restClient.SendByBaseNumber(Text, To, bodyID);*/ } - private void SendMsg(string Text, string To)=> _restClient.Send(To, "50004001660045", Text, false); - public void toContinue(string Code, string To,string title) + private void SendMsg(string Text, string To) => _restClient.Send(To, "50004001660045", Text, false); + private void SendByPattern(string[] bodys, int PatternCode, string To) { - SendMsg($"برای ادامه {title} از کد {Code} استفاده کنید",To); + string text = ""; + foreach (string body in bodys) + { + if (string.IsNullOrEmpty(text)) text += body.Trim(); + else { text += ";" + body.Trim(); } + } + _restClient.SendByBaseNumber(text, To , PatternCode); } - public void SuccessfulRegistration(string to, string Username, string Password) - { - SendMsg("ثبت نام شما با موفقیت انجام شد" + '\n' + - "اطلاعات کاربری:" + '\n' + - $"نام کاربری : {Username}" + - $"کلمه عبور : {Password}" ,to); + public void toContinue(string Code, string To, string title) + { + SendByPattern(new string[] { Code }, 251756, To); + // SendMsg($"برای ادامه {title} از کد {Code} استفاده کنید", To); + } + public void SuccessfulRegistration(string To, string Username, string Password) + { + SendByPattern(new string[] { Username,Password }, 251815, To); + //SendMsg("ثبت نام شما با موفقیت انجام شد" + '\n' + + // "اطلاعات کاربری:" + '\n' + + // $"نام کاربری : {Username}" + + // $"کلمه عبور : {Password}", to); + } + //public void Authentication(string to,string code) => SendMsgByPatern(code, to, 0); + // + //public void SuccessfulPayment(string to, string code) => SendMsgByPatern(code, to, 2); + // public void firstEntry(string to, string code) => SendMsgByPatern(code, to, 3); } - //public void Authentication(string to,string code) => SendMsgByPatern(code, to, 0); - // - //public void SuccessfulPayment(string to, string code) => SendMsgByPatern(code, to, 2); - // public void firstEntry(string to, string code) => SendMsgByPatern(code, to, 3); } -}