Example #1
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            #region 测试登陆
            if (Session["UserInfo"] == null)
            {
                Model.CRMUser mc = new Model.CRMUser();
                mc.uId              = 1;
                mc.Username         = "******";
                mc.Password         = "******";
                mc.ufkDepart        = 1;
                mc.ufkRole          = 2;
                mc.RoleName         = "总经理";
                mc.RoleButtons      = "1";
                Session["UserInfo"] = mc;
            }
            #endregion

            if (filterContext.HttpContext.Session["UserInfo"] == null)
            {
                filterContext.Result = RedirectToAction("Index", "Login");
            }
            else
            {
                LoginUserInfo = filterContext.HttpContext.Session["UserInfo"] as Model.CRMUser;
            }

            base.OnActionExecuting(filterContext);
        }
Example #2
0
        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));
        }
Example #3
0
        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"));
            }
        }
Example #4
0
        public ActionResult Delete(Model.CRMUser mc)
        {
            bool issuccess = BLL.CommonBLL.Delete <Model.CRMUser>(mc);
            var  ret       = new
            {
                messagecode = issuccess ? 1 : 0,
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public ActionResult Edit(Model.CRMUser mc)
        {
            #region 保存密码MD5
            mc.Password = LIB.MD5.GetMD5(mc.Password);
            #endregion

            bool issuccess = BLL.CommonBLL.Update <Model.CRMUser>(mc);
            var  ret       = new
            {
                messagecode = issuccess ? 1 : 0,
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }