Пример #1
0
    protected void BtnModify_Click(object sender, EventArgs e)
    {
        int id = (int)ViewState["id"];

        if (this.txtDept.Text.Trim() == "")
        {
            ScriptHelper.SetAlert(this.Page, GetTran("001043", "请填写部门名称"));
        }
        else if (this.txtDept.Text.Trim().Length < 3)
        {
            ScriptHelper.SetAlert((Control)sender, GetTran("001034", "部门名称必须3个字符以上!"));
        }
        else
        {
            if (CompanyDeptBLL.CheckName(this.txtDept.Text.Trim(), id)) //是否重名,重名不能添加
            {
                ScriptHelper.SetAlert(this.Page, GetTran("001036", "部门名称存在!"));
            }
            else
            {
                CompanyDeptModel comDept = new CompanyDeptModel(id);
                comDept.Dept = this.txtDept.Text.Trim();
                BLL.CommonClass.ChangeLogs cl = new BLL.CommonClass.ChangeLogs("companyDept", "id");
                cl.AddRecord(id);
                if (CompanyDeptBLL.UptCompanyDept(comDept))
                {
                    cl.ModifiedIntoLogs(BLL.CommonClass.ChangeCategory.company24, GetTran("001047", "部门:") + id, BLL.CommonClass.ENUM_USERTYPE.objecttype7);
                    ScriptHelper.SetAlert(this.Page, GetTran("001050", "修改部门成功"), "CompanyDeptManage.aspx");
                }
                else
                {
                    ScriptHelper.SetAlert(this.Page, GetTran("001052", "修改部门失败!"), "CompanyDeptManage.aspx");
                }
            }
        }
    }