/// <summary> /// Update a RoleOperation. /// </summary> public void Update(Model.RoleOperation roleOperation) { // // todo: add other logic here. // accessor.Update(roleOperation); }
private void Validate(Model.RoleOperation roleOperation) { if (string.IsNullOrEmpty(roleOperation.RoleOperationId)) { throw new Helper.RequireValueException(Model.RoleOperation.PRO_RoleId); } }
/// <summary> /// Insert a RoleOperation. /// </summary> public void Insert(Model.RoleOperation roleOperation) { // // todo:add other logic here // accessor.Insert(roleOperation); }
///// <summary> ///// 根据操作员 和formname查询 权限 ///// </summary> ///// <param name="formName"></param> ///// <returns></returns> private Model.RoleOperation SelectOperatorsKeyTag(string formName) { Model.RoleOperation roleOperation = null; if (!this.DesignMode) { IList <Model.RoleOperation> roleOpList = this.RoleOperationManager.SelectbyOperatorsKeyTag(BL.V.ActiveOperator, formName); if (roleOpList == null || roleOpList.Count == 0) { return(null); } roleOperation = new Book.Model.RoleOperation(); roleOperation.PossAdd = false; roleOperation.PossAuditing = false; roleOperation.PossDelete = false; roleOperation.PossExport = false; roleOperation.PossPrint = false; roleOperation.PossReportEdit = false; roleOperation.PossSearch = false; roleOperation.PossUpdate = false; foreach (Model.RoleOperation item in roleOpList) { if (item.PossAdd.HasValue && item.PossAdd.Value) { roleOperation.PossAdd = true; } if (item.PossAuditing.HasValue && item.PossAuditing.Value) { roleOperation.PossAuditing = true; } if (item.PossDelete.HasValue && item.PossDelete.Value) { roleOperation.PossDelete = true; } if (item.PossExport.HasValue && item.PossExport.Value) { roleOperation.PossExport = true; } if (item.PossPrint.HasValue && item.PossPrint.Value) { roleOperation.PossPrint = true; } if (item.PossReportEdit.HasValue && item.PossReportEdit.Value) { roleOperation.PossReportEdit = true; } if (item.PossSearch.HasValue && item.PossSearch.Value) { roleOperation.PossSearch = true; } if (item.PossUpdate.HasValue && item.PossUpdate.Value) { roleOperation.PossUpdate = true; } } } return(roleOperation); }
public override void Refresh() { #region 页面刷新时获取所有本窗体的控件 GetAllControls(); #endregion //权限暂时注释 if (LicenseManager.UsageMode != LicenseUsageMode.Designtime) { IList <Model.Role> roleList = BL.V.RoleList; int flag = 0; foreach (Model.Role item in roleList) { if (item.Id == Settings.BasicData.Employees.EmployeeParameters.SYSTEMMANAGER) { flag = 1; break; } } if (flag == 1) { this.barButtonItemNew.Enabled = this.action == "view"; this.barButtonItemUpdate.Enabled = this.action == "view"; this.barButtonItemDelete.Enabled = this.action == "view"; this.barButtonItemPrev.Enabled = this.action == "view" && this.HasRowsPrev(); this.barButtonItemNext.Enabled = this.action == "view" && this.HasRowsNext(); this.barButtonItemPrint.Enabled = this.action == "view"; this.barButtonItemSave.Enabled = this.action != "view"; this.barButtonItemUndo.Enabled = this.action != "view" && this.HasRows(); this.barButtonItemFirst.Enabled = this.action == "view" && this.HasRowsPrev(); this.barButtonItemLast.Enabled = this.action == "view" && this.HasRowsNext(); this.barButtonItemQuery.Enabled = this.action == "view"; this.barButtonItemUndo.Enabled = this.action != "view" && this.HasRows(); this.barButtonItemAttachment.Enabled = this.action == "view"; } else { Model.RoleOperation roleOpe = this.SelectOperatorsKeyTag(this.getName()); if (roleOpe != null) { this.barButtonItemNew.Enabled = this.action == "view" && roleOpe.PossAdd == true; this.barButtonItemUpdate.Enabled = this.action == "view" && roleOpe.PossUpdate == true; this.barButtonItemDelete.Enabled = this.action == "view" && roleOpe.PossDelete == true; this.barButtonItemPrev.Enabled = this.action == "view" && this.HasRowsPrev(); this.barButtonItemNext.Enabled = this.action == "view" && this.HasRowsNext(); this.barButtonItemPrint.Enabled = this.action == "view" && roleOpe.PossPrint == true; this.barButtonItemSave.Enabled = (this.action == "insert" && roleOpe.PossAdd == true) || (this.action == "update" && roleOpe.PossUpdate == true); this.barButtonItemUndo.Enabled = this.action != "view" && this.HasRows(); this.barButtonItemFirst.Enabled = this.action == "view" && this.HasRowsPrev(); this.barButtonItemLast.Enabled = this.action == "view" && this.HasRowsNext(); this.barButtonItemQuery.Enabled = this.action == "view"; this.barButtonItemUndo.Enabled = this.action != "view" && this.HasRows(); this.barButtonItemAttachment.Enabled = this.action == "view"; } } this.barButtonItemAudit.Enabled = false; this.barButtonItemAudit.Caption = "審核"; if (this.action == "view") { string tableName = Invoice.GetType().Name; switch (Invoice.AuditState) { case 0: if (this.roleAuditingManager.IsHasAudit(BL.V.ActiveOperator, this.Invoice.InvoiceId, tableName)) { this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "審核"; } break; case 1: if (this.roleAuditingManager.IsHasAudit(BL.V.ActiveOperator, this.Invoice.InvoiceId, tableName)) { this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "審核"; } break; case 2: if (this.roleAuditingManager.IsHasGiveUpAudited(BL.V.ActiveOperator, this.Invoice.InvoiceId, tableName)) { this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "棄審"; } else if (this.roleAuditingManager.IsHasAudit(BL.V.ActiveOperator, this.Invoice.InvoiceId, tableName)) { this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "審核"; } break; case 4: //操作员是否有审核权限 if (this.roleAuditingManager.IsHasAudit(BL.V.ActiveOperator, this.Invoice.InvoiceId, tableName)) { //wfr.nowprocessid this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "複核"; } break; case 3: //操作员是否有弃审权限 if (this.roleAuditingManager.IsHasGiveUpAudited(BL.V.ActiveOperator, this.Invoice.InvoiceId, tableName)) { //wfr.nowprocessid this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "棄審"; } this.barButtonItemUpdate.Enabled = false; this.barButtonItemDelete.Enabled = false; break; } } } switch (this.action) { case "insert": SetAllControlState(false); break; case "update": SetAllControlState(false); break; case "view": SetAllControlState(true); break; default: SetAllControlState(true); break; } isDelete = this.barButtonItemDelete.Enabled; base.Refresh(); }
public void Update(Model.RoleOperation e) { this.Update <Model.RoleOperation>(e); }
public void Insert(Model.RoleOperation e) { this.Insert <Model.RoleOperation>(e); }
public override void Refresh() { #region 页面刷新时获取所有本窗体的控件 GetAllControls(); #endregion #region 权限 IList <Model.Role> roleList = BL.V.RoleList; int flag = 0; foreach (Model.Role item in roleList) { if (item.Id == Settings.BasicData.Employees.EmployeeParameters.SYSTEMMANAGER) { flag = 1; break; } } if (flag == 1) { this.barButtonItemNew.Enabled = this.action == "view"; this.barButtonItemUpdate.Enabled = this.action == "view"; this.barButtonItemFirst.Enabled = this.action == "view" && this.HasRowsPrev(); this.barButtonItemPrev.Enabled = this.action == "view" && this.HasRowsPrev(); this.barButtonItemNext.Enabled = this.action == "view" && this.HasRowsNext(); this.barButtonItemLast.Enabled = this.action == "view" && this.HasRowsNext(); this.barButtonItemPrint.Enabled = this.action == "view"; this.barButtonItemSave.Enabled = this.action != "view"; this.barButtonItemDelete.Enabled = this.action == "view"; this.barButtonItemUndo.Enabled = this.action != "view" && this.HasRows(); this.barButtonitemAllAttachment.Enabled = this.action == "view"; } else { Model.RoleOperation roleOpe = this.SelectOperatorsKeyTag(this.getName()); if (roleOpe != null) { this.barButtonItemNew.Enabled = this.action == "view" && roleOpe.PossAdd == true; this.barButtonItemUpdate.Enabled = this.action == "view" && roleOpe.PossUpdate == true; this.barButtonItemDelete.Enabled = this.action == "view" && roleOpe.PossDelete == true; this.barButtonItemPrev.Enabled = this.action == "view" && this.HasRowsPrev(); this.barButtonItemNext.Enabled = this.action == "view" && this.HasRowsNext(); this.barButtonItemPrint.Enabled = this.action == "view" && roleOpe.PossPrint == true; this.barButtonItemSave.Enabled = (this.action == "insert" && roleOpe.PossAdd == true) || (this.action == "update" && roleOpe.PossUpdate == true); this.barButtonItemUndo.Enabled = this.action != "view" && this.HasRows(); this.barButtonItemFirst.Enabled = this.action == "view" && this.HasRowsPrev(); this.barButtonItemLast.Enabled = this.action == "view" && this.HasRowsNext(); // this.barButtonItemQuery.Enabled = this.action == "view"; this.barButtonItemUndo.Enabled = this.action != "view" && this.HasRows(); this.barButtonitemAllAttachment.Enabled = this.action == "view"; } } #endregion this.barButtonItemAudit.Enabled = false; this.barButtonItemAudit.Caption = "AUDIT"; if (!string.IsNullOrEmpty(this.tableCode())) { if (this.action == "view") { string tableName = this.tableCode().Substring(0, this.tableCode().IndexOf(',')); string tableKeyId = this.tableCode().Substring(this.tableCode().IndexOf(',') + 1); switch (AuditState()) { case 0: if (this.roleAuditingManager.IsHasAudit(BL.V.ActiveOperator, tableKeyId, tableName)) { this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "AUDIT"; } break; case 1: if (this.roleAuditingManager.IsHasAudit(BL.V.ActiveOperator, tableKeyId, tableName)) { this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "AUDIT"; } break; case 2: if (this.roleAuditingManager.IsHasGiveUpAudited(BL.V.ActiveOperator, tableKeyId, tableName)) { this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "CANCEL AUDIT"; } else if (this.roleAuditingManager.IsHasAudit(BL.V.ActiveOperator, tableKeyId, tableName)) { this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "AUDIT"; } break; case 4: //操作员是否有审核权限 if (this.roleAuditingManager.IsHasAudit(BL.V.ActiveOperator, tableKeyId, tableName)) { //wfr.nowprocessid this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "REVIEW"; } break; case 3: //操作员是否有弃审权限 if (this.roleAuditingManager.IsHasGiveUpAudited(BL.V.ActiveOperator, tableKeyId, tableName)) { //wfr.nowprocessid this.barButtonItemAudit.Enabled = true; this.barButtonItemAudit.Caption = "CANCEL AUDIT"; } this.barButtonItemUpdate.Enabled = false; this.barButtonItemDelete.Enabled = false; break; } } } switch (this.action) { case "insert": SetAllControlState(false); break; case "update": SetAllControlState(false); break; case "view": SetAllControlState(true); break; default: SetAllControlState(true); break; } base.Refresh(); }