public JsonResult Deletes(long [] ids) { var result = new JsonResultModel { ResultState = SendMailLogs.DeleteSendMailLogs(ids) > 0 }; return(Json(result)); }
public JsonResult Delete(long id) { var result = new JsonResultModel { ResultState = SendMailLogs.DeleteSendMailLog(id) > 0 }; return(Json(result)); }
public ActionResult Index(int?page) { int pageIndex = page.HasValue ? page.Value : 1; int pageSize = PageConfig.BackstagePageSize; int count, pageCount; var result = SendMailLogs.SendMailLogInfosToVModels(SendMailLogs.GetSendMailLogPageList(pageIndex, pageSize, null, null, out pageCount, out count)); PagedList <SendMailLogVModel> pl = result.ToPagedList(pageIndex, pageSize); pl.TotalItemCount = count; pl.CurrentPageIndex = pageIndex; return(View(pl)); }
public JsonResult Add(SendMailLogVModel model) { var result = new JsonResultModel(); if (ModelState.IsValid) { //add result.ResultState = SendMailLogs.AddSendMailLog(SendMailLogs.SendMailLogVModelToInfo(model)) > 0; } else { result.ResultState = false; result.Message = ModelStateHelper.GetAllErrorMessage(ModelState); } return(Json(result)); }
/// <summary> /// 根据发送日志检测用户是否可以发送邮件,限制发送频率与发送量 /// </summary> /// <param name="userId">用户id</param> /// <param name="toDayMaxNum">今日发送最大量</param> /// <param name="time">时间间隔(分钟)</param> /// <param name="maxNum">指定时间间隔内最大发送量</param> /// <param name="msg"></param> /// <returns></returns> public bool CheckUserEmailAvailable(int userId, int time, int maxNum, int toDayMaxNum, out string msg) { int _maxNum = SendMailLogs.GetSendMailLogCountByUserIdAndTime(userId, time); if (_maxNum >= maxNum) { msg = "您的操作太频繁了,请稍后再试!"; return(false); } int _toDayMaxNum = SendMailLogs.GetSendMailLogToDayCountByUserId(userId); if (_toDayMaxNum >= toDayMaxNum) { msg = "您今日发送邮件已达到最大数量,发送失败!"; return(false); } msg = "可以发送!"; return(true); }
public ActionResult Edit(int id) { var model = SendMailLogs.SendMailLogInfoToVModel(SendMailLogs.GetSendMailLogInfo(id)); return(View(model)); }
/// <summary> /// 写入邮件发送日志 /// </summary> /// <param name="model"></param> /// <returns></returns> public long Add(SendMailLogVModel model) { return(SendMailLogs.AddSendMailLog(SendMailLogs.SendMailLogVModelToInfo(model))); }