示例#1
0
 private RoleModel Getmm(DataRow dr, bool bj_child, bool bj_father, DB_OPT dbo)
 {
     RoleModel model = new RoleDal();
     if (bj_father)
     {
         model.RolePK = dr["FatherPK"].ToString();
         model.FatherInfo = model.GetModel(false, false, dbo);
     }
     model.RolePK = dr["RolePK"].ToString().Trim();
     model.BH = dr["BH"].ToString();
     model.Name = dr["Name"].ToString();
     model.Power = dr["Power"].ToString();
     model.DataPower = dr["DataPower"].ToString();
     model.RowPower = dr["RowPower"].ToString();
     model.ServicesPower = dr["ServicesPower"].ToString();
     model.CompanyPower = dr["CompanyPower"].ToString();
     model.Discription = dr["Discription"].ToString();
     model.IsUserPower = dr["IsUserPower"].ToString();
     model.FatherPK = dr["FatherPK"].ToString().Trim();
     model.IsHasBaby = dr["IsHasBaby"].ToString();
     if (dr["Grade"].ToString() != "")
     {
         model.Grade = int.Parse(dr["Grade"].ToString());
     }
     model.PKPath = dr["PKPath"].ToString();
     model.BranchPK = dr["BranchPK"].ToString();
     model.Branch = new BranchDal { BranchPK = dr["BranchPK"].ToString() }.GetModel(false, false, false, false, dbo);
     model.pk_corp = dr["pk_corp"].ToString();
     model.Company = new CompanyDal { pk_corp = dr["pk_corp"].ToString() }.GetModel(dbo);
     if ((dr["IsHasBaby"].ToString() == "1") && bj_child)
     {
         model.Childs = this.GetChilds(model.RolePK, dbo);
     }
     return model;
 }
示例#2
0
 private void AddUser()
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         if (((this.txtUserName.Text.Trim() == "") || (this.txtssbmpk.Value.Trim() == "")) || ((this.txtssgspk.Value.Trim() == "") || (this.txtssjspk.Value.Trim() == "")))
         {
             Const.ShowMessage("带*的数据必须填写!", this.Page);
         }
         else
         {
             UserModel model = new UserDal
             {
                 UserName = this.txtUserName.Text.Trim(),
                 TrueName = this.txtTrueName.Text.Trim()
             };
             if (model.ExistsByUserName(this.dbo) > 0)
             {
                 Const.ShowMessage("用户名已经存在!", this.Page);
             }
             else
             {
                 RoleModel model2 = new RoleDal
                 {
                     RolePK = this.txtssjspk.Value.Trim()
                 };
                 model2 = model2.GetModel(false, false, this.dbo);
                 BranchModel model3 = new BranchDal
                 {
                     BranchPK = this.txtssbmpk.Value.Trim()
                 };
                 model3 = model3.GetModel(false, false, false, false, this.dbo);
                 string str = PowerClass.SubTwoPower(this.PowerMenu1.GetPower(), model2.Power, "|");
                 model.Power = str;
                 string str2 = PowerClass.SubTwoPower(this.PowerCompany1.GetPower(), model3.CompanyPower, "|");
                 model.CompanyPower = str2;
                 model.BranchPK = this.txtssbmpk.Value.Trim();
                 model.RolePK = this.txtssjspk.Value.Trim();
                 if (this.txtPwd.Text.Trim() == "")
                 {
                     model.Password = QxRoom.QxConst.QxConst.Encrypt("123456", "powerich").Trim();
                 }
                 else
                 {
                     model.Password = QxRoom.QxConst.QxConst.Encrypt(this.txtPwd.Text.Trim(), "powerich").Trim();
                 }
                 model.pk_corp = this.txtssgspk.Value.Trim();
                 int count = 0;
                 count = model.Add(this.dbo);
                 if (base.Request["reload"] != null)
                 {
                     Const.AddSuccess(count, base.Request["reload"].ToString(), this.Page);
                 }
                 else
                 {
                     Const.AddSuccess(count, "", this.Page);
                 }
                 OperationLogBll.insertOp("新增", "用户列表", "在 " + this.txtssgs.Text.Trim() + " 单位 " + this.txtssbm.Text.Trim() + " 部门下新增用户名为:" + this.txtUserName.Text.Trim() + " 真实姓名为:" + this.txtTrueName.Text.Trim() + " 角色为:" + this.txtssjs.Text.Trim() + " 的用户,菜单权限为:" + this.PowerMenu1.GetPowerText() + " 管理范围为:" + this.PowerCompany1.GetPowerText(), "Y", this.Page);
             }
         }
     }
     catch (Exception exception)
     {
         this.el = new ExceptionLog.ExceptionLog();
         this.el.ErrClassName = base.GetType().ToString();
         this.el.ErrMessage = exception.Message.ToString();
         this.el.ErrMethod = "AddUser()";
         this.el.WriteExceptionLog(true);
         Const.OpenErrorPage("操作失败,请联系管理员!", this.Page);
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
 }
 private void UpdateRole()
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         if (((this.txtssgspk.Value.Trim() == "") || (this.txtName.Text.Trim() == "")) || (this.txtjsbh.Text.Trim() == ""))
         {
             Const.ShowMessage("带*的数据必须填写!", this.Page);
         }
         else
         {
             string strEditMess = "";
             string powerText = this.PowerMenu1.GetPowerText();
             string cz = this.PowerServices1.GetPowerText();
             string str4 = this.PowerRow1.GetPowerText();
             if ((!PageDo.IsChanged(ref strEditMess, true, this.Page) && (this.txtmenubak.Value == powerText)) && ((this.txtserbak.Value == cz) && (this.txtrowbak.Value == str4)))
             {
                 Const.ShowMessage("没有修改任何信息,请修改信息后再保存!", this.Page);
             }
             else
             {
                 if (this.txtmenubak.Value != powerText)
                 {
                     string str5 = Public.DelRelTxt(this.txtmenubak.Value, powerText, '|');
                     string str6 = Public.DelRelTxt(powerText, this.txtmenubak.Value, '|');
                     string str7 = strEditMess;
                     strEditMess = str7 + "菜单权限去掉了 " + str5 + " 增加了 " + str6;
                 }
                 if (this.txtserbak.Value != cz)
                 {
                     string str8 = Public.DelRelTxt(this.txtserbak.Value, cz, '|');
                     string str9 = Public.DelRelTxt(cz, this.txtserbak.Value, '|');
                     string str10 = strEditMess;
                     strEditMess = str10 + "业务权限去掉了 " + str8 + " 增加了 " + str9;
                 }
                 if (this.txtrowbak.Value != str4)
                 {
                     string str11 = Public.DelRelTxt(this.txtrowbak.Value, str4, '|');
                     string str12 = Public.DelRelTxt(str4, this.txtrowbak.Value, '|');
                     string str13 = strEditMess;
                     strEditMess = str13 + "数据行权限去掉了 " + str11 + " 增加了 " + str12;
                 }
                 RoleModel model = new RoleDal
                 {
                     RolePK = base.Request.QueryString["PK"].ToString().Trim()
                 };
                 string power = "";
                 power = this.PowerMenu1.GetPower();
                 model.Power = power;
                 power = "";
                 power = this.PowerServices1.GetPower();
                 model.ServicesPower = power;
                 power = "";
                 power = this.PowerRow1.GetPower();
                 model.DataPower = power;
                 model.Name = this.txtName.Text.Trim();
                 model.BH = this.txtjsbh.Text.Trim();
                 model.IsUserPower = this.ddlsfqyqx.SelectedValue.Trim();
                 model.BranchPK = this.txtssbmpk.Value.Trim();
                 model.pk_corp = this.txtssgspk.Value.Trim();
                 Const.UpdateSuccess(model.Update(this.dbo), this.Page);
                 strEditMess = "编号为:" + this.txtjsbh.Text.Trim() + " 名称为:" + this.txtName.Text.Trim() + " 的角色修改信息:" + strEditMess;
                 OperationLogBll.insertOp("修改", "角色列表", strEditMess, "Y", this.Page);
             }
         }
     }
     catch (Exception exception)
     {
         this.el = new ExceptionLog.ExceptionLog();
         this.el.ErrClassName = base.GetType().ToString();
         this.el.ErrMessage = exception.Message.ToString();
         this.el.ErrMethod = "UpdateRole()";
         this.el.WriteExceptionLog(true);
         Const.OpenErrorPage(" 操作失败,请联系管理员!", this.Page);
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
 }
 private void BingData(string rolepk, DB_OPT dbo)
 {
     RoleModel model = new RoleDal
     {
         RolePK = rolepk
     };
     model = model.GetModel(false, false, dbo);
     this.txtjsbh.Text = model.BH;
     this.txtjsbh_bak.Text = model.BH;
     this.txtName.Text = model.Name;
     this.txtName_bak.Text = model.Name;
     this.ddlsfqyqx.SelectedValue = model.IsUserPower;
     this.txtssbmpk.Value = model.BranchPK;
     this.txtssbmpk_bk.Value = model.BranchPK;
     if (model.Branch != null)
     {
         this.txtBranch.Text = model.Branch.Name;
         this.txtBranch_bak.Text = model.Branch.Name;
     }
     this.txtssgspk.Value = model.pk_corp;
     this.txtssgspk_bak.Value = model.pk_corp;
     if (model.Company != null)
     {
         this.txtCompany.Text = model.Company.Name;
         this.txtCompany_bak.Text = model.Company.Name;
     }
     this.PowerMenu1.SetChecked(model.Power);
     this.PowerServices1.SetChecked(model.ServicesPower);
     this.PowerRow1.SetChecked(model.DataPower);
     this.txtmenubak.Value = this.PowerMenu1.GetPowerText();
     this.txtserbak.Value = this.PowerServices1.GetPowerText();
     this.txtrowbak.Value = this.PowerRow1.GetPowerText();
 }
示例#5
0
 private void AddRole()
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         if (((this.txtssgspk.Value.Trim() == "") || (this.txtName.Text.Trim() == "")) || (this.txtjsbh.Text.Trim() == ""))
         {
             Const.ShowMessage("带*的数据必须填写!", this.Page);
         }
         else
         {
             RoleModel model = new RoleDal();
             if (model.Exists(this.txtjsbh.Text.Trim(), this.dbo) > 0)
             {
                 Const.ShowMessage("角色编号已经存在!", this.Page);
             }
             else
             {
                 string power = "";
                 power = this.PowerMenu1.GetPower();
                 model.Power = power;
                 power = "";
                 power = this.PowerServices1.GetPower();
                 model.ServicesPower = power;
                 power = "";
                 power = this.PowerRow1.GetPower();
                 model.DataPower = power;
                 model.BH = this.txtjsbh.Text.Trim();
                 model.Name = this.txtName.Text.Trim();
                 model.IsUserPower = this.ddlsfqyqx.SelectedValue.Trim();
                 model.BranchPK = this.txtssbmpk.Value.Trim();
                 model.pk_corp = this.txtssgspk.Value.Trim();
                 int count = 0;
                 count = model.Add(this.dbo);
                 if (base.Request["reload"] != null)
                 {
                     Const.AddSuccess(count, base.Request["reload"].ToString(), this.Page);
                 }
                 else
                 {
                     Const.AddSuccess(count, "", this.Page);
                 }
                 OperationLogBll.insertOp("新增", "角色列表", "在 " + this.txtCompany.Text.Trim() + " 单位 " + this.txtBranch.Text.Trim() + " 部门下新增编号为:" + this.txtjsbh.Text.Trim() + " 名称为:" + this.txtName.Text.Trim() + " 的角色,菜单权限为:" + this.PowerMenu1.GetPowerText() + " 服务权限为:" + this.PowerServices1.GetPowerText(), "Y", this.Page);
             }
         }
     }
     catch (Exception exception)
     {
         this.el = new ExceptionLog.ExceptionLog();
         this.el.ErrClassName = base.GetType().ToString();
         this.el.ErrMessage = exception.Message.ToString();
         this.el.ErrMethod = "AddRole()";
         this.el.WriteExceptionLog(true);
         Const.OpenErrorPage(" 操作失败,请联系管理员!", this.Page);
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
 }
示例#6
0
 private EmployeeModel Getem(DataRow dr, bool bj_child, bool bj_father, bool bj_company, bool bj_branch, bool bj_role, DB_OPT dbo)
 {
     EmployeeModel model = new EmployeeModel();
     if (bj_father)
     {
         model.BranchPK = dr["FatherPK"].ToString();
         model.FatherInfo = model.GetModel(false, false, false, false, true, dbo);
     }
     model.BranchPK = dr["BranchPK"].ToString().Trim();
     if (bj_branch)
     {
         BranchModel model2 = new BranchDal
         {
             BranchPK = dr["BranchPK"].ToString()
         };
         model2 = model2.GetModel(false, false, false, false, dbo);
         model.Branch = model2;
     }
     model.RolePK = dr["RolePK"].ToString().Trim();
     if (bj_role)
     {
         RoleModel model3 = new RoleDal
         {
             RolePK = dr["RolePK"].ToString()
         };
         model3 = model3.GetModel(false, false, dbo);
         model.Role = model3;
     }
     model.BH = dr["BH"].ToString();
     model.Name = dr["Name"].ToString();
     model.CardNum = dr["CardNum"].ToString();
     model.Sex = dr["Sex"].ToString();
     if (dr["Age"].ToString() != "")
     {
         model.Age = int.Parse(dr["Age"].ToString());
     }
     if (dr["WorkAge"].ToString() != "")
     {
         model.WorkAge = int.Parse(dr["WorkAge"].ToString());
     }
     if (dr["BirthDay"].ToString() != "")
     {
         model.BirthDay = DateTime.Parse(dr["BirthDay"].ToString());
     }
     model.MZ = dr["MZ"].ToString();
     model.Nationals = dr["Nationals"].ToString();
     model.Province = dr["Province"].ToString();
     model.Area = dr["Area"].ToString();
     model.City = dr["City"].ToString();
     model.Address = dr["Address"].ToString();
     model.PostalCode = dr["PostalCode"].ToString();
     model.OfficePhone = dr["OfficePhone"].ToString();
     model.Phone = dr["Phone"].ToString();
     model.Mobile1 = dr["Mobile1"].ToString();
     model.Mobile2 = dr["Mobile2"].ToString();
     model.Mobile3 = dr["Mobile3"].ToString();
     model.QQNum = dr["QQNum"].ToString();
     model.ICQNum = dr["ICQNum"].ToString();
     model.MSNNum = dr["MSNNum"].ToString();
     model.Email = dr["Email"].ToString();
     model.OtherLink = dr["OtherLink"].ToString();
     model.pk_corp = dr["pk_corp"].ToString();
     if (bj_company)
     {
         CompanyModel model4 = new CompanyDal
         {
             pk_corp = dr["pk_corp"].ToString()
         };
         model4 = model4.GetModel(false, false, false, dbo);
         model.Company = model4;
     }
     model.FatherPK = dr["FatherPK"].ToString().Trim();
     model.IsHasBaby = dr["IsHasBaby"].ToString();
     if (dr["Grade"].ToString() != "")
     {
         model.Grade = int.Parse(dr["Grade"].ToString());
     }
     model.PKPath = dr["PKPath"].ToString();
     if ((dr["IsHasBaby"].ToString() == "1") && bj_child)
     {
         this.GetChilds(model.EmployeePK, false, false, false, dbo);
     }
     return model;
 }