public ActionResult Add(Model.CRMUser mc) { int flag = -1; #region 检查是否已有重名员工 IList <Model.CRMUser> lmcu = new List <Model.CRMUser>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); condition.Add(new KeyValuePair <string, object>("Username", mc.Username)); LIB.PageModel lpm = new LIB.PageModel(); lmcu = LIB.MoreTermSelect.MoreTerm <Model.CRMUser>(condition, "CRMUser", ref lpm); #endregion #region 保存密码MD5 mc.Password = LIB.MD5.GetMD5(mc.Password); #endregion if (lmcu.Count == 0) { bool issuccess = BLL.CommonBLL.add <Model.CRMUser>(mc); flag = issuccess ? 1 : 0; } var ret = new { messagecode = flag }; return(Json(ret, JsonRequestBehavior.AllowGet)); }
// GET: TargetCustomers public ActionResult Index(int Id, int?PageCount = 1, int?PageSize = 5, string tcName = "", string tcPhone = "") { IList <Model.TargetCustomers> lmtc = new List <Model.TargetCustomers>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); #region 查询条件 if (!string.IsNullOrWhiteSpace(tcName)) { condition.Add(new KeyValuePair <string, object>("tcName", tcName)); } if (!string.IsNullOrWhiteSpace(tcPhone)) { condition.Add(new KeyValuePair <string, object>("tcPhone", tcPhone)); } condition.Add(new KeyValuePair <string, object>("tcfkamId", Id)); #endregion LIB.PageModel lpm = new LIB.PageModel(); lpm.fldName = "tcId"; lpm.PageCount = PageCount.Value; lpm.PageSize = PageSize.Value; lmtc = LIB.MoreTermSelect.MoreTerm <Model.TargetCustomers>(condition, "TargetCustomers", ref lpm); PagedList <Model.TargetCustomers> pagems = new PagedList <Model.TargetCustomers>(lmtc, PageCount.Value, PageSize.Value, lpm.TotalCount); ViewData["pagems"] = pagems; #region 搜索字段在页面中显示 ViewBag.tcName = tcName; ViewBag.tcPhone = tcPhone; ViewBag.tcfkamId = Id; ViewBag.excelName = this.ImportModleFile; #endregion return(View()); }
public ActionResult Check(Model.CRMUser mcu) { IList <Model.CRMUser> lmcu = new List <Model.CRMUser>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); condition.Add(new KeyValuePair <string, object>("Username", mcu.Username)); condition.Add(new KeyValuePair <string, object>("Password", LIB.MD5.GetMD5(mcu.Password))); LIB.PageModel lpm = new LIB.PageModel(); lmcu = LIB.MoreTermSelect.MoreTerm <Model.CRMUser>(condition, "CRMUser.ufkRole,Role.rId", ref lpm); if (lmcu.Count > 0) { Session["UserInfo"] = lmcu[0]; //Hangfire.BackgroundJob.Enqueue(() => LIB.Mail.MailSend("[email protected];[email protected]", "测试", "成功")); //LIB.LogHelper.Default.Fatal("测试"); //var jobId= Hangfire.BackgroundJob.Enqueue(() => LIB.Mail.BackgroundSendMail()); // Hangfire.BackgroundJob.ContinueWith(jobId, () => LIB.Hubs.PushHub.PushToClientBySendEmailFinish()); //IHubContext chat = GlobalHost.ConnectionManager.GetHubContext<PushHub>(); //chat.Clients.All.notice("发送成功"); return(RedirectToAction("Index", "Home")); } else { return(RedirectToAction("Index", "Login")); } }
// GET: Depart public ActionResult Index() { IList <Model.Depart> lmd = new List <Model.Depart>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); LIB.PageModel lpm = new LIB.PageModel(); lmd = LIB.MoreTermSelect.MoreTerm <Model.Depart>(condition, "Depart", ref lpm); ViewData["lmd"] = lmd; return(View()); }
// GET: ActivityAssignManage public ActionResult Index(int?PageCount = 1, int?PageSize = 5, string amName = "", int?amResult = -1, string amBeginTime = "", string amEndTime = "") { IList <Model.ActivityManage> lmam = new List <Model.ActivityManage>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); #region 查询条件 if (!string.IsNullOrWhiteSpace(amName)) { condition.Add(new KeyValuePair <string, object>("amName", amName)); } if (amResult != null && amResult != -1) { condition.Add(new KeyValuePair <string, object>("amResult", amResult)); } #region 起止时间 if (!string.IsNullOrEmpty(amBeginTime) && string.IsNullOrEmpty(amEndTime)) { condition.Add(new KeyValuePair <string, object>("amBeginTime", ">='" + amBeginTime + "'")); } if (string.IsNullOrEmpty(amBeginTime) && !string.IsNullOrEmpty(amEndTime)) { condition.Add(new KeyValuePair <string, object>("amEndTime", "<='" + amEndTime + "'")); } if (!string.IsNullOrEmpty(amBeginTime) && !string.IsNullOrEmpty(amEndTime)) { condition.Add(new KeyValuePair <string, object>("amBeginTime", ">='" + amBeginTime + "'")); condition.Add(new KeyValuePair <string, object>("amEndTime", "<='" + amEndTime + "'")); } #endregion condition.Add(new KeyValuePair <string, object>("amfkRole", LoginUserInfo.ufkRole.Value)); #endregion LIB.PageModel lpm = new LIB.PageModel(); lpm.fldName = "amid"; lpm.PageCount = PageCount.Value; lpm.PageSize = PageSize.Value; lmam = LIB.MoreTermSelect.MoreTerm <Model.ActivityManage>(condition, "ActivityManage.amfkRole,Role.rId", ref lpm); PagedList <Model.ActivityManage> pagems = new PagedList <Model.ActivityManage>(lmam, PageCount.Value, PageSize.Value, lpm.TotalCount); ViewData["pagems"] = pagems; #region 搜索字段在页面中显示 ViewBag.amName = amName; ViewBag.amResult = amResult; ViewBag.amBeginTime = amBeginTime; ViewBag.amEndTime = amEndTime; #endregion return(View()); }
// GET: CRMUser public ActionResult Index(int?PageCount = 1, int?PageSize = 5, string Username = "", int?ufkDepart = -1, int?ufkRole = -1) { IList <Model.CRMUser> lmcu = new List <Model.CRMUser>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); #region 查询条件 if (!string.IsNullOrWhiteSpace(Username)) { condition.Add(new KeyValuePair <string, object>("Username", Username)); } if (ufkDepart != null && ufkDepart != -1) { condition.Add(new KeyValuePair <string, object>("ufkDepart", ufkDepart)); } if (ufkRole != null && ufkRole != -1) { condition.Add(new KeyValuePair <string, object>("ufkRole", ufkRole)); } #endregion LIB.PageModel lpm = new LIB.PageModel(); lpm.fldName = "uid"; lpm.PageCount = PageCount.Value; lpm.PageSize = PageSize.Value; lmcu = LIB.MoreTermSelect.MoreTerm <Model.CRMUser>(condition, "CRMUser.ufkDepart,Depart.hrdId,CRMUser.ufkRole,Role.rId", ref lpm); condition.Clear(); PagedList <Model.CRMUser> pagems = new PagedList <Model.CRMUser>(lmcu, PageCount.Value, PageSize.Value, lpm.TotalCount); ViewData["pagems"] = pagems; #region 获取部门 IList <Model.Depart> lmd = new List <Model.Depart>(); LIB.PageModel lpmDepart = new LIB.PageModel(); lmd = LIB.MoreTermSelect.MoreTerm <Model.Depart>(condition, "Depart", ref lpmDepart); ViewData["lmd"] = lmd; #endregion #region 获取角色 IList <Model.Role> lmr = new List <Model.Role>(); LIB.PageModel lpmRole = new LIB.PageModel(); lmr = LIB.MoreTermSelect.MoreTerm <Model.Role>(condition, "Role", ref lpmRole); ViewData["lmr"] = lmr; #endregion #region 搜索字段在页面中显示 ViewBag.Username = Username; ViewBag.ufkDepart = ufkDepart; ViewBag.ufkRole = ufkRole; #endregion return(View()); }
// GET: Role public ActionResult Index() { IList <Model.Role> lmr = new List <Model.Role>(); IList <Model.RoleButton> lmrb = new List <Model.RoleButton>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); LIB.PageModel lpm = new LIB.PageModel(); lmr = LIB.MoreTermSelect.MoreTerm <Model.Role>(condition, "Role", ref lpm); lmrb = LIB.MoreTermSelect.MoreTerm <Model.RoleButton>(condition, "RoleButton", ref lpm); ViewData["lmr"] = lmr; ViewData["lmrb"] = lmrb; return(View()); }
/// <summary> /// 获取单表数据 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public static IList <T> GetListDate <T>(string tablename = "") { Type t = typeof(T); if (string.IsNullOrWhiteSpace(tablename)) { tablename = t.Name; } IList <T> lm = new List <T>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); LIB.PageModel lpm = new LIB.PageModel(); lm = LIB.MoreTermSelect.MoreTerm <T>(condition, tablename, ref lpm); return(lm); }
// GET: RoleButton public ActionResult Index() { IList <Model.RoleButton> lmrb = new List <Model.RoleButton>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); condition.Add(new KeyValuePair <string, object>("rbId", LoginUserInfo.RoleButtons)); LIB.PageModel lpm = new LIB.PageModel(); lmrb = LIB.MoreTermSelect.MoreTerm <Model.RoleButton>(condition, "RoleButton", ref lpm); ViewData["lmrb"] = lmrb; return(View()); }
// GET: ClueManage public ActionResult Index(int?PageCount = 1, int?PageSize = 5, string cmCustomerName = "", string cmPhone = "", int?cmfkRole = -1) { IList <Model.ClueManage> lmcm = new List <Model.ClueManage>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); #region 查询条件 if (!string.IsNullOrWhiteSpace(cmCustomerName)) { condition.Add(new KeyValuePair <string, object>("cmCustomerName", cmCustomerName)); } if (!string.IsNullOrWhiteSpace(cmPhone)) { condition.Add(new KeyValuePair <string, object>("cmPhone", cmPhone)); } if (cmfkRole != -1) { condition.Add(new KeyValuePair <string, object>("cmfkRole", cmfkRole)); } #endregion LIB.PageModel lpm = new LIB.PageModel(); lpm.fldName = "cmId"; lpm.PageCount = PageCount.Value; lpm.PageSize = PageSize.Value; lmcm = LIB.MoreTermSelect.MoreTerm <Model.ClueManage>(condition, "ClueManage.cmfkRole,Role.rId", ref lpm); condition.Clear(); PagedList <Model.ClueManage> pagems = new PagedList <Model.ClueManage>(lmcm, PageCount.Value, PageSize.Value, lpm.TotalCount); ViewData["pagems"] = pagems; #region 获取角色 IList <Model.Role> lmr = new List <Model.Role>(); LIB.PageModel lpmRole = new LIB.PageModel(); lmr = LIB.MoreTermSelect.MoreTerm <Model.Role>(condition, "Role", ref lpmRole); ViewData["lmr"] = lmr; #endregion #region 搜索字段在页面中显示 ViewBag.cmCustomerName = cmCustomerName; ViewBag.cmPhone = cmPhone; ViewBag.excelName = this.ImportModleFile; ViewBag.cmfkRole = cmfkRole; #endregion return(View()); }
// GET: OrderManage public ActionResult Index(int?PageCount = 1, int?PageSize = 1) { IList <Model.OrderManage> lmo = new List <Model.OrderManage>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); LIB.PageModel lpm = new LIB.PageModel(); lpm.fldName = "omId"; lpm.PageCount = PageCount.Value; lpm.PageSize = PageSize.Value; lmo = LIB.MoreTermSelect.MoreTerm <Model.OrderManage>(condition, "OrderManage.omId,ContractManage.cmfkomId", ref lpm); PagedList <Model.OrderManage> pagems = new PagedList <Model.OrderManage>(lmo, PageCount.Value, PageSize.Value, lpm.TotalCount); ViewData["pagems"] = pagems; return(View()); }
// GET: CustomerManage public ActionResult Index(int?PageCount = 1, int?PageSize = 5) { IList <Model.TargetCustomers> lmtc = new List <Model.TargetCustomers>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); LIB.PageModel lpm = new LIB.PageModel(); lpm.fldName = "tcId"; lpm.PageCount = PageCount.Value; lpm.PageSize = PageSize.Value; lmtc = LIB.MoreTermSelect.MoreTerm <Model.TargetCustomers>(condition, "TargetCustomers", ref lpm); List <string> SendMail = lmtc.Select(a => a.tcEmail).ToList();//筛选出所有客户邮箱 PagedList <Model.TargetCustomers> pagems = new PagedList <Model.TargetCustomers>(lmtc, PageCount.Value, PageSize.Value, lpm.TotalCount); ViewData["pagems"] = pagems; ViewBag.SendMail = Newtonsoft.Json.JsonConvert.SerializeObject(SendMail); return(View()); }
public ActionResult Delete(Model.Role mr) { int flag = -1; #region 判断角色下是否存在员工 IList <Model.CRMUser> lmcu = new List <Model.CRMUser>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); condition.Add(new KeyValuePair <string, object>("ufkRole", mr.rId)); LIB.PageModel lpm = new LIB.PageModel(); lmcu = LIB.MoreTermSelect.MoreTerm <Model.CRMUser>(condition, "CRMUser", ref lpm); #endregion if (lmcu.Count == 0) { bool issuccess = BLL.CommonBLL.Delete <Model.Role>(mr); flag = issuccess ? 1 : 0; } var ret = new { messagecode = flag }; return(Json(ret, JsonRequestBehavior.AllowGet)); }
public ActionResult Assign(int Id, int?PageCount = 1, int?PageSize = 5) { IList <Model.ActivityAssignManage> lmaa = new List <Model.ActivityAssignManage>(); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); condition.Add(new KeyValuePair <string, object>("aafkamId", Id)); LIB.PageModel lpm = new LIB.PageModel(); lmaa = LIB.MoreTermSelect.MoreTerm <Model.ActivityAssignManage>(condition, "ActivityAssignManage.aafkRole,Role.rId", ref lpm); condition.Clear(); PagedList <Model.ActivityAssignManage> pagems = new PagedList <Model.ActivityAssignManage>(lmaa, PageCount.Value, PageSize.Value, lpm.TotalCount); ViewData["pagems"] = pagems; #region 获取角色 IList <Model.Role> lmr = new List <Model.Role>(); LIB.PageModel lpmRole = new LIB.PageModel(); lmr = LIB.MoreTermSelect.MoreTerm <Model.Role>(condition, "Role", ref lpmRole); ViewData["lmr"] = lmr; #endregion ViewBag.aafkamId = Id; return(View()); }
public ActionResult Index(int?PageCount = 1, int?PageSize = 1) { //Model.Student ms = new Model.Student(); //ms.Name = "赵六"; //ms.Age = "21"; //var a = BLL.CommonBLL.ExecByProc(ms); //演示Git管理代码 IList <Model.Student> lms = new List <Model.Student>(); //lms = BLL.testBLL.GetStudent(); //lms = BLL.testBLL.Get<Model.Student>("select * from student"); IList <KeyValuePair <string, object> > condition = new List <KeyValuePair <string, object> >(); #region 条件使用说明 //condition.Add(new KeyValuePair<string, object>("Name", "张三"));//'='不用写 //condition.Add(new KeyValuePair<string, object>("Name", "%张三%"));//代表 like //condition.Add(new KeyValuePair<string, object>("Name", "|李四"));//‘|’代表OR,代表与前一个条件取或 //condition.Add(new KeyValuePair<string, object>("Age", "22,23"));//代表 in (22,23) //condition.Add(new KeyValuePair<string, object>("Age", ">20"));//可做数据间的比较操作 > < != //.Add(new KeyValuePair<string, object>("Age", "20'@'25"));//'@' 代表两个数据做Between ... and #endregion #region 分页实体 LIB.PageModel lpm = new LIB.PageModel(); lpm.fldName = "sid"; lpm.PageCount = PageCount.Value; lpm.PageSize = PageSize.Value; #endregion lms = LIB.MoreTermSelect.MoreTerm <Model.Student>(condition, "student", ref lpm);//student.sid,class.cid 代表多表联查 ViewData["lms"] = lms; PagedList <Model.Student> pagems = new PagedList <Model.Student>(lms, PageCount.Value, PageSize.Value, lpm.TotalCount); ViewData["pagems"] = pagems; return(View()); }