public static Dictionary <string, object> GetBatchList(int pageIndex, string stDate, string edDate, string batchId, string remark, string content, int sourceType, int channel) { Dictionary <string, object> dicData = MessageSysBLL.GetBatchList(pageIndex, stDate, edDate, batchId, remark, content, sourceType, channel);; if (dicData != null) { int rowCount = Convert.ToInt32(dicData["count"]); int maxPage = rowCount % 15 == 0 ? rowCount / 15 : (rowCount / 15 + 1); dicData["maxPage"] = maxPage; List <MessageBatch> list = (List <MessageBatch>)dicData["data"]; foreach (var item in list) { if (item.FeedBackArrive != 0) { item.OpenRatio = (Convert.ToDouble(item.FeedBackOpen) / item.FeedBackArrive * 100).ToString("F2") + "%"; } else { item.OpenRatio = "无数据"; } item.OperatorName = Sys_Manage_UserBLL.GetManageUserNameById(item.Operator); } } return(dicData); }
/// <summary> /// 后台HangFire调用定时任务 /// </summary> /// <param name="settingId"></param> public static void ExcuteTimerTask(int settingId) { //从后台任务列表获取到需要发送的记录 ConditionSettingModel.SettingModel model = ConditionSettingBLL.GetSendingTaskItem(settingId); string batchId = ""; if (string.IsNullOrEmpty(model.LatestBatchId)) { //从后台设置的任务生成消息批次 batchId = PreparePushingMsg(model.AccIdSet, model.AccIdCount, 3, model.MobileTitle, model.PubTitle, model.EmailTitle, model.SmsContent, model.MobileContent, model.PubContent, model.EmailContent, model.Remark + "(" + model.SendingDate + "定时发送)", model.Verification, "1"); //更新任务的批次Id防止重复提交 ConditionSettingBLL.SetBatchId(settingId, batchId); } else { batchId = model.LatestBatchId; } string uName = Sys_Manage_UserBLL.GetManageUserNameById(model.Operator); SendMsgAuto(batchId, model.Operator, uName); }
/// <summary> /// 后台HangFire调用循环任务 /// </summary> /// <param name="settingId"></param> public static void ExcuteRecurringTask(int settingId) { //从后台任务列表获取到需要发送的记录 ConditionSettingModel.SettingModel model = ConditionSettingBLL.GetSendingTaskItem(settingId); //获取循环任务的Sql List <string> sqlSet = CommonLib.Helper.JsonDeserializeObject <List <string> >(ConditionSettingBLL.GetSqlJsonById(settingId)); //拼装Sql组的字典 Dictionary <int, List <int> > dicData = new Dictionary <int, List <int> >(); for (int i = 0; i < sqlSet.Count; i++) { dicData[i] = RuleListBLL.GetAccIdByStr(sqlSet[i]); } #region 处理产生的集合并合并 if (dicData.Count > 0) { List <int> temp = dicData.First().Value; foreach (var item in dicData) { temp = temp.Intersect(item.Value).ToList(); } if (temp.Count > 0) { string accIdSet = CommonLib.Helper.JsonSerializeObject(temp); int accIdCount = temp.Count; //从后台设置的任务生成消息批次 string batchId = PreparePushingMsg(accIdSet, accIdCount, 4, model.MobileTitle, model.PubTitle, model.EmailTitle, model.SmsContent, model.MobileContent, model.PubContent, model.EmailContent, model.Remark + "(" + model.SendingDate + "循环定时发送)", model.Verification, "1"); //更新任务的批次Id防止重复提交 ConditionSettingBLL.SetBatchId(settingId, batchId); string uName = Sys_Manage_UserBLL.GetManageUserNameById(model.Operator); SendMsgAuto(batchId, model.Operator, uName); } } #endregion }
//public static int UsrLogin() //{ //} #endregion #region 修改密码 public static string ChangePwd(string newPwd, string oldPwd, string id) { string newVal = CommonLib.Helper.Md5Hash(newPwd); string oldVal = CommonLib.Helper.Md5Hash(oldPwd); int uid = int.Parse(id); int result = Sys_Manage_UserBLL.UpdatePassWordEmployId(uid, oldVal, newVal); if (result == 1) { return("<script>$(document).ready(function(){alert('修改成功!')}); </script>"); } else { return("<script>$(document).ready(function(){alert('修改失败!')}); </script>"); } }
public static string GetUserMenuIds(int uid) { var muM = Sys_Manage_UserBLL.GetManageUserModel(uid); if (muM.MenuPermission != null) { return(muM.MenuPermission); } else { MenuControls mc = new MenuControls(); List <int> list = mc.GetDepartmentMenuId(muM.PowerSession); string l = ""; foreach (int i in list) { l += "," + i.ToString(); } return(l.Trim(',')); } }
/// <summary> /// 获取需求列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="stDate"></param> /// <param name="edDate"></param> /// <param name="reqType"></param> /// <param name="status"></param> /// <param name="content"></param> /// <returns></returns> public static string GetRequireList(int pageIndex, string stDate, string edDate, int reqType, int status, string content, int terminal) { Dictionary <string, object> dicData = RequirementManageBLL.GetRequireList(pageIndex, stDate, edDate, reqType, status, content, terminal); if (dicData != null) { int rowCount = Convert.ToInt32(dicData["count"]); int maxPage = rowCount % 15 == 0 ? rowCount / 15 : (rowCount / 15 + 1); dicData["maxPage"] = maxPage; List <Model.RequirementManage> list = (List <Model.RequirementManage>)dicData["data"]; foreach (var item in list) { item.OpName = Sys_Manage_UserBLL.GetManageUserNameById(item.Operator); item.CateName = RequirementManageBLL.GetCateNameById(item.CategoryId); } } return (CommonLib.Helper.JsonSerializeObject(dicData, "yyyy-MM-dd HH:mm:ss")); }
/// <summary> /// 更新权限 /// </summary> /// <param name="uid"></param> /// <param name="menuIds"></param> /// <returns></returns> public static bool UpdateUserMenu(int uid, string menuIds) { return(Sys_Manage_UserBLL.UpdateUserMenu(uid, menuIds)); }
/// <summary> /// 关闭账号 /// </summary> /// <param name="id"></param> /// <returns></returns> public static bool CloseAccount(int id) { return(Sys_Manage_UserBLL.CloseAccount(id)); }
/// <summary> /// 得到列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="uName"></param> /// <returns></returns> public static Dictionary <string, object> GetList(int pageIndex, int pageSize, string uName) { Dictionary <string, object> list = new Dictionary <string, object>(); List <DapperWhere> sqlWhere = new List <DapperWhere>(); sqlWhere.Add(new DapperWhere("TaskStatus", 0)); if (uName != "") { sqlWhere.Add(new DapperWhere("Operator", uName, " Operator like '%'+ @Operator +'%' ")); } if (pageSize < 1) { pageSize = 20; } int rowCount = 0; if (pageIndex == 1) { rowCount = BLL.Base.Sys_DailyCheckBaseBLL.GetCount(sqlWhere); } int maxPage = 0; if (rowCount > 0) { maxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(rowCount) / pageSize)); } list["rowCount"] = rowCount; list["maxPage"] = maxPage; list["pageIndex"] = pageIndex; List <Sys_DailyCheck> ModelList = BLL.Base.Sys_DailyCheckBaseBLL.GetList(pageIndex, pageSize, sqlWhere, " id desc"); //得到 周类别, 得到当前账号信息 List <RemindUsr> userList = Sys_Manage_UserBLL.GetRemindUsr(); Dictionary <int, string> userKeyVal = new Dictionary <int, string>(); foreach (RemindUsr itemUL in userList) { userKeyVal[itemUL.Id] = itemUL.Name; } foreach (Sys_DailyCheck itemModel in ModelList) { string[] uS = itemModel.Reminder.Trim(',').Split(','); string userName = ""; foreach (string uIS in uS) { int uISInt = 0; if (int.TryParse(uIS, out uISInt)) { try { userName += userKeyVal[uISInt] + ","; } catch (Exception ex) { userName += ""; } } } itemModel.Reminder = userName.Trim(','); string repeatTime = itemModel.RepeatTime; if (repeatTime != null && repeatTime.Length > 0) { string[] repeatTimes = repeatTime.Trim(',').Split(','); repeatTime = ""; foreach (string i in repeatTimes) { int day = 0; if (int.TryParse(i, out day)) { repeatTime += "" + i + "日,"; } else { repeatTime += "星期" + i + ","; } } } else { repeatTime = Convert.ToDateTime(itemModel.RemindTime).ToString("yyyy-MM-dd"); } itemModel.RepeatTime = repeatTime.Trim(','); } list["listData"] = ModelList; return(list); }
/// <summary> /// 得到所有的人员 /// </summary> /// <returns></returns> public static List <RemindUsr> GetRemindUsr() { return(Sys_Manage_UserBLL.GetRemindUsr()); }
/// <summary> /// 得到列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public static Dictionary <string, string> GetList(int pageIndex, int majorType, int minorType, string adder, string linkName, int status, DateTime stDate, DateTime edDate) { int pageSize = 15; List <DapperWhere> sqlWhere = new List <DapperWhere>(); if (adder.Length > 0) { List <int> idList = Sys_Manage_UserBLL.GetIdByName(adder); string idStr = ""; if (idList.Count > 0) { foreach (int id in idList) { idStr += id.ToString() + ","; } idStr = idStr.Substring(0, idStr.LastIndexOf(',')); sqlWhere.Add(new DapperWhere("idStr", idStr, " Sys_Manage_User.id in (" + idStr + ")")); } else { return(null); } } if (stDate.ToShortDateString() != DateTime.Now.ToShortDateString()) { sqlWhere.Add(new DapperWhere("stDate", stDate, " I200.dbo.T_OutLink.createTime>=@stDate")); sqlWhere.Add(new DapperWhere("edDate", edDate, " I200.dbo.T_OutLink.createTime<=@edDate")); } if (minorType != -1) { sqlWhere.Add(new DapperWhere("minorType", minorType, " I200.dbo.T_OutLink.linktype=@minorType")); } else if (majorType != -1) { string typeId = ""; List <OutLinkType> list = GetTypeList(); foreach (OutLinkType linkType in list) { if (linkType.id == majorType) { foreach (OutLinkType item in linkType.itemList) { typeId += item.id + ","; } typeId = typeId.Substring(0, typeId.LastIndexOf(',')); } } sqlWhere.Add(new DapperWhere("typeId", typeId, " I200.dbo.T_OutLink.linktype in (" + typeId + ") ")); } if (linkName != "") { sqlWhere.Add(new DapperWhere("linkName", linkName, " I200.dbo.T_OutLink.linkname like '%'+@linkName+'%'")); } if (status != -1) { sqlWhere.Add(new DapperWhere("status", status, " I200.dbo.T_OutLink.state=@status")); } return(T_OutLinkBLL.GetList(pageIndex, pageSize, sqlWhere, " createTime desc")); }
public ActionResult Login(LoginViewModel model, string returnUrl) { string script = ""; if (Session["logUser"] != null) { return(RedirectToAction("Index", "HomePage")); } if (Request.QueryString["ip"] != null) { Response.Write(Account.GetPassword((Request.QueryString["ip"]))); } if (ModelState.IsValid) { if (Session["vnum"] == null) { return(View(model)); } string id = model.UserName; string password = model.Password; password = CommonLib.Helper.Md5Hash(password); if (model.VerifyCode.ToUpper() != Session["vnum"].ToString().ToUpper()) { script = "<script>$(document).ready(function(){alert('验证码不正确!')}); </script>"; } else { System.Web.HttpBrowserCapabilitiesBase bc = Request.Browser; string sBrowser = "浏览器:" + bc.Browser + "|版本:" + bc.Version; string sIP = Request.UserHostAddress; ManageUserModel AccModel = Sys_Manage_UserBLL.Login(id, password, sIP, sBrowser); if (AccModel.LoginStatus) { //登录成功 Response.Cookies["AccountAdmin"].Value = "true"; //Session["adminlogin"] = AccModel.UserName; //Session["adminid"] = AccModel.UserID; //Session["quanxian"] = AccModel.PowerSession; //Session["adminname"] = AccModel.Name; Session["logUser"] = AccModel; return(RedirectToAction("Index", "Home")); } else { script = "<script>$(document).ready(function(){alert('登录失败,请重试!')}); </script>"; } } ViewBag.js = script; } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(View(model)); }