protected void FillAllNotPurchasedPackageList() { try { string strcountryname = string.Empty; obj_BAL_Student_Dashboard = new Student_DashBoard_BLogic(); DataSet ds = new DataSet(); DataSet dsSettings = new DataSet(); Teacher_Dashboard_BLogic obj_BAL_Teacher_Dashboard = new Teacher_Dashboard_BLogic(); dsSettings = obj_BAL_Teacher_Dashboard.BAL_Select_CoveredUncoverChapterTopic_Settings("IsMultiCurrency"); string IsMultiCurrency = dsSettings.Tables[0].Rows[0]["value"].ToString().Trim(); if (IsMultiCurrency.ToLower() == "yes") { strcountryname = GetCountryName(); ds = obj_BAL_Student_Dashboard.BAL_Student_ALL_Not_Purchased_Package(AppSessions.BMSID, AppSessions.StudentID, Session["CurrencyType"].ToString()); } else { strcountryname = "India"; Session["CurrencyType"] = "INR"; Session["country_name"] = "India"; ds = obj_BAL_Student_Dashboard.BAL_Student_ALL_Not_Purchased_Package(AppSessions.BMSID, AppSessions.StudentID, Session["CurrencyType"].ToString()); } //if (strcountryname.ToString().Trim().ToLower() == "india") //{ //} //else if (strcountryname.ToString().Trim().ToLower() == "united states") //{ //ds = obj_BAL_Student_Dashboard.BAL_Student_ALL_Not_Purchased_Package(AppSessions.BMSID, AppSessions.StudentID, "USD"); //} bool IsPackageOffer = false; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { ds.Tables[0].Columns.Add("ValidTill", typeof(string)); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (Convert.ToDateTime(ds.Tables[0].Rows[i]["OfferEndDate"]) > DateTime.Now) { IsPackageOffer = true; break; } { IsPackageOffer = false; } } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (Convert.ToDateTime(ds.Tables[0].Rows[i]["OfferEndDate"]) > DateTime.Now) { decimal cntnoofdays = Convert.ToDecimal((Convert.ToInt32(ds.Tables[0].Rows[i]["NoOfMonth"].ToString())) / 30); int cntnoofmonth = Convert.ToInt32(Math.Round(cntnoofdays)); DateTime dtFromDate = Convert.ToDateTime(DateTime.Today); DateTime dtvalidtill = dtFromDate.AddMonths(cntnoofmonth); dtvalidtill = dtvalidtill.AddDays(-1); //ds.Tables[0].Rows[i]["ValidTill"] = dtvalidtill.ToString("dd-MMM-yyyy"); if (Convert.ToInt32(ds.Tables[0].Rows[i]["OfferDays"].ToString()) <= 29) { dtvalidtill = dtvalidtill.AddDays(Convert.ToInt32(ds.Tables[0].Rows[i]["OfferDays"].ToString())); ds.Tables[0].Rows[i]["ValidTill"] = dtvalidtill.ToString("dd-MMM-yyyy"); } else { decimal cntnoofofferdays = Convert.ToDecimal((Convert.ToInt32(ds.Tables[0].Rows[i]["OfferDays"].ToString())) / 30); int cntnoofoffermonth = Convert.ToInt32(Math.Round(cntnoofofferdays)); ds.Tables[0].Rows[i]["ValidTill"] = dtvalidtill.AddMonths(cntnoofoffermonth).ToString("dd-MMM-yyyy"); } ds.Tables[0].Rows[i]["NoOfMonth"] = cntnoofmonth.ToString(); } else { decimal cntnoofdays = Convert.ToDecimal((Convert.ToInt32(ds.Tables[0].Rows[i]["NoOfMonth"].ToString())) / 30); int cntnoofmonth = Convert.ToInt32(Math.Round(cntnoofdays)); DateTime dtFromDate = Convert.ToDateTime(DateTime.Today); DateTime dtvalidtill = dtFromDate.AddMonths(cntnoofmonth); dtvalidtill = dtvalidtill.AddDays(-1); ds.Tables[0].Rows[i]["NoOfMonth"] = cntnoofmonth.ToString(); ds.Tables[0].Rows[i]["ValidTill"] = dtvalidtill.ToString("dd-MMM-yyyy"); ds.Tables[0].Rows[i]["OfferName"] = "N/A"; } } } if (ds.Tables.Count > 0 && ds != null) { if (IsPackageOffer) { gvallpackage.DataSource = ds.Tables[0]; gvallpackage.DataBind(); } else { gvallpackage.DataSource = ds.Tables[0]; gvallpackage.DataBind(); gvallpackage.Columns[3].Visible = false; } } //if (IsForAllPackage) //{ // if (ds.Tables[0].Rows.Count > 0 && ds != null) // { // gvOffer.DataSource = ds.Tables[0]; // gvOffer.DataBind(); // } // else // { // gvOffer.DataSource = ds.Tables[0]; // gvOffer.DataBind(); // } //} //else //{ // if (ds.Tables[0].Rows.Count > 0 && ds != null) // { // gvallpackage.DataSource = ds.Tables[0]; // gvallpackage.DataBind(); // } // else // { // gvallpackage.DataSource = ds.Tables[0]; // gvallpackage.DataBind(); // } //} } catch (Exception ex) { //WebMsg.Show(ex.Message); } }