public void SetCurrentPage(int pageId) { if (_tgkMainList == null) { return; } _currentPage = _tgkMainList.FirstOrDefault(p => p.id == pageId); }
/// Sayfadaki sütunları T_GK_MAIN modeline çevirir. public T_GK_MAIN FillModel(Microsoft.Office.Interop.Excel.Worksheet page, int pageId) { T_GK_MAIN tgkMain = new T_GK_MAIN(); tgkMain.id = pageId; Microsoft.Office.Interop.Excel.Range rng = null; rng = (Microsoft.Office.Interop.Excel.Range)page.Columns[1]; tgkMain.tgk1 = FillItem(rng.Value2); rng = (Microsoft.Office.Interop.Excel.Range)page.Columns[2]; tgkMain.tgk2 = FillItem(rng.Value2); rng = (Microsoft.Office.Interop.Excel.Range)page.Columns[3]; tgkMain.tgk3 = FillItem(rng.Value2); rng = (Microsoft.Office.Interop.Excel.Range)page.Columns[4]; tgkMain.tgk4 = FillItem(rng.Value2); rng = (Microsoft.Office.Interop.Excel.Range)page.Columns[5]; tgkMain.tgk5 = FillItem(rng.Value2); return(tgkMain); }
/// Gelen modelin tekil grup kodlarını birbiriyle çarpıp Entity tipindeki listeye doldurur. public void PopulateTGK(T_GK_MAIN mainItems) { var emptyData = new T_GK() { code = " " }; int i = 3; mainItems.allItems = (from tgk1 in mainItems.tgk1.DefaultIfEmpty(emptyData) from tgk2 in mainItems.tgk2.DefaultIfEmpty(emptyData) from tgk3 in mainItems.tgk3.DefaultIfEmpty(emptyData) from tgk4 in mainItems.tgk4.DefaultIfEmpty(emptyData) from tgk5 in mainItems.tgk5.DefaultIfEmpty(emptyData) select new Entity { id = i++, code1 = tgk1.code, code2 = tgk2.code, code3 = tgk3.code, code4 = tgk4.code, code5 = tgk5.code }).ToList(); }