Ejemplo n.º 1
0
        public ActionResult AddAndUpdateUser(int userid)
        {
            //省份
            IEnumerable<SelectListItem> provinceList = null;
            List<t_Province> common = areaService.GetProvinceList();
            provinceList = common.Select(com => new SelectListItem { Value = com.provinceID.ToString(), Text = com.province });
            ViewBag.provinceList = provinceList;
            //工作年限
            List<WebLookup> workyearlist = commonService.GetLookupList("people_workyear");
            ViewBag.workyearslist = workyearlist;
            //工人职位
            List<WebLookup> commonworkPosition = commonService.GetLookupList("workers_position");       
            ViewBag.workPositionList = commonworkPosition;

            WebUser webuser = webuserservice.GetWebUserByID(userid);
            //List<WebLookup> weblooktypelist = webcommonser.GetLookupList("people_category");
            //IEnumerable<SelectListItem> typelist = weblooktypelist.Select(com => new SelectListItem { Value = com.Code.ToString(), Text = com.Description });
            //ViewBag.typelist = typelist;
            WebWorker work = new WebWorker();
            if (webuser != null)
            {
                if (webuser.PositionCode != "WebUser")
                {
                    work = workSer.GetWebWorkerByUserID(userid);
                }
            }else
            {
                webuser = new WebUser();
            }
            ViewBag.worker = work;
            return View(webuser);
        }
Ejemplo n.º 2
0
        public int LoginOn(string userAccount, string userPassword)
        {
            string password = FormsAuthentication.HashPasswordForStoringInConfigFile(userPassword, "md5");
            bool   exist    = webUserservice.ExistUser(userAccount, password);

            if (exist)
            {
                WebUser          User             = webUserservice.GetWebUserByAccount(userAccount, password);
                WebUserService   webuserservice   = new WebUserService();
                WebPeopleService webpeopleservice = new WebPeopleService();
                //userAccount=UserName
                if (User.IsLock)
                {
                    //被锁定
                    return(100);
                }
                else
                {
                    SessionHelper.SetSession("UserName", userAccount);

                    WebUser webuser = webuserservice.GetWebUserByAccount(userAccount);
                    SessionHelper.SetSession("UserID", webuser.UserID);
                    SessionHelper.SetSession("PositionCode", webuser.PositionCode);

                    WebPeople webpeople = new WebPeople();
                    WebWorker webWorker = new WebWorker();
                    if (webpeopleservice.IsHaveuser(webuser.UserID) && webuser.PositionCode == "WebPeople")
                    {
                        webpeople = webpeopleservice.GetWebPeopleByUserID(webuser.UserID);
                        SessionHelper.SetSession("PositionID", webpeople.PeopleID);
                    }
                    else if (webWorkerService.IsHaveWorker(webuser.UserID) && (webuser.PositionCode == "WebWorkerLeader" || webuser.PositionCode == "WebWorker"))
                    {
                        webWorker = webWorkerService.GetWebWorkerByUserID(webuser.UserID);
                        SessionHelper.SetSession("PositionID", webWorker.WorkerID);
                    }
                    SessionHelper.SetSession("NickName", webuser.NickName);
                    return(200);
                }
            }
            else
            {
                return(500);
            }
        }