/// <summary> /// /// </summary> /// <returns></returns> public SortedList <int, IBGCAdministrator> GetAdminList() { SortedList <int, IBGCAdministrator> admins = new SortedList <int, IBGCAdministrator>(); SqlConnection connection = DBUtility.getConnection(); connection.Open(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "sp_displayAdmin"; command.Connection = connection; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { int empId = Convert.ToInt32(reader["EmployeeID"]); DateTime statusTime = Convert.ToDateTime(reader["StatusChangeTime"]); int adminID = Convert.ToInt32(reader["AdministratorID"]); int status = Convert.ToInt32(reader["AdminStatus"]); IBGCAdministrator adm = new BGCAdministratorFactory().CreateBGCAdminstrator(adminID, status, statusTime); adm.EmployeeId = empId; admins.Add(adm.AdministratorID, adm); } connection.Close(); return(admins); }
/// <summary> /// /// </summary> /// <param name="status"></param> /// <param name="statuschangetime"></param> /// <param name="employeeid"></param> /// <returns></returns> public int AddBGCAdmin(int status, DateTime statuschangetime, int employeeid) { IBGCAdministrator bgcadmin = new BGCAdministratorFactory().CreateBGCAdminstrator(status, statuschangetime); bgcadmin.EmployeeId = employeeid; IBGCAdministratorDB adminDb = new BGCAdministratorDBFactory().CreateAdminDB(); int row = adminDb.AddBGCAdmin(bgcadmin); return(row); }