/// <summary> /// Binds the grid view /// </summary> private void BindData() { //try //{ // DisPersonels disPersonels = new DisPersonels(); // DisPersonelManager disPersonelManager = new DisPersonelManager(); // disPersonels = disPersonelManager.GetAll(); // if (disPersonels.Count == 0) // ResultsLiteral.Text = "No records were found."; // else // { // int start = (((gridViewDisPersonel.PageIndex + 1) * PagingSize) - PagingSize) + 1; // int end = ((start + PagingSize) - 1 > disPersonels.Count ? disPersonels.Count : (start + PagingSize) - 1); // ResultsLiteral.Text = string.Format("Showing {0} to {1} of {2}", start, end, disPersonels.Count); // } // gridViewDisPersonel.DataSource = disPersonels; // gridViewDisPersonel.DataBind(); //} //catch (BusinessLayerException ex) //{ // throw new Exception("An error while gettings all DisPersonel records. " + ex.Message, ex); //} EFDal ed = new EFDal(); IList <DisPersonel> DisPersonelList = ed.BoleglerinTumDisPersonelleriniDon(ed.kal_BolgeKoduDon(Context.User.Identity.Name)); //int DisPersonelSayisi = ed.BoleglerinTumDisPersonelleriniDon(ed.kal_BolgeKoduDon(Context.User.Identity.Name)).Count(); int DisPersonelSayisi = DisPersonelList.Count(); if (DisPersonelSayisi == 0) { lblUyari.Text = "Bölgeye ait dış personel bulunamadı."; } else { int start = (((gridViewDisPersonel.CurrentPageIndex + 1) * gridViewDisPersonel.PageSize) - gridViewDisPersonel.PageSize) + 1; int end = ((start + gridViewDisPersonel.PageSize) - 1 > DisPersonelSayisi ? DisPersonelSayisi : (start + gridViewDisPersonel.PageSize) - 1); lblUyari.Text = string.Format("Showing {0} to {1} of {2}", start, end, DisPersonelSayisi); } //gridViewDisPersonel.DataSource = ed.BoleglerinTumDisPersonelleriniDon(ed.kal_BolgeKoduDon(Context.User.Identity.Name)); gridViewDisPersonel.DataSource = DisPersonelList; gridViewDisPersonel.DataBind(); }
/// <summary> /// Binds the grid view /// </summary> private void BindData() { //try //{ // DisPersonels disPersonels = new DisPersonels(); // DisPersonelManager disPersonelManager = new DisPersonelManager(); // disPersonels = disPersonelManager.GetAll(); // if (disPersonels.Count == 0) // ResultsLiteral.Text = "No records were found."; // else // { // int start = (((gridViewDisPersonel.PageIndex + 1) * PagingSize) - PagingSize) + 1; // int end = ((start + PagingSize) - 1 > disPersonels.Count ? disPersonels.Count : (start + PagingSize) - 1); // ResultsLiteral.Text = string.Format("Showing {0} to {1} of {2}", start, end, disPersonels.Count); // } // gridViewDisPersonel.DataSource = disPersonels; // gridViewDisPersonel.DataBind(); //} //catch (BusinessLayerException ex) //{ // throw new Exception("An error while gettings all DisPersonel records. " + ex.Message, ex); //} EFDal ed=new EFDal(); IList<DisPersonel> DisPersonelList = ed.BoleglerinTumDisPersonelleriniDon(ed.kal_BolgeKoduDon(Context.User.Identity.Name)); //int DisPersonelSayisi = ed.BoleglerinTumDisPersonelleriniDon(ed.kal_BolgeKoduDon(Context.User.Identity.Name)).Count(); int DisPersonelSayisi = DisPersonelList.Count(); if (DisPersonelSayisi == 0) lblUyari.Text = "Bölgeye ait dış personel bulunamadı."; else { int start = (((gridViewDisPersonel.CurrentPageIndex + 1) * gridViewDisPersonel.PageSize) - gridViewDisPersonel.PageSize) + 1; int end = ((start + gridViewDisPersonel.PageSize) - 1 > DisPersonelSayisi ? DisPersonelSayisi : (start + gridViewDisPersonel.PageSize) - 1); lblUyari.Text = string.Format("Showing {0} to {1} of {2}", start, end, DisPersonelSayisi); } //gridViewDisPersonel.DataSource = ed.BoleglerinTumDisPersonelleriniDon(ed.kal_BolgeKoduDon(Context.User.Identity.Name)); gridViewDisPersonel.DataSource = DisPersonelList; gridViewDisPersonel.DataBind(); }