public int DeleteRole(int userLevel) { int i = 0; using (SqlCommand command = new SqlCommand()) { i = ExecuteNonQuery(RoleStringsSql.DeleteRoleByLevel(userLevel)); } return(i); }
public int DeleteRole(string userRole) { int i = 0; using (SqlCommand command = new SqlCommand()) { i = ExecuteNonQuery(RoleStringsSql.DeleteRoleByRole(userRole)); } return(i); }
public List <RoleModel> GetAllRoles() { DataTable dt = new DataTable(); List <RoleModel> arrRoles = new List <RoleModel>(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(RoleStringsSql.GetAllRoles()); } foreach (DataRow ms in dt.Rows) { arrRoles.Add(RoleModel.ToObject(ms)); } return(arrRoles); }
public RoleModel UpdateRole(RoleModel roleModel) { DataTable dt = new DataTable(); RoleModel roleModelSql = new RoleModel(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(RoleStringsSql.UpdateRole(roleModel)); } foreach (DataRow ms in dt.Rows) { roleModelSql = RoleModel.ToObject(ms); } return(roleModelSql); }
public RoleModel GetOneRole(string userRole) { if (userRole == null || userRole.Equals(String.Empty) || userRole.Equals("")) { throw new ArgumentOutOfRangeException(); } DataTable dt = new DataTable(); RoleModel roleModelSql = new RoleModel(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(RoleStringsSql.GetOneRoleByRole(userRole)); } foreach (DataRow ms in dt.Rows) { roleModelSql = RoleModel.ToObject(ms); } return(roleModelSql); }
public RoleModel GetOneRole(int userLevel) { if (userLevel < 0) { throw new ArgumentOutOfRangeException(); } DataTable dt = new DataTable(); RoleModel roleModelSql = new RoleModel(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(RoleStringsSql.GetOneRoleByLevel(userLevel)); } foreach (DataRow ms in dt.Rows) { roleModelSql = RoleModel.ToObject(ms); } return(roleModelSql); }