public virtual ActionResult dataSMSInfoRead(int?page) { var pageNumber = page ?? 0; var result = new List <InfoSMSViewModel> { }; string userName = WebConfigurationManager.AppSettings["UserNameSMS"]; string password = WebConfigurationManager.AppSettings["PasswordSMS"]; string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"]; SendSoapClient client = new SendSoapClient(); var countUnRead = client.GetInboxCount(userName, password, false); var counRead = client.GetInboxCount(userName, password, true); if (counRead != 0) { if (countUnRead != 0) { var resultSMS = client.getMessages(userName, password, 1, null, ((pageNumber * 30) + countUnRead), 30); if (resultSMS == null || !resultSMS.Any()) { return(Content("no-more-info")); } result = resultSMS.Select(x => new InfoSMSViewModel { Id = x.MsgID.ToString(), Body = x.Body, DateTime = x.SendDate, Sender = x.Sender }).ToList(); return(PartialView(viewName: MVC.admin.Setting.Views._dataSMS, model: result)); } else { var resultSMS = client.getMessages(userName, password, 1, null, (pageNumber * 30), 30); if (resultSMS == null || !resultSMS.Any()) { return(Content("no-more-info")); } result = resultSMS.Select(x => new InfoSMSViewModel { Id = x.MsgID.ToString(), Body = x.Body, DateTime = x.SendDate, Sender = x.Sender }).ToList(); return(PartialView(viewName: MVC.admin.Setting.Views._dataSMS, model: result)); } } else { return(Content("no-more-info")); } }
public virtual ActionResult GetReadSMS() { var result = new List <InfoSMSViewModel> { }; string userName = WebConfigurationManager.AppSettings["UserNameSMS"]; string password = WebConfigurationManager.AppSettings["PasswordSMS"]; string NumberSMS = WebConfigurationManager.AppSettings["NumberSMS"]; SendSoapClient client = new SendSoapClient(); var countUnRead = client.GetInboxCount(userName, password, false); var counRead = client.GetInboxCount(userName, password, true); if (counRead != 0) { if (countUnRead != 0) { var resultSMS = client.getMessages(userName, password, 1, null, (0 + countUnRead), 30); result = resultSMS.Select(x => new InfoSMSViewModel { Id = x.MsgID.ToString(), Body = x.Body, DateTime = x.SendDate, Sender = x.Sender }).ToList(); return(View(result)); } else { var resultSMS = client.getMessages(userName, password, 1, null, 0, 30); result = resultSMS.Select(x => new InfoSMSViewModel { Id = x.MsgID.ToString(), Body = x.Body, DateTime = x.SendDate, Sender = x.Sender }).ToList(); return(View(result)); } } else { return(View(new List <InfoSMSViewModel> { })); } }
public virtual ActionResult getInfoAccount() { try { InfoAccountSMS info = new InfoAccountSMS(); var userName = WebConfigurationManager.AppSettings["UserNameSMS"]; var password = WebConfigurationManager.AppSettings["PasswordSMS"]; SendSoapClient client = new SendSoapClient(); int countUnReed = client.GetInboxCount(userName, password, false); int countReed = client.GetInboxCount(userName, password, true); var creadit = Math.Round(client.GetCredit(userName, password), 2).ToString(); var countRecive = (countUnReed + countReed).ToString(); var countSend = "120"; info.CountRead = countReed.ToString(); info.CountUnRead = countUnReed.ToString(); info.CountSend = countSend; info.CountRecive = countRecive; info.Creadit = creadit; return(PartialView(viewName: MVC.admin.Setting.Views._DetailsAccountSMS, model: info)); } catch (Exception ex) { return(PartialView(MVC.admin.Shared.Views._alert, new AlertViewModel { Alert = AlertOperation.SurveyOperation(StatusOperation.ExceptionReciveSMS), Status = AlertMode.warning })); } }