public void FillPreviousYearsData(ref List <BasicAllocationPreviousYearsDataModel> previousYearsDataModels, ref List <AllocationSourcesModel> sourcesModels, DataTable dt, int year) { for (int i = 0; i < dt.Rows.Count; i++) { if (i > 15) { BasicAllocationPreviousYearsDataModel previousYearsDataModel = new BasicAllocationPreviousYearsDataModel(); if (dt.Rows[i][9] != null) { if (dt.Rows[i][9].ToString() != "" && dt.Rows[i][5].ToString() != "") { previousYearsDataModel.AUN = (dt.Rows[i][4] + "") == "" ? 999999999 : int.Parse(dt.Rows[i][4].ToString()); previousYearsDataModel.StateDeterminedFinalAllocation = decimal.Parse(dt.Rows[i][9].ToString().Trim('$')); previousYearsDataModel.ProgramYear = (year - 1); previousYearsDataModels.Add(previousYearsDataModel); } } if (dt.Rows[i][5].ToString() != "" && dt.Rows[i][6].ToString() == "") { AllocationSourcesModel sourcesModel = new AllocationSourcesModel(); sourcesModel.AUN = int.Parse(dt.Rows[i][4].ToString()); sourcesModel.ProgramYear = year; sourcesModels.Add(sourcesModel); } } } }
public void FillSchoolDistricts(ref List <SchoolDistrictsModel> districtsModel, ref List <AllocationSourcesModel> sourcesModels, DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { if (i > 9) { SchoolDistrictsModel districtModel = new SchoolDistrictsModel(); if (dt.Rows[i][3] != null && dt.Rows[i][4] != null) { if (dt.Rows[i][3].ToString() != "" && dt.Rows[i][4].ToString() != "") { districtModel.LEAID = int.Parse(dt.Rows[i][3].ToString()); districtModel.AgencyName = dt.Rows[i][4].ToString(); districtModel.IsCharterSchool = false; districtsModel.Add(districtModel); } } AllocationSourcesModel sourceModel = new AllocationSourcesModel(); if (dt.Rows[i][3] != null && dt.Rows[i][10] != null) { if (dt.Rows[i][3].ToString() != "" && dt.Rows[i][10].ToString() != "" && dt.Rows[i][4].ToString().ToLower() != "undistributed") { sourceModel.LEAID = int.Parse(dt.Rows[i][3].ToString()); sourceModel.BasicAllocation = decimal.Parse(dt.Rows[i][10].ToString()); sourceModel.ConcAllocation = decimal.Parse(dt.Rows[i][11].ToString()); sourcesModels.Add(sourceModel); } } } } }