protected void RenewPackage() { try { string PackageID = (gvpurchasedpackages.SelectedRow.FindControl("lblID") as Label).Text; obj_BAL_Student_Dashboard = new Student_DashBoard_BLogic(); DataSet ds = new DataSet(); //ds = obj_BAL_Student_Dashboard.BAL_Student_SelectNotAvailablePackage(Convert.ToInt32(AppSessions.BMSID), Convert.ToInt32(dt.Rows[i]["PackageID"].ToString())); //ds = obj_BAL_Student_Dashboard.BAL_Student_SelectNotAvailablePackage(Convert.ToInt32(AppSessions.BMSID), Convert.ToInt32(PackageID)); ds = obj_BAL_Student_Dashboard.BAL_Student_CheckForPackageAvailablity(PackageID); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { lblnotavailablepackage.Text = ""; if (ds.Tables[0].Rows[0]["Price"].ToString() == "0") { lblnotavailablepackage.Text += ds.Tables[0].Rows[0]["PackageName"].ToString() + " Package is for demo only, you can not buy it." + "<br />"; lblnotavailablepackage.Visible = true; } else if (ds.Tables[0].Rows[0]["IsActive"].ToString() == "False") { lblnotavailablepackage.Text += ds.Tables[0].Rows[0]["PackageName"].ToString() + " Package is not available for renew." + "<br />"; lblnotavailablepackage.Visible = true; } } else { if (ds.Tables[1].Rows.Count > 0) { if (Convert.ToDateTime(ds.Tables[1].Rows[0]["OfferEndDate"]) > DateTime.Now) { lblofferdetails.Text = "Congratulations! You will get Vacation offer( " + ds.Tables[1].Rows[0]["OfferName"].ToString() + ") on renewal of this package"; lblofferdetails.ForeColor = System.Drawing.Color.Yellow; lblofferdetails.Attributes.Add("font-size", "20px;"); Session["OfferPackageDays"] = ds.Tables[1].Rows[0]["OfferDays"].ToString(); } } fieldpanel.Visible = true; pnlpackageactivation.Visible = true; rbyes.Checked = true; txtdate.Text = DateTime.Today.ToString("dd-MMM-yyyy"); txtdate.Attributes.Add("readonly", "readonly"); fieldpanel.Visible = true; rbyes.Checked = true; } } } catch (Exception ex) { } }