public void AddMagForAPPSMS(string tel, string token, string phoneType) { using (var ctx = new MetalSmsSendEntities()) { var sms = new app_sms(); sms.mobile = tel; sms.SMSTitle = "退出"; sms.content = token; sms.Mid = "admin"; sms.st = false; sms.timestamp = DateTime.Now; sms.Url = phoneType; ctx.app_sms.Add(sms); ctx.SaveChanges(); //Log.WriteLog("Login,count>0", "tel=" + tel + ",token=" + token); } }
private void sendSms(string mobile, string msg) { using (var ctx = new MetalSmsSendEntities()) { ProvideSm sms = new ProvideSm(); sms.Tel = mobile; sms.Message = msg; sms.AddDate = DateTime.Now; sms.SendInt = 0; sms.Mid = "admin"; sms.SMSTitle = "上海同鑫"; sms.st = false; sms.Stop_Flag = false; ctx.ProvideSms.Add(sms); ctx.SaveChanges(); } }
//下拉,获取日期之后的所有 private List <InboxVM> GetInBoxMsgByPullDown(string mobile, DateTime date) { var list = new List <InboxVM>(); using (var ctx = new MetalSmsSendEntities()) { //var log = ctx.App_Log.FirstOrDefault(o => o.mobile.Contains(mobile) && o.ErrCode == "1"); //if (log != null) //{ // var tel = log.mobile; list = ctx.App_Log.Where(o => o.mobile == mobile && o.ErrCode == "1" && o.Date > date).OrderByDescending(o => o.Date) .Select(o => new InboxVM { Id = o.ID, Date = o.Date, Msg = o.Msg, Url = o.Url }).ToList(); //} } return(list); }
public List <InboxVM> GetInBoxMsgByMobile(string mobile) { var list = new List <InboxVM>(); using (var ctx = new MetalSmsSendEntities()) { //DateTime end = DateTime.Today.AddDays(1); //DateTime start = end.AddDays(-2); //var log = ctx.App_Log.FirstOrDefault(o => o.mobile.Contains(mobile) && o.ErrCode == "1"); //if (log != null) //{ //var tel = log.mobile; var count = ctx.App_Log.Count(o => o.mobile == mobile && o.ErrCode == "1"); if (count > 0) { list = ctx.App_Log.Where(o => o.mobile == mobile && o.ErrCode == "1").OrderByDescending(o => o.Date).Take(count < 30 ? count : 30) .Select(o => new InboxVM { Id = o.ID, Date = o.Date, Msg = o.Msg, Url = o.Url }).ToList(); } //} } return(list); }