/// <summary> /// 批量设置职务的业务操作范围 /// </summary> /// <param name="positionId">职务ID</param> /// <param name="operateIds">批量业务操作ID数组</param> /// <param name="scopeOUIds">操作范围覆盖的组织机构ID数组</param> /// <param name="scopePOIds">操作范围覆盖的职务ID数组</param> public void SetOperateScope(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, int positionId, int[] operateIds, int[] scopeOUIds, int[] scopePOIds) { StringBuilder deleteContent = new StringBuilder(); StringBuilder addContent = new StringBuilder(); foreach (int operateId in operateIds) { string operateName = (string)this.BusinessOperateTA.GetBusinessOperateName(operateId); StringBuilder addStr = new StringBuilder(); StringBuilder deleteStr = new StringBuilder(); List <int> sOUIds = new List <int>(scopeOUIds); List <int> sPOIds = new List <int>(scopePOIds); BusinessObjects.AuthorizationDS.OperateScopeDataTable table = this.OperateScopeTA.GetDataByOperateAndPosition(operateId, positionId); foreach (BusinessObjects.AuthorizationDS.OperateScopeRow operateScope in table) { if (operateScope.IsScopeOrganziationUnitIdNull()) { if (sPOIds.Contains(operateScope.ScopePositionId)) { sPOIds.Remove(operateScope.ScopePositionId); } else { deleteStr.Append("职务[" + new OUTreeBLL().GetPositionById(operateScope.ScopePositionId).PositionName + "] "); operateScope.Delete(); } } else { if (sOUIds.Contains(operateScope.ScopeOrganziationUnitId)) { sOUIds.Remove(operateScope.ScopeOrganziationUnitId); } else { deleteStr.Append("机构[" + new OUTreeBLL().GetOrganizationUnitById(operateScope.ScopeOrganziationUnitId).OrganizationUnitName + "] "); operateScope.Delete(); } } } if (deleteStr.Length > 0) { deleteStr.Insert(0, "撤销业务操作[" + operateName + "]包含数据范围:"); deleteContent.Append(deleteStr.ToString()); } foreach (int ouId in sOUIds) { BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow(); newRow.PositionId = positionId; newRow.BusinessOperateId = operateId; newRow.ScopeOrganziationUnitId = ouId; table.AddOperateScopeRow(newRow); addStr.Append("机构[" + new OUTreeBLL().GetOrganizationUnitById(ouId).OrganizationUnitName + "] "); } foreach (int poId in sPOIds) { BusinessObjects.AuthorizationDS.OperateScopeRow newRow = table.NewOperateScopeRow(); newRow.PositionId = positionId; newRow.BusinessOperateId = operateId; newRow.ScopePositionId = poId; table.AddOperateScopeRow(newRow); addStr.Append("职务[" + new OUTreeBLL().GetPositionById(poId).PositionName + "] "); } if (addStr.Length > 0) { addStr.Insert(0, "新增业务操作[" + operateName + "]包含数据范围:"); addContent.Append(addStr.ToString()); } this.OperateScopeTA.Update(table); } if (deleteContent.Length > 0 || addContent.Length > 0) { AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure(); authorizationConfigure.StuffId = stuffUser.StuffId; authorizationConfigure.StuffName = stuffUser.StuffName; authorizationConfigure.ConfigureType = "更新"; authorizationConfigure.ConfigureTarget = "业务操作范围"; authorizationConfigure.ConfigureTime = DateTime.Now; string positionName = new OUTreeBLL().GetPositionById(positionId).PositionName; if (deleteContent.Length > 0) { deleteContent.Insert(0, "职务[" + positionName + "]:"); authorizationConfigure.OldContent = deleteContent.ToString(); } if (addContent.Length > 0) { addContent.Insert(0, "职务[" + positionName + "]:"); authorizationConfigure.NewContent = addContent.ToString(); } SysLog.LogAuthorizationConfigure(authorizationConfigure); } }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { PageUtility.SetContentTitle(this.Page, "方案报销"); this.Page.Title = "方案报销"; // 用户信息,职位信息 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; AuthorizationDS.PositionRow rowUserPosition = (AuthorizationDS.PositionRow)Session["Position"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; this.ViewState["PositionID"] = rowUserPosition.PositionId; this.ViewState["FlowTemplate"] = new AuthorizationBLL().GetFlowTemplate((int)SystemEnums.BusinessUseCase.FormReimburse, stuffUser.StuffUserId); this.StuffNameCtl.Text = stuffUser.StuffName; this.PositionNameCtl.Text = rowUserPosition.PositionName; this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowUserPosition.OrganizationUnitId).OrganizationUnitName; this.ViewState["DepartmentID"] = rowUserPosition.OrganizationUnitId; this.AttendDateCtl.Text = stuffUser.AttendDate.ToShortDateString(); if (this.Request["RejectObjectID"] != null) { this.ViewState["RejectedObjectID"] = int.Parse(this.Request["RejectObjectID"].ToString()); } FormReimburseDetailTableAdapter taDetail = new FormReimburseDetailTableAdapter(); //如果是草稿进行赋值 if (Request["ObjectId"] != null) { this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]); FormDS.FormReimburseRow rowFormReimbuese = this.SalesReimburseBLL.GetFormReimburseByID(int.Parse(this.ViewState["ObjectId"].ToString()))[0]; if (this.Request["RejectObjectID"] == null) { this.DeleteBtn.Visible = true; } else { this.DeleteBtn.Visible = false; } this.ViewState["PaymentTypeID"] = rowFormReimbuese.PaymentTypeID; this.ViewState["CustomerID"] = rowFormReimbuese.CustomerID; this.ViewState["FormApplyIds"] = rowFormReimbuese.FormApplyIds; this.ViewState["FormApplyNos"] = rowFormReimbuese.FormApplyNos; if (!rowFormReimbuese.IsRemarkNull()) { this.RemarkCtl.Text = rowFormReimbuese.Remark; } if (!rowFormReimbuese.IsAttachedFileNameNull()) { this.UCFileUpload.AttachmentFileName = rowFormReimbuese.AttachedFileName; } if (!rowFormReimbuese.IsRealAttachedFileNameNull()) { this.UCFileUpload.RealAttachmentFileName = rowFormReimbuese.RealAttachedFileName; } new FormReimburseInvoiceTableAdapter().FillByFormReimburseID(this.InnerDS.FormReimburseInvoice, rowFormReimbuese.FormReimburseID); // 填写明细表,如果是票扣的话那么写入方法不一样 if (int.Parse(this.ViewState["PaymentTypeID"].ToString()) == (int)SystemEnums.PaymentType.PiaoKou) { taDetail.FillFromPKRecordByApplyNos(this.InnerDS.FormReimburseDetail, this.ViewState["FormApplyNos"].ToString()); } else { taDetail.FillCurrentDataByFormReimburseID(this.InnerDS.FormReimburseDetail, rowFormReimbuese.FormReimburseID); } } else { this.DeleteBtn.Visible = false; if (Request["PaymentTypeID"] != null) { this.ViewState["PaymentTypeID"] = Request["PaymentTypeID"]; } else { this.Session["ErrorInfor"] = "未找到支付方式,请重新填写"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["CustomerID"] != null) { this.ViewState["CustomerID"] = Request["CustomerID"]; } else { this.Session["ErrorInfor"] = "未找到客户,请重新填写"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["FormApplyIds"] != null) { this.ViewState["FormApplyIds"] = Request["FormApplyIds"]; } else { this.Session["ErrorInfor"] = "没有找到申请单,请重新填写"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["FormApplyNos"] != null) { this.ViewState["FormApplyNos"] = Request["FormApplyNos"]; } else { this.Session["ErrorInfor"] = "没有找到申请单,请重新填写"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } // 填写明细表,如果是票扣的话那么写入方法不一样 if (int.Parse(this.ViewState["PaymentTypeID"].ToString()) == (int)SystemEnums.PaymentType.PiaoKou) { taDetail.FillFromPKRecordByApplyNos(this.InnerDS.FormReimburseDetail, this.ViewState["FormApplyNos"].ToString()); } else { taDetail.FillByFormApplyIds(this.InnerDS.FormReimburseDetail, this.ViewState["FormApplyIds"].ToString()); } } ERS.CustomerRow customer = new MasterDataBLL().GetCustomerById(int.Parse(this.ViewState["CustomerID"].ToString())); this.CustomerNameCtl.Text = customer.CustomerName; this.PaymentTypeDDL.SelectedValue = this.ViewState["PaymentTypeID"].ToString(); if (Session["ProxyStuffUserId"] != null) { this.SubmitBtn.Visible = false; } } }
/// <summary> /// /// </summary> /// <param name="newOperateIds"></param> /// <param name="roleId"></param> public void SetSystemRoleOperateRight(AuthorizationDS.StuffUserRow stuffUser, AuthorizationDS.PositionRow position, List <int> newOperateIds, int roleId) { List <int> deleteOperateIds = new List <int>(); SystemRoleAndBusinessOperateTableAdapter da = new SystemRoleAndBusinessOperateTableAdapter(); BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateDataTable table = da.GetDataBySystemRoleId(roleId); foreach (BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateRow row in table) { if (newOperateIds.Contains(row.BusinessOperateId)) { newOperateIds.Remove(row.BusinessOperateId); } else { deleteOperateIds.Add(row.BusinessOperateId); row.Delete(); } } AuthorizationDS.SystemRoleAndBusinessOperateDataTable newTable = new AuthorizationDS.SystemRoleAndBusinessOperateDataTable(); foreach (int newOperateId in newOperateIds) { BusinessObjects.AuthorizationDS.SystemRoleAndBusinessOperateRow newRow = newTable.NewSystemRoleAndBusinessOperateRow(); newRow.BusinessOperateId = newOperateId; newRow.SystemRoleId = roleId; newTable.AddSystemRoleAndBusinessOperateRow(newRow); } da.Update(table); da.Update(newTable); if (deleteOperateIds.Count > 0 || newOperateIds.Count > 0) { AuthorizationConfigure authorizationConfigure = new AuthorizationConfigure(); authorizationConfigure.StuffId = stuffUser.StuffId; authorizationConfigure.StuffName = stuffUser.StuffName; authorizationConfigure.ConfigureTarget = "系统角色设置"; authorizationConfigure.ConfigureTime = DateTime.Now; authorizationConfigure.ConfigureType = "更新"; if (deleteOperateIds.Count > 0) { StringBuilder oldContent = new StringBuilder(); oldContent.Append("撤销系统角色[").Append(this.SystemRoleTA.GetSystemRoleName(roleId)).Append("]授权业务操作:"); foreach (int id in deleteOperateIds) { oldContent.Append("[").Append(this.BusinessOperateTA.GetBusinessUseCaseName(id) + "-" + this.BusinessOperateTA.GetBusinessOperateName(id)).Append("] "); } authorizationConfigure.OldContent = oldContent.ToString(); } if (newOperateIds.Count > 0) { StringBuilder newContent = new StringBuilder(); newContent.Append("新增系统角色[").Append(this.SystemRoleTA.GetSystemRoleName(roleId)); newContent.Append("]授权业务操作:"); foreach (int id in newOperateIds) { newContent.Append("[").Append(this.BusinessOperateTA.GetBusinessUseCaseName(id) + "-" + this.BusinessOperateTA.GetBusinessOperateName(id)).Append("] "); } authorizationConfigure.NewContent = newContent.ToString(); } SysLog.LogAuthorizationConfigure(authorizationConfigure); } }