private bool GetData(int sRoleId) { try { using (var context = new RubberSoftEntities()) { var query = context.spt_GetRoles().Where(o => o.RoleId == sRoleId).ToList(); if (query.Count > 0) { foreach (spt_GetRoles_Result dt in query) { strRoleName = dt.RoleName; TxtRoleName.Text = dt.RoleName; strRoleFullName = dt.RoleFullName; TxtRoleFullName.Text = dt.RoleFullName; } GetAuthorized(sRoleId); } else { ClearValues(); } } return(true); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); return(false); } }
private bool CheckDuplicate(int Type) { try { using (var context = new RubberSoftEntities()) { if (Type == 1) { var ckRoleName = context.spt_GetRoles().Where(o => o.RoleName == stRoleName && o.Active == 1).ToList(); if (ckRoleName.Count > 0) { return(false); } } if (Type == 2) { var ckRoleFullName = context.spt_GetRoles().Where(o => o.RoleFullName == stRoleFullName && o.Active == 1).ToList(); if (ckRoleFullName.Count > 0) { return(false); } } } return(true); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); return(false); } }
private bool GetRoles() { try { using (var context = new RubberSoftEntities()) { var query = context.spt_GetRoles().Where(o => o.Active == 1).ToList(); SLRole.Properties.DataSource = query; SLRole.Properties.DisplayMember = "RoleFullName"; SLRole.Properties.ValueMember = "RoleId"; } return(true); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); return(false); } }