コード例 #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string txtName = context.Request.Form["txtName"];
            int    txtType = Convert.ToInt32(context.Request.Form["txtType"]);
            string txtPwd  = context.Request.Form["txtPwd"];

            ManagerInfo managerInfo = new ManagerInfo()
            {
                MName = txtName,
                MType = txtType,
                MPwd  = txtPwd
            };

            ManagerInfoBLL miBLl = new ManagerInfoBLL();

            if (miBLl.AddManagerInfo(managerInfo))
            {
                //如果添加成功就返回到列表显示页面,显示一下新插入的数据
                context.Response.Redirect("ManagerInfoList.ashx");
            }
            else
            {
                context.Response.Write("Error.html");
            }
        }
コード例 #2
0
        private void InsertManagerInfo()
        {
            ManagerInfo managerInfo = new ManagerInfo()
            {
                MName = Request.Form["txtName"],
                MPwd  = Request.Form["txtPwd"],
                MType = Convert.ToInt32(Request.Form["txtType"])
            };
            ManagerInfoBLL miBLL = new ManagerInfoBLL();

            if (miBLL.AddManagerInfo(managerInfo))
            {
                Response.Redirect("ManagerInfoList3.aspx");
            }
            else
            {
                Response.Redirect("../CRUD/Error.html");
            }
        }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ManagerInfo managerInfo = new ManagerInfo()
            {
                ManagerName     = txtName.Text,
                ManagerPassword = txtPwd.Text,
            };

            if (managerInfoBLL.AddManagerInfo(managerInfo))
            {
                LoadList();
                CleanText();
            }
            else
            {
                MessageBox.Show("添加失败,请重新输入!");
                CleanText();
            }
        }