Beispiel #1
0
    protected void btUp_Click1(object sender, EventArgs e)
    {
        if (this.Session["ManageLand"].ToString() == this.TextBox1.Text)
        {
            if (this.upDepartment.SelectedIndex != 0 && this.upPower.SelectedIndex != 0)
            {
                ManagerBll     managerBll    = new ManagerBll();
                ManagerEnitity managerEntity = new ManagerEnitity();
                managerEntity.ManagerID    = this.btUp.CommandArgument.Trim();
                managerEntity.ManagerName  = base.Server.HtmlEncode(this.upName.Text.Trim());
                managerEntity.ManagerDes   = base.Server.HtmlEncode(this.upDes.Text.Trim());
                managerEntity.DepartmentID = Convert.ToInt32(this.upDepartment.SelectedValue);
                managerEntity.PowerID      = Convert.ToInt32(this.upPower.SelectedValue);

                if (managerBll.Update(managerEntity))
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('修改管理员成功');</script>");
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('修改管理员失败');</script>");
                }
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('请先选择角色和项目组');</script>");
            }
            this.upName.Text = "";

            this.upDes.Text = "";
            this.LoadPage();
            this.add.Visible       = true;
            this.edit.Visible      = false;
            this.ChangePwd.Visible = false;

            return;
        }
        this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('验证码错误')</script>");
    }
Beispiel #2
0
    protected void btOK_Click1(object sender, EventArgs e)
    {
        string         managerID     = this.Session["ManagerID"].ToString().Trim();
        ManagerBll     managerBll    = new ManagerBll();
        ManagerEnitity managerEntity = new ManagerEnitity();

        managerEntity.ManagerID    = managerID;
        managerEntity.ManagerName  = base.Server.HtmlEncode(this.txtName.Text.Trim());
        managerEntity.ManagerDes   = base.Server.HtmlEncode(this.txtDes.Text.Trim());
        managerEntity.DepartmentID = Convert.ToInt32(this.lbDepartmentID.Text.Trim());
        managerEntity.PowerID      = Convert.ToInt32(this.lbPowerID.Text.Trim());
        string fileName = this.upFileUpLoad.FileName;

        if (fileName == "")
        {
            managerEntity.ManagerImage = this.lbImage.Text.Trim();
        }
        else
        {
            if (this.lbImage.Text.Trim() != "")
            {
                File.Delete(base.Server.MapPath("~/" + this.lbImage.Text.Trim()));
            }
            string str = DateTime.Now.ToString("yyyyMMddHHmmssms") + Path.GetExtension(fileName);
            this.upFileUpLoad.SaveAs(base.Server.MapPath("~/ManagerImage/" + str));
            managerEntity.ManagerImage = "ManagerImage/" + str;
        }
        if (managerBll.Update(managerEntity))
        {
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('成功');</script>");
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('失败');</script>");
        }
        this.LoadData();
        this.RegularExpressionValidator1.Visible = false;
        this.upFileUpLoad.Visible = false;
    }