protected void btnLogin_Click(object sender, EventArgs e) { string EmailId = txtUsername.Text.Trim(); Session["EmailId"] = EmailId; string Password = txtSecuCode.Text.Trim(); DataSet dsCustData = new DataSet(); ManageUserSVC.ManageUserClient Client = new ManageUserSVC.ManageUserClient(); dsCustData = Client.LoginCustomer(EmailId.Trim(), Password.Trim()); Response.Cookies["UserName"].Value = txtUsername.Text.Trim(); Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(30); if (dsCustData != null && dsCustData.Tables[0].Rows.Count > 0) { bool IsActivePolicy = Convert.ToBoolean(dsCustData.Tables[0].Rows[0]["IsActivePolicy"].ToString()); decimal Pay = Convert.ToDecimal(dsCustData.Tables[0].Rows[0]["Payment"].ToString()); Session["payment"] = Pay; string CusID = Crypto.Encrypt(dsCustData.Tables[0].Rows[0]["Cust_ID"].ToString(), true); Session["CustomerID"] = dsCustData.Tables[0].Rows[0]["Cust_ID"].ToString(); Session["EmailID"] = dsCustData.Tables[0].Rows[0]["EmailID"].ToString(); string firstname = Crypto.Encrypt(dsCustData.Tables[0].Rows[0]["FirstName"].ToString(), true); Session["Firstname"] = dsCustData.Tables[0].Rows[0]["FirstName"].ToString(); string paswrd = Crypto.Encrypt(dsCustData.Tables[0].Rows[0]["SecurityCode"].ToString(), true); Session["Paswrd"] = dsCustData.Tables[0].Rows[0]["SecurityCode"].ToString(); if (Session["GenerateCertificateFromDefaultPage"] != null) { ManageUserSVC.ManageUserClient Cl = new ManageUserSVC.ManageUserClient(); Guid CustID = Guid.Parse(Session["CustomerID"].ToString()); DataSet dsCus = Cl.CreateEvedenceInfoByCusID(CustID); DateTime CoverageDate; DateTime EndDate = DateTime.Now; if (dsCus != null && dsCus.Tables[0].Rows.Count > 0) { if (dsCus.Tables[0].Rows[0]["CoverDate"].ToString() != "") { CoverageDate = Convert.ToDateTime(dsCus.Tables[0].Rows[0]["CoverDate"].ToString()); EndDate = CoverageDate.AddMonths(12); int numberOfDayRemaining = (EndDate - DateTime.Now).Days; if (numberOfDayRemaining <= 0) { Response.Redirect("Home.aspx", true); } } } if (dsCus != null && dsCus.Tables[0].Rows.Count > 0) { Session["GenerateCertificateFromDefaultPage"] = null; Response.Redirect("FillCertiInfo.aspx"); } else { Session["GenerateCertificateFromDefaultPage"] = null; Session["pnl"] = "3"; Session["value"] = Crypto.Encrypt(Session["CustomerID"].ToString(), true); Response.Redirect("Register.aspx"); } } else { Response.Redirect("Home.aspx", true); } } else { lblError.Text = "Unfortunately we could not match the email address you entered with information in our database!"; } }
protected void Page_Load(object sender, EventArgs e) { try { if (Session["CustomerID"] == null) { string errmessage = "Gate 1"; LogWritter.LogFileWrite(errmessage); Response.Redirect("Login.aspx"); errmessage = "Gate 2"; LogWritter.LogFileWrite(errmessage); } Session["value"] = Crypto.Encrypt(Session["CustomerID"].ToString(), true); Session["pnl"] = "3"; ManageUserSVC.ManageUserClient Cl = new ManageUserSVC.ManageUserClient(); Guid CustID = Guid.Parse(Session["CustomerID"].ToString()); if (!IsPostBack) { DataSet dsCus = new DataSet(); //Guid CusID = Guid.Parse(Crypto.Decrypt(Request.QueryString["GeneKey"].ToString(), true)); Guid CusID = Guid.Parse(Session["CustomerID"].ToString()); ManageUserSVC.ManageUserClient Userinfo = new ManageUserSVC.ManageUserClient(); DataSet Data = new DataSet(); Data = Userinfo.GetCustomerInfo(CusID); ViewState["CustomerID"] = CustID; dsCus = new DataSet(); dsCus = Cl.CreateEvedenceInfoByCusID(CustID); if (dsCus != null && dsCus.Tables[0].Rows.Count > 0) { DateTime CoverageDate; DateTime EndDate = DateTime.Now; if (dsCus.Tables[0].Rows[0]["CoverDate"].ToString() != "") { CoverageDate = Convert.ToDateTime(dsCus.Tables[0].Rows[0]["CoverDate"].ToString()); EndDate = CoverageDate.AddMonths(12); Session["TEMPCoverageEndDate"] = EndDate; if (DateTime.Now < EndDate) { if (Session["tryRenewAccount"] != null) { lblRemain.Text = (EndDate - DateTime.Now).Days.ToString(); Renewnote.Visible = true; Session["tryRenewAccount"] = null; Main.Visible = false; return; } Main.Visible = true; int numberOfDayRemaining = (EndDate - DateTime.Now).Days; if (numberOfDayRemaining <= 30) { string thirtyDayPrior = string.Format("Your Account is about to Expire in {0} days ", numberOfDayRemaining); lblMessageOneMonthAdvance.Text = thirtyDayPrior; pnlRenewBeforeOneMonth.Visible = true; } imgCerty.Visible = true; imgCerty.Style.Value = "padding-top:15px"; //Label1.Visible = true; Imageevedence.Visible = false; //Label2.Visible = false; } else { //Label2.Visible = false; lblWarn.Text = "Your Account is Expired. Thanks for using our service. You need to Renew your Account."; lblWarn.Visible = true; Main.Visible = false; Renewspan.Visible = true; List <usp_GetEvedenceResult> ListEvedences = new List <usp_GetEvedenceResult>(); ListEvedences = Cl.GetEvedenceInfoByCusID(CustID); if (ListEvedences != null && ListEvedences.Count > 0) { foreach (usp_GetEvedenceResult item in ListEvedences) { if (item.IsActive.Value) { Cl.Update_Evidence(CustID, DateTime.Now, false, item.EvidenceID, true); Cl.Update_Payment(CustID, 1, false); } } } } } else if (Data.Tables[0].Rows[0]["Payment"].ToString() == "0.0000") { //Covarage set first time Imageevedence.Visible = true; //Label2.Visible = true; imgCerty.Visible = false; //Label1.Visible = false; } } else { //Covarage set first time Imageevedence.Visible = true; //Label2.Visible = true; imgCerty.Visible = false; //Label1.Visible = false; } } BindCertificates(CustID, Cl); BindEvedences(CustID, Cl); } catch (Exception exx) { string errmessage = LogWritter.CreateErrorMessage(exx); LogWritter.LogFileWrite(errmessage); throw; } }