private void UpdateUserInfo(HttpContext context)
        {
            BLL.UserInfo bll      = new BLL.UserInfo();
            string       UserName = context.Request["U_username"];
            string       ID       = context.Request["U_ID"];
            int          ExistRes = bll.Exist(string.Format("U_username='******' and U_ID not in ({1})", UserName, ID));

            if (ExistRes > 0)
            {
                context.Response.Write("exist");
                return;
            }
            Model.UserInfo model = new Model.UserInfo();
            model.U_ID       = Convert.ToInt32(ID);
            model.U_username = UserName;
            model.U_power    = context.Request["U_power"];
            model.U_nickname = context.Request["U_nickname"];
            model.U_mailbox  = context.Request["U_mailbox"];
            model.U_Role     = context.Request["U_Role"];
            model.U_Comments = context.Request["U_Comments"];
            if (bll.Update(model))
            {
                context.Response.Write("success");
            }
            else
            {
                context.Response.Write("fail");
            }
        }
Exemplo n.º 2
0
 protected void btn_Sub_Click(object sender, EventArgs e)
 {
     Model.Users modeluser = new Model.Users();
     modeluser.username = Name.Value;
     if (hiduid.Value != "")
     {
         blluser.Update(modeluser);
         Model.UserInfo modelinfo = new Model.UserInfo();
         modelinfo.cardID     = card.Value;
         modelinfo.userID     = hiduid.Value;
         modelinfo.sex        = Convert.ToBoolean(Convert.ToInt32(Sex.Value));
         modelinfo.cardTypeID = Convert.ToInt32(CardType.SelectedValue);
         modelinfo.cardValue  = CardNo.Value;
         modelinfo.typeid     = Convert.ToInt32(CategoryId.SelectedValue);
         modelinfo.phone      = Phone.Value;
         modelinfo.bairthday  = Convert.ToDateTime(BirthDay.Value);
         modelinfo.xihao      = Love.Value;
         modelinfo.address    = Address.Value;
         modelinfo.meark      = Remark.Value;
         modelinfo.manageID   = Convert.ToInt32(UserNow.UserID);
         if (bllui.Update(modelinfo))
         {
             ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('更新成功');parent.Window_Close();</script>");
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 执行策略
        /// </summary>
        public override void DoWork <T>(T context)
        {
            var userInfoContext = context as XCLCMS.Data.BLL.Strategy.UserInfo.UserInfoContext;

            if (null == userInfoContext.UserInfo)
            {
                return;
            }

            bool flag = false;

            XCLCMS.Data.BLL.UserInfo bll = new BLL.UserInfo();

            try
            {
                switch (userInfoContext.HandleType)
                {
                case StrategyLib.HandleType.ADD:
                    userInfoContext.UserInfo.CreaterID   = userInfoContext.ContextInfo.UserInfoID;
                    userInfoContext.UserInfo.CreaterName = userInfoContext.ContextInfo.UserName;
                    userInfoContext.UserInfo.CreateTime  = DateTime.Now;
                    userInfoContext.UserInfo.UpdaterID   = userInfoContext.UserInfo.CreaterID;
                    userInfoContext.UserInfo.UpdaterName = userInfoContext.UserInfo.CreaterName;
                    userInfoContext.UserInfo.UpdateTime  = userInfoContext.UserInfo.CreateTime;
                    flag = bll.Add(userInfoContext.UserInfo);
                    break;

                case StrategyLib.HandleType.UPDATE:
                    userInfoContext.UserInfo.UpdaterID   = userInfoContext.ContextInfo.UserInfoID;
                    userInfoContext.UserInfo.UpdaterName = userInfoContext.ContextInfo.UserName;
                    userInfoContext.UserInfo.UpdateTime  = DateTime.Now;
                    flag = bll.Update(userInfoContext.UserInfo);
                    break;
                }
            }
            catch (Exception ex)
            {
                flag = false;
                this.ResultMessage += string.Format("异常信息:{0}", ex.Message);
            }

            if (flag)
            {
                this.Result = StrategyLib.ResultEnum.SUCCESS;
            }
            else
            {
                this.Result        = StrategyLib.ResultEnum.FAIL;
                this.ResultMessage = string.Format("保存用户基础信息失败!{0}", this.ResultMessage);
            }
        }
Exemplo n.º 4
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            if (txtUserName.Text == "" || txtUserPassword.Text == "" || cboUserType.Text == "")
            {
                MessageBox.Show("请将信息添加完整!");
                return;
            }
            Model.UserInfo model = new Model.UserInfo();//实例化model层
            model.UserName     = txtUserName.Text.Trim();
            model.UserPassword = txtUserPassword.Text.Trim();
            model.UserType     = cboUserType.Text.Trim();
            BLL.UserInfo bll = new BLL.UserInfo();//实例化BLL层
            model = bll.ToMD5(model);
            switch (flag)
            {
            case 0:
            {
            } break;

            case 1:
            {
                if (bll.Add(model))    //将员工信息添加到数据库中,根据返回值判断是否添加成功
                {
                    DataBind();        //窗体登录时绑定数据到DataGridView
                    ControlStatus();
                }
            } break;

            case 2:
            {
                if (bll.Update(model)) //根据返回布尔值判断是否修改数据成功
                {
                    DataBind();        //窗体登录时绑定数据到DataGridView
                    txtUserName.ReadOnly = false;
                    ControlStatus();
                }
            } break;

            case 3:
            {
                if (bll.Delete(model)) //根据返回布尔值判断是否删除数据成功
                {
                    DataBind();        //窗体登录时绑定数据到DataGridView
                    ControlStatus();
                }
            } break;
            }
        }