Exemplo n.º 1
0
        public ActionResult FirstLogin(string name, string pwd, string num)
        {
            ReturnData <string> ret   = new ReturnData <string>();
            AgentBll            aBll  = new AgentBll();
            UserBasicBll        uBll  = new UserBasicBll();
            UserPCBll           pcBll = new UserPCBll();

            Agent     aModel  = aBll.GetModelByPhone(num);
            UserBasic uModel  = new UserBasic();
            UserPC    pcModel = new UserPC();

            uModel.NickName     = name;
            uModel.UserType     = 1;
            uModel.EnterpriseID = aModel.EnterpriseID;
            uModel.AddTime      = DateTime.Now;
            long id = uBll.AddAndGetId(uModel);

            pcModel.UserBasicID    = id;
            pcModel.PassWord       = SimpleEncrypt.SaltMD5(pwd.Replace(" ", ""));
            pcModel.PCType         = 2;
            pcModel.RoleID         = aModel.ID;
            pcModel.Status         = 0;
            pcModel.UserName       = name;
            pcModel.AddTime        = DateTime.Now;
            pcModel.AddUserBasicID = 0;
            ret = pcBll.AddUserPc(pcModel);
            if (ret.Status == true)
            {
                aModel.Status = 0;
                aBll.EditAgent(aModel);
                return(Content(ret.Message));
            }
            return(Content(ret.Message));
        }
Exemplo n.º 2
0
        public ActionResult Add(PcAndRole model)
        {
            Utility.ReturnData <string> returnData = new Utility.ReturnData <string>();
            long      count   = bll.GetQueryCount(x => x.UserName == model.UserName && x.Status != 1);
            UserBasic ubModel = new UserBasic();

            ubModel.NickName     = model.UserName;
            ubModel.UserType     = 1;
            ubModel.AddTime      = DateTime.Now;
            ubModel.EnterpriseID = LoginUser.UserBasic.EnterpriseID;
            long   id      = ubBll.AddAndGetId(ubModel);
            UserPC upModel = new UserPC();

            upModel.UserName       = model.UserName;
            upModel.UserBasicID    = id;
            upModel.RoleID         = model.RoleID;
            upModel.PCType         = 1;
            upModel.AddTime        = DateTime.Now;
            upModel.PassWord       = SimpleEncrypt.SaltMD5(model.PassWord.Replace(" ", ""));
            upModel.AddUserBasicID = LoginUser.UserBasicID;
            upModel.Status         = 0;
            returnData             = bll.AddUserPc(upModel);
            if (returnData.Status == false)
            {
                ubBll.Delete(s => s.ID == id);
                return(Content(returnData.Message));
            }
            return(Content(returnData.Message));
        }
Exemplo n.º 3
0
        public ActionResult FirstLogin(string name, string pwd, string num)
        {
            ReturnData<string> ret = new ReturnData<string>();
            AgentBll aBll = new AgentBll();
            UserBasicBll uBll = new UserBasicBll();
            UserPCBll pcBll = new UserPCBll();

            Agent aModel = aBll.GetModelByPhone(num);
            UserBasic uModel = new UserBasic();
            UserPC pcModel = new UserPC();

            uModel.NickName = name;
            uModel.UserType = 1;
            uModel.EnterpriseID = aModel.EnterpriseID;
            uModel.AddTime = DateTime.Now;
            long id = uBll.AddAndGetId(uModel);

            pcModel.UserBasicID = id;
            pcModel.PassWord = SimpleEncrypt.SaltMD5(pwd.Replace(" ", ""));
            pcModel.PCType = 2;
            pcModel.RoleID = aModel.ID;
            pcModel.Status = 0;
            pcModel.UserName = name;
            pcModel.AddTime = DateTime.Now;
            pcModel.AddUserBasicID = 0;
            ret = pcBll.AddUserPc(pcModel);
            if (ret.Status == true)
            {
                aModel.Status = 0;
                aBll.EditAgent(aModel);
                return Content(ret.Message);

            }
            return Content(ret.Message);
        }