Ejemplo n.º 1
0
        public int Register(string userAccount, string userPassword, string PositionCode, int PositionType)
        {
            bool bit = webUserservice.IsHaveuserAccount(userAccount);

            if (bit)
            {
                //存在
                return(0);
            }
            else
            {
                WebUser webuser = new WebUser
                {
                    UserName     = userAccount,
                    Password     = FormsAuthentication.HashPasswordForStoringInConfigFile(userPassword, "md5"),
                    Telephone    = userAccount,
                    PositionCode = PositionCode,
                    PositionType = PositionType
                };
                int result = webUserservice.AddWebUser(webuser);
                int userid = webUserservice.GetWebUserByAccount(userAccount).UserID;
                if (PositionCode == "WebWorkerLeader" || PositionCode == "WebWorker")
                {
                    WebWorker worker = new WebWorker
                    {
                        WorkerPhone = userAccount,
                        UserID      = userid
                    };
                    if (PositionCode == "WebWorkerLeader")
                    {
                        worker.WorkerCategory = "装修工长";
                    }
                    else
                    {
                        worker.WorkerCategory = "装修工人";
                    }
                    webWorkerService.AddWebWorker(worker);
                }
                return(result);
            }
        }
Ejemplo n.º 2
0
        public int Register(string userAccount, string userPassword, string PositionCode, int PositionType)
        {
            bool bit = webUserservice.IsHaveuserAccount(userAccount);

            if (bit)
            {
                //存在
                return(0);
            }
            else
            {
                WebUser webuser = new WebUser
                {
                    UserName     = userAccount,
                    Password     = FormsAuthentication.HashPasswordForStoringInConfigFile(userPassword, "md5"),
                    Telephone    = userAccount,
                    PositionCode = PositionCode,
                    PositionType = PositionType
                };
                int result = webUserservice.AddWebUser(webuser);
                return(result);
            }
        }
Ejemplo n.º 3
0
        public ActionResult AddAndUpdateUserAndWorkerModel(UserAndWorkerModel model)
        {
            string workercategory = "";
            if(model.PositionCode== "WebWorkerLeader")
            {
                workercategory = "装修工长";
            }
            else if (model.PositionCode == "WebWorker")
            {
                workercategory = "装修工人";
            }
            int result = 0;

            string Password = "";
            if (model.Password != null)
            {
                Password = FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password, "md5");
            }

            WebUser user = new WebUser()
            {
                UserID = model.UserID,
                UserName = model.UserName,
                Password = Password,
                NickName = model.NickName,
                TrueName = model.TrueName,
                Email = model.Email,
                Sex = model.Sex,
                PositionCode = model.PositionCode,
                Telephone = model.Telephone,
                ProvinceID = model.ProvinceID,
                ProvinceName = model.ProvinceName,
                CityID = model.CityID,
                CityName = model.CityName,
                AreasID = model.AreasID,
                AreasName = model.AreasName,
                IsLock = model.IsLock,
                InUser = model.InUser
            };
            WebWorker worker = new WebWorker()
            {
                WorkerName=model.TrueName,
                WorkerCategory= workercategory,
                WorkerPhone=model.Telephone,
                WorkerMail=model.Email,
                WorkerInfo=model.WorkerInfo,
                WorkerMotto=model.WorkerMotto,
                ProvinceID=model.ProvinceID,
                ProvinceName=model.ProvinceName,
                CityID=model.CityID,
                CityName=model.CityName,
                AreasID=model.AreasID,
                AreasName=model.AreasName,
                WorkYearsID=model.WorkYearsID,
                WorkYears=model.WorkYears,
                PriceName=model.PriceName,
                GoodAtStyle=model.GoodAtStyle,
                WorkerPositionID=model.WorkerPositionID,
                WorkerPosition=model.WorkerPosition,
                IsApproved=model.InUser,
                Address= model.Address

            };
            if (model != null && model.UserID > 0)
            {
                result = webuserservice.UpdateWebUser(user);
                WebUser webu = webuserservice.GetWebUserByAccount(model.UserName);
                worker.UserID = webu.UserID;
                result = workSer.UpdateWebWorkerFromCenter(worker);
            }
            else
            {
                result = webuserservice.AddWebUser(user);
                WebUser webu= webuserservice.GetWebUserByAccount(model.UserName);
                worker.UserID = webu.UserID;
                result = workSer.AddWebWorker(worker);

            }
            return Json(new { retCode = result }, JsonRequestBehavior.AllowGet);
        }