private void DeleteUserInfo(HttpContext context)
        {
            BLL.UserInfo bll  = new BLL.UserInfo();
            int          U_ID = Convert.ToInt32(context.Request["U_ID"]);

            if (bll.Delete(U_ID))
            {
                context.Response.Write("success");
            }
            else
            {
                context.Response.Write("fail");
            }
        }
Пример #2
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;
            }
        }
Пример #3
0
        public void ProcessRequest(HttpContext context)
        {
            BLL.UserInfo UserInfoService = new BLL.UserInfo();

            context.Response.ContentType = "text/plain";
            string userName   = context.Request["userName"];
            string pwd        = context.Request["password"];
            string confirmPwd = context.Request["password_confirmation"];
            string Guid_Code  = context.Request["Guid_Code"];

            if (UserInfoService.Exists(Guid_Code) == false)
            {
                context.Response.Write("邀请码不正确,请QQ联系 1443742816 , 2101300125 获取邀请码!");
                context.Response.End();
            }
            else if (pwd != confirmPwd)
            {
                context.Response.Write("输入的两次密码不一致!");
                context.Response.End();
            }
            else if (pwd == "" || userName == "")
            {
                context.Response.Write("账号或密码不能为空!");
                context.Response.End();
            }
            else
            {
                Model.UserInfo UserinfoModal = new Model.UserInfo();
                UserinfoModal.UserId       = userName;
                UserinfoModal.UserPassword = pwd;
                if (UserInfoService.Add(UserinfoModal) == 0 || UserInfoService.Delete(Guid_Code))
                {
                    context.Response.Write("ok");
                }

                else
                {
                    context.Response.Write("注册失败!");
                }
                context.Response.End();
            }
        }