public int SaveUserGroupControls(UserGroupIndex userGroupIndex, UserGroupControlDTO userGroupControlDTO, string propertyName) { int affectedRows = this.userGroupAPIRepository.SaveUserGroupControls(userGroupControlDTO.UserGroupControlID, userGroupControlDTO.AccessLevel, userGroupControlDTO.ApprovalPermitted, userGroupControlDTO.UnApprovalPermitted, userGroupControlDTO.VoidablePermitted, userGroupControlDTO.UnVoidablePermitted, userGroupControlDTO.ShowDiscount); if (propertyName == "Editable" || propertyName == "ApprovalPermitted" || propertyName == "UnApprovalPermitted" || propertyName == "VoidablePermitted" || propertyName == "UnVoidablePermitted") { string propertyValue = ""; if (propertyName == "Editable") { propertyName = "AccessLevel"; propertyValue = ((GlobalEnums.AccessLevel)userGroupControlDTO.AccessLevel).ToString(); } if (propertyName == "ApprovalPermitted") { propertyName = "Verify"; propertyValue = userGroupControlDTO.ApprovalPermitted ? "Allowed" : "Disallowed"; } if (propertyName == "UnApprovalPermitted") { propertyName = "Unverify"; propertyValue = userGroupControlDTO.UnApprovalPermitted ? "Allowed" : "Disallowed"; } if (propertyName == "VoidablePermitted") { propertyName = "Void"; propertyValue = userGroupControlDTO.VoidablePermitted ? "Allowed" : "Disallowed"; } if (propertyName == "UnVoidablePermitted") { propertyName = "Unvoid"; propertyValue = userGroupControlDTO.UnVoidablePermitted ? "Allowed" : "Disallowed"; } this.AddDataLogs("Update access control", userGroupControlDTO.UserGroupControlID, userGroupIndex.UserGroupID, userGroupIndex.Name, userGroupControlDTO.ModuleDetailID, userGroupControlDTO.ModuleDetailName, userGroupControlDTO.LocationID, userGroupControlDTO.LocationName, propertyName, propertyValue); } return(affectedRows); }
public UserGroups(UserGroupAPIs userGroupAPIs, UserGroupIndex userGroupIndex, bool removeVersusRename) { InitializeComponent(); try { this.userGroupAPIs = userGroupAPIs; this.userGroupIndex = userGroupIndex; this.removeVersusRename = removeVersusRename; this.textexCode.TextChanged += textexNewUserGroupID_TextChanged; this.textexName.TextChanged += textexNewUserGroupID_TextChanged; this.textexDescription.TextChanged += textexNewUserGroupID_TextChanged; this.textexCode.ReadOnly = this.userGroupIndex != null && this.removeVersusRename; this.textexName.ReadOnly = this.userGroupIndex != null && this.removeVersusRename; this.textexDescription.ReadOnly = this.userGroupIndex != null && this.removeVersusRename; this.Text = this.userGroupIndex != null ? (this.removeVersusRename ? "Delete group" : "Rename group") : "Add new group"; this.buttonOK.Text = this.userGroupIndex != null ? (this.removeVersusRename ? "Delete" : "Rename") : "Add"; if (this.userGroupIndex != null) { this.textexCode.Text = this.userGroupIndex.Code; this.textexName.Text = this.userGroupIndex.Name; this.textexDescription.Text = this.userGroupIndex.Description; } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private void fastUserGroups_SelectedIndexChanged(object sender, EventArgs e) { if (this.fastUserGroups.SelectedObject != null) { UserGroupIndex userGroupIndex = (UserGroupIndex)this.fastUserGroups.SelectedObject; if (userGroupIndex != null) { this.SelectedUserGroupIndex = userGroupIndex; } } else { this.GetUserGroupControls(); this.GetUserGroupReports(); this.GetUserGroupMembers(); } }