private void GetData() { try { List <AccountCode> data = new AccountCodeDAL().GetAccountCodes().ToList(); if (data.Count == 0) { data = new List <AccountCode>(); data.Add(new AccountCode() { AccountCode1 = string.Empty, ParentAccountCode = string.Empty }); List <DAL.YearUploadSetup> GetData = new YearUploadDAL().GetYearUpload(); DAL.YearUploadSetup curryear = GetData.Where(x => x.BudgetYear == DateTime.Now.Year).FirstOrDefault(); if (curryear.ToString().Count() > 0) { if (!GetData.Where(y => y.BudgetYear == curryear.BudgetYear).Select(z => z.Status.Contains("A")).FirstOrDefault()) { btnFileUpload.HRef = "#"; } } } Session["AccountCodesData"] = data; } catch (Exception ex) { ((SiteMaster)this.Master).ShowMessage("Error", "An error occurred", ex, true); } }
private void GetData() { try { selectedSegment = (Segment)Session["SelectedSegment"]; List <SegmentDetail> data = new SegmentDetailsDAL().GetSegmentDetails(selectedSegment.SegmentID); if (data.Count == 0) { data = new List <SegmentDetail>(); data.Add(new SegmentDetail() { SegmentID = 0, SegmentDetailID = 0, ParentDetailID = 0 }); List <DAL.YearUploadSetup> GetData = new YearUploadDAL().GetYearUpload(); DAL.YearUploadSetup curryear = GetData.Where(x => x.BudgetYear == DateTime.Now.Year).FirstOrDefault(); if (curryear.ToString().Count() > 0) { if (!GetData.Where(y => y.BudgetYear == curryear.BudgetYear).Select(z => z.Status.Contains("A")).FirstOrDefault()) { btnFileUpload.HRef = "#"; } } } Session["SegmentDetailsData"] = data; } catch (Exception ex) { ((SiteMaster)this.Master).ShowMessage("Error", "An error occurred", ex, true); } }