public DepartmentMembersData SelectData(string employeeId) { var data = new DepartmentMembersData(); using var dataTable = dbHelper.GetDataTable($"select * from DepartmentMembers where UserId = '{employeeId}'"); foreach (var row in dataTable.Rows.Cast <DataRow>()) { data.PrimaryId = int.Parse(row["PrimaryId"].ToString()); data.DepartmentId = row["DepartmentId"].ToString(); data.UserId = row["UserId"].ToString(); } return(data); }
private DepartmentMembersData GetDepartmentMembers() { var data = new DepartmentMembersData(); try { DepartmentMembersHelper dbHelper = new DepartmentMembersHelper(_appSettings.Secrets.DbConnectionString); data = dbHelper.SelectData(HttpContext.Session.GetString(Constants.Session.EmployeeId)); } catch (Exception ex) { _logger.LogError("Error GetDepartmentMembers: {0}", ex.Message); } return(data); }