private void LoadUserRoles() { try { var roleList = new RoleDAL().LoadRoles(); comboBoxUserLevel.DataSource = roleList; comboBoxUserLevel.DisplayMember = "RoleName"; comboBoxUserLevel.ValueMember = "RoleId"; } catch { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true); } }
private void buttonSave_Click(object sender, EventArgs e) { try { bool isAdd = false; if (treeViewScreens.Nodes.Count > 0) { RoleBO roleBO = new RoleBO(); roleBO.RoleId = RoleID; roleBO.User = new UserBO(); roleBO.User.UserName = Common.User.UserName; TraverseTreeView(treeViewScreens); roleBO.ScreenList = screenList; isAdd = new RoleDAL().AssignScreenToRole(roleBO); if (isAdd) { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_009"), false); } else { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_008"), false); } } } catch { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_008"), true); } }
private void buttonSave_Click(object sender, EventArgs e) { try { bool isAdd = false; var roleBo = new RoleBO(); roleBo.RoleName = textBoxRoleName.Text.ToString(); if (checkBoxActive.Checked) { roleBo.IsActive = true; } else { roleBo.IsActive = false; } roleBo.User = new UserBO(); roleBo.User.UserName = Common.User.UserName; if (RoleID == -1) { isAdd = new RoleDAL().SaveRole(roleBo); if (isAdd) { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_009"), false); Clear(); } else { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_008"), false); } } else { roleBo.RoleId = RoleID; roleBo.IsActive = checkBoxActive.Checked; isAdd = new RoleDAL().UpdateRole(roleBo); if (isAdd) { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_010"), false); Clear(); } else { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_011"), false); } } } catch { MessageBoxClass.ShowMessage(CommonMethods.GetError("U_008"), true); } }
private void SetLookUp(string lookupName) { try { Name = lookupName.Trim(); if (LookUpType.Equals(CommonEnums.LookUps.Item)) { ItemList = new ItemDAL().GetAllItemsForLookUp(); dataGridViewLookUpData.DataSource = ItemList; } else if (LookUpType.Equals(CommonEnums.LookUps.MeasuringUnit)) { measuringUnitList = new MeasuringUnitDAL().GetAllMeasuringUnitsForLookUp(); dataGridViewLookUpData.DataSource = measuringUnitList; } else if (LookUpType.Equals(CommonEnums.LookUps.user)) { userList = new UserDAL().GetAllUsersForLookUp(); dataGridViewLookUpData.DataSource = userList; } else if (LookUpType.Equals(CommonEnums.LookUps.subItem)) { subItemList = new SubItemDAL().GetAllSubItemsForLookUp(); dataGridViewLookUpData.DataSource = subItemList; } else if (LookUpType.Equals(CommonEnums.LookUps.role)) { roleList = new RoleDAL().GetRolesLookUp(); dataGridViewLookUpData.DataSource = roleList; } else if (LookUpType.Equals(CommonEnums.LookUps.screen)) { screenList = new ScreenDAL().LoadScreensForLookUp(); dataGridViewLookUpData.DataSource = screenList; } else if (LookUpType.Equals(CommonEnums.LookUps.invoice)) { invoiceList = new InvoiceDAL().LoadAllInvoicesForLookUp(); dataGridViewLookUpData.DataSource = invoiceList; } CellResize(); PopulateCombo(); if (!string.IsNullOrEmpty(InitialValue)) { textBoxValue.Text = InitialValue; buttonFind_Click(null, null); } } catch (Exception ex) { throw ex; } }