/// <summary> /// 添加第三方物流信息 /// </summary> /// <param name="logisticsModel">第三方物流基本信息</param> /// <param name="pass">第三方物流对应管理密码</param> /// <param name="warehouse">第三方物流权限仓库编号字符</param> /// <returns></returns> public int AddLogistics(LogisticsModel logisticsModel, string pass, string warehouse) { if (!ManagerBLL.CheckNumber(logisticsModel.Number)) { //标识已存在相同编号的管理员不可修改 return(-2); } return(0);//ThirdLogisticsDAL.AddLogistics(logisticsModel, pass, warehouse); }
/// <summary> /// 修改第三方物流信息 /// </summary> /// <param name="logisticsModel">第三方物流基本信息</param> /// <param name="id">第三方物流编号</param> /// <param name="pass">第三方物流对应管理密码</param> /// <param name="warehouse">第三方物流权限仓库编号字符</param> /// <returns></returns> public int UpdateThirdLogistics(LogisticsModel logisticsModel, int id, string pass, string warehouse) { LogisticsModel model = thirdLogisticsDAL.GetThirdLogisticsInit(id); if (model.Number != logisticsModel.Number) { if (!ManagerBLL.CheckNumber(logisticsModel.Number)) { //标识已存在相同编号的管理员不可修改 return(-2); } } return(ThirdLogisticsDAL.UptLogistics(logisticsModel, pass, warehouse, id)); }
/// <summary> /// 执行修改方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnUpt_Click(object sender, EventArgs e) { int id = (int)(ViewState["id"] != null ? ViewState["id"] : 0); if (id <= 0) { ScriptHelper.SetAlert((Control)sender, GetTran("001102", "异常访问!"), "ManagerManage.aspx"); return; } ManageModel manager = null; manager = ManagerBLL.GetManage(id); if (manager == null) { ScriptHelper.SetAlert((Control)sender, GetTran("001102", "异常访问!"), "ManagerManage.aspx"); return; } //取出当前登录管理员的编号 string manageId = BLL.CommonClass.CommonDataBLL.getManageID(1); if (manager.Number.ToString().Trim() == manageId) { ScriptHelper.SetAlert(Page, GetTran("001106", "不允许修改该管理员!"), "ManagerManage.aspx"); return; } //验证必填信息 if (this.ddlRoles.Text.Trim() == "") { ScriptHelper.SetAlert((Control)sender, GetTran("001113", "角色信息不能为空")); return; } if (this.ddlDepts.Text.Trim() == "") { ScriptHelper.SetAlert((Control)sender, GetTran("001114", "部门信息不能为空")); return; } if (this.txtName.Text.Trim() == "") { ScriptHelper.SetAlert((Control)sender, GetTran("001116", "管理员姓名不能为空")); return; } if (this.txtNumber.Text.Trim() == "") { ScriptHelper.SetAlert((Control)sender, GetTran("001117", "管理员编号不能为空")); return; } string number = Session["Company"].ToString(); if (number != manageId) { if (!DeptRoleBLL.CheckAllot(number, int.Parse(this.ddlRoles.SelectedValue))) { ScriptHelper.SetAlert((Control)sender, GetTran("000975", "不能对该角色进行操作,没有权限!")); return; } } //验证角色信息 CheckDeptRole(); //验证部门信息 CheckCompanyDept(); //需要验证角色名是否重复 if (manager.Number.Trim() != txtNumber.Text.Trim()) { if (!ManagerBLL.CheckNumber(txtNumber.Text.Trim())) { ScriptHelper.SetAlert((Control)sender, GetTran("001118", "当前管理员编号已经存在!")); return; } } //根据输入信息构建管理员 manager.Number = this.txtNumber.Text.Trim(); manager.Name = txtName.Text.Trim(); manager.Post = this.ddlRoles.SelectedItem.Text.Trim(); manager.Branch = this.ddlDepts.SelectedItem.Text.Trim(); manager.RoleID = int.Parse(this.ddlRoles.SelectedValue); manager.Status = 1; manager.IsViewPermissions = int.Parse(this.RadioButtonList1.SelectedValue); manager.IsRecommended = int.Parse(this.RadioButtonList2.SelectedValue); //存储管理员信息到数据库 BLL.CommonClass.ChangeLogs cl = new BLL.CommonClass.ChangeLogs("manage", "id"); cl.AddRecord(id); if (ManagerBLL.UptManage(manager)) { //存储成功,给出提示ChangeCategory cl.ModifiedIntoLogs(BLL.CommonClass.ChangeCategory.company26, GetTran("001082", "管理员:") + manager.Name, BLL.CommonClass.ENUM_USERTYPE.objecttype7); ScriptHelper.SetAlert((Control)sender, GetTran("001119", "修改管理员成功!"), "ManagerManage.aspx"); } else { //存储失败,给出提示 ScriptHelper.SetAlert((Control)sender, GetTran("001121", "修改管理员失败!")); } }
protected void BtnAdd_Click(object sender, EventArgs e) { //验证必填信息 if (this.ddlRoles.Text.Trim() == "") { ScriptHelper.SetAlert((Control)sender, GetTran("001113", "角色信息不能为空")); } else { if (this.ddlDepts.Text.Trim() == "") { ScriptHelper.SetAlert((Control)sender, GetTran("001114", "部门信息不能为空")); } else { if (this.txtName.Text.Trim() == "") { ScriptHelper.SetAlert((Control)sender, GetTran("001116", "管理员姓名不能为空")); } else { if (this.txtNumber.Text.Trim() == "") { ScriptHelper.SetAlert((Control)sender, GetTran("001117", "管理员编号不能为空")); } else if (this.txtNumber.Text.Trim().Length < 6) { ScriptHelper.SetAlert((Control)sender, GetTran("001163", "管理员编号必须6个字符以上")); } else { //取出当前登录管理员的编号 string number = Session["Company"].ToString(); string manageId = BLL.CommonClass.CommonDataBLL.getManageID(1); if (number != manageId) { if (!DeptRoleBLL.CheckAllot(number, int.Parse(this.ddlRoles.SelectedValue))) { ScriptHelper.SetAlert((Control)sender, GetTran("000975", "不能对该角色进行操作,没有权限!")); return; } } //根据输入信息构建管理员 ManageModel manager = new ManageModel(); if (!ManagerBLL.CheckNumber(txtNumber.Text.Trim())) { ScriptHelper.SetAlert((Control)sender, GetTran("001166", "该编号已经存在")); } else { manager.Number = this.txtNumber.Text.Trim(); manager.Name = txtName.Text.Trim(); manager.PermissionMan = number.Trim(); manager.Post = this.ddlRoles.SelectedItem.Text.Trim(); manager.Branch = this.ddlDepts.SelectedItem.Text.Trim(); manager.RoleID = int.Parse(this.ddlRoles.SelectedValue); manager.BeginDate = DateTime.UtcNow; manager.Status = 1; manager.LastLoginDate = DateTime.UtcNow; manager.IsViewPermissions = int.Parse(this.RadioButtonList1.SelectedValue); manager.IsRecommended = int.Parse(this.RadioButtonList2.SelectedValue); //获取管理员的默认密码 string password = ManagerBLL.GetPassword(this.txtNumber.Text.Trim()); //加密存储管理员的密码 manager.LoginPass = Encryption.Encryption.GetEncryptionPwd(this.txtNumber.Text.Trim(), this.txtNumber.Text.Trim()); //存储管理员信息到数据库 if (ManagerBLL.AddManage(manager, number) > 0) { //存储成功,给出提示 ScriptHelper.SetAlert((Control)sender, GetTran("001167", "添加管理员成功!"), "ManagerManage.aspx"); } else { //存储失败,给出提示 ScriptHelper.SetAlert((Control)sender, GetTran("001169", "添加管理员失败!")); } } } } } } }