Example #1
0
        private bool DoEdit()
        {
            int _id = MyCommFun.Str2Int(lblid.Text);
            //地区
            string prov = ddlProvince.SelectedItem.Value;
            string city = ddlCity.SelectedItem.Value;
            string dist = txtArea.Text.Trim();


            bool result = false;
            var managerService = new ManagerInfoService();
            var model = managerService.GetModel(_id);


            model.RealName = txtRealName.Text.Trim();
            model.Telephone = txtTelephone.Text.Trim();
            model.Email = txtEmail.Text.Trim();
            model.QQ = txtqq.Text;
            model.Email = txtEmail.Text;

            model.Province = prov;
            model.City = city;
            model.County = dist;


            if (managerService.Update(model))
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改个人资料:" + model.UserName); //记录日志
                result = true;
            }

            return result;
        }
Example #2
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var bll = new ManagerInfoService();
            var model = GetAdminInfo();

            if (DESEncrypt.Encrypt(txtOldPassword.Text.Trim(), model.Salt) != model.Password)
            {
                JscriptMsg("旧密码不正确!", "", "Warning");
                return;
            }
            if (txtPassword.Text.Trim() != txtPassword1.Text.Trim())
            {
                JscriptMsg("两次密码不一致!", "", "Warning");
                return;
            }
            model.Password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.Salt);
            if (!bll.Update(model))
            {
                JscriptMsg("保存过程中发生错误!", "", "Error");
                return;
            }
            Session[SystemKeys.SESSION_ADMIN_INFO] = null;
            JscriptMsg("密码修改成功!", "manager_pwd.aspx", "Success");
        }
Example #3
0
        private bool DoEdit(int _id)
        {
            int oldMaxNum = MyCommFun.Str2Int(hidOldMaxNum.Value);
            int newMaxNum = MyCommFun.Str2Int(ddlMaxNum.SelectedItem.Value);
            int addNewNum = newMaxNum - oldMaxNum; //新增的帐号
         

            var adminEntity = GetAdminInfo(); //取得管理员信息
            var agent = new AgentInfo();
            bool isAgent = false;
            if (adminEntity.AgentLevel < 0)
            {
                return false;
            }
            if (adminEntity.AgentLevel > 0)
            {
                agent = aBll.GetAgentModel(adminEntity.Id);
                isAgent = true;
                if (agent.RemainMony < agent.AgentPrice * addNewNum)
                {
                    JscriptMsg("余额不足,请联系管理员充值!", "", "Error");
                    return false;
                }
            }
            

            //地区
            string prov = ddlProvince.SelectedItem.Value;
            string city = ddlCity.SelectedItem.Value;
            string dist = txtArea.Text.Trim();


            bool result = false;
            var bll = new ManagerInfoService();
            var model = bll.GetModel(_id);

            model.RoleId = int.Parse(ddlRoleId.SelectedValue);
            model.RoleType = new ManagerRoleService().GetModel(model.RoleId).RoleType;
            if (cbIsLock.Checked == true)
            {
                model.IsLock = 0;
            }
            else
            {
                model.IsLock = 1;
            }
            //判断密码是否更改
            if (txtPassword.Text.Trim() != "")
            {
                //获取用户已生成的salt作为密钥加密
                model.Password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.Salt);
            }
            model.RealName = txtRealName.Text.Trim();
            model.Telephone = txtTelephone.Text.Trim();
            model.Email = txtEmail.Text.Trim();
            model.WxNum = int.Parse(ddlMaxNum.SelectedItem.Value);

            model.QQ = txtqq.Text;
            model.Email = txtEmail.Text;
          
            model.Province = prov;
            model.City = city;
            model.County = dist;
            model.SortId = MyCommFun.Str2Int(txtSortid.Text);
            model.Remark = txtRemark.Text;
          
            bool updateRet = bll.Update(model);

            if (updateRet && isAgent && addNewNum > 0)
            {
                int xfjine = addNewNum * agent.AgentPrice.Value;//消费金额

                agent.RemainMony -= xfjine;
                agent.WcodeNum += newMaxNum;

                bool updateRet2 = aBll.Update(agent);
                if (updateRet2)
                {
                    var bBll = new WXManagerBillService(new ManagerBillRepository());
                    var bill = new ManagerBillInfo
                    {
                        BillMoney = xfjine,
                        ManagerId = agent.ManagerId,
                        OperPersonId = agent.ManagerId,
                        OperDate = DateTime.Now,
                        BillUsed = "原用户" + model.UserName + "新增了" + addNewNum + "个微帐号",
                        MoneyType = "扣减"
                    };
                    int addBillId = bBll.Add(bill);

                }
                else
                {
                    bll.Delete(_id);
                    updateRet=false;
                }
 
            }

            if (updateRet)
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改用户:" + model.UserName); //记录日志
                result = true;
            }

            return result;
        }