public List <DepartmentMonthlyInformation> GetListDepartmentMonthlyInformation(int adjutancyTypeID) { List <DepartmentMonthlyInformation> listDepartmentMonthlyInformation = new List <DepartmentMonthlyInformation>() { }; SqlParameter[] parametersAdjutancyType = new SqlParameter[] { new SqlParameter("@AdjutancyTypeID", adjutancyTypeID) }; //Lets get the list of DepartmentMonthlyInformation records from database using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("AdjutancyType_GetList_DepartmentMonthlyInformation", CommandType.StoredProcedure, parametersAdjutancyType)) { //check if any record exists or not if (table.Rows.Count > 0) { //Lets go ahead and create the list of DepartmentMonthlyInformation listDepartmentMonthlyInformation = new List <DepartmentMonthlyInformation>(); //Now lets populate the DepartmentMonthlyInformation details into the list of DepartmentMonthlyInformations foreach (DataRow row in table.Rows) { DepartmentMonthlyInformation departmentMonthlyInformation = departmentMonthlyInformationDBAccess.GetDetails(Convert.ToInt32(row["YearTypeID"]), Convert.ToInt32(row["MonthTypeID"]), Convert.ToInt32(row["DepartmentID"])); listDepartmentMonthlyInformation.Add(departmentMonthlyInformation); } } } return(listDepartmentMonthlyInformation); }
// This fuction does not contain any business logic, it simply returns the // list of departmentMonthlyInformations, we can put some logic here if needed public DepartmentMonthlyInformation GetDetails(int yearTypeID , int monthTypeID , int departmentID) { return departmentMonthlyInformationDb.GetDetails(yearTypeID , monthTypeID , departmentID); }