Exemplo n.º 1
0
        private bool StoreinDB(byte[] buffer, ManageUserSVC.ManageUserClient client)
        {
            bool    Valid = true;
            DataSet DsCus = new DataSet();

            //DsCus = client.GetEvedenceInfoByCusID(Guid.Parse(ViewState["ID"].ToString()));
            if (DsCus != null && DsCus.Tables[0].Rows.Count > 0)
            {
                bool ActveEve = false;
                Guid EVEID    = new Guid();
                foreach (DataRow item in DsCus.Tables[0].Rows)
                {
                    if (item["IsActive"].ToString().Equals("True"))
                    {
                        EVEID    = Guid.Parse(item["EvedenceID"].ToString());
                        ActveEve = true;
                        break;
                    }
                }

                if (ActveEve)
                {
                    DateTime EvedenceDate = Convert.ToDateTime(DsCus.Tables[0].Rows[0]["EvideDate"].ToString());
                    if (EvedenceDate < DateTime.Now && DateTime.Now < EvedenceDate.AddMonths(12))
                    {
                        //Updated LastUpdated Date and IsActive only...
                        client.Update_Evidence(Guid.Parse(ViewState["CusID"].ToString()), DateTime.Now, true, EVEID, false);
                    }
                    else
                    {
                        //Updated IsActive field, Evedence is not valid now, need to renew account.
                        client.Update_Evidence(Guid.Parse(ViewState["CusID"].ToString()), DateTime.Now, false, EVEID, false);
                        Valid = false;
                    }
                }
                else
                {
                    // If Account get renewd, then again insert new evedence information without affecting older records.
                    client.InsertEvedence(Guid.Parse(ViewState["EvedenceID"].ToString()), Convert.ToDateTime(ViewState["CoverageDate"].ToString()),
                                          Guid.Parse(ViewState["CusID"].ToString()), DateTime.Now, true, true, buffer);
                }
            }
            else
            {
                //Inserted New Evedence.
                client.InsertEvedence(Guid.Parse(ViewState["EvedenceID"].ToString()), Convert.ToDateTime(ViewState["CoverageDate"].ToString()),
                                      Guid.Parse(ViewState["CusID"].ToString()), DateTime.Now, true, true, buffer);
            }

            return(Valid);
        }
        private bool StoreinDB(byte[] buffer, ManageUserSVC.ManageUserClient client, ManageUserSVC.ManageUserCoverageData Coverage)
        {
            bool Valid = true;
            List <usp_GetEvedenceResult> DsCus = new List <usp_GetEvedenceResult>();

            DsCus = client.GetEvedenceInfoByCusID(Guid.Parse(Session["CustomerIDForAdmin"].ToString()));

            if (DsCus != null && DsCus.Count > 0)
            {
                foreach (usp_GetEvedenceResult item in DsCus)
                {
                    if (item.IsActive.Value)
                    {
                        client.Update_Evidence(Guid.Parse(Session["CustomerIDForAdmin"].ToString()), DateTime.Now, false, item.EvidenceID, true);
                    }
                }
            }

            if (DsCus != null && DsCus.Count > 0)
            {
                //client.Delete_Evidence(Guid.Parse(Session["CustomerIDForAdmin"].ToString()));

                //Insert Newely generated Evedence after renew...
                client.InsertEvedence(Guid.NewGuid(), DateTime.Now,
                                      Guid.Parse(Session["CustomerIDForAdmin"].ToString()), DateTime.Now, true, true, buffer);
            }
            else
            {
                //Inserted New Evedence.
                client.InsertEvedence(Guid.NewGuid(), DateTime.Now,
                                      Guid.Parse(Session["CustomerIDForAdmin"].ToString()), DateTime.Now, true, true, buffer);
            }

            return(Valid);
        }
        private void SendEmailForProofOfEvidnce(ManageUserSVC.ManageUserClient Client, Guid CustID, string Local)
        {
            lblCerty.Visible = false;
            lblEve.Visible   = false;
            DataSet dsCus = new DataSet();

            dsCus = Client.GetCustomerInfo(CustID);

            StringBuilder strMailBody = new StringBuilder();

            string url = System.Configuration.ConfigurationManager.AppSettings["HostingPrefix"];

            //header
            strMailBody.Append("<p>&nbsp;</p>");
            strMailBody.Append("<div style=" + c + "margin-left: auto;height:500px;margin-right: auto;position: absolute;text-align: center;top: 0;width: 100%;z-index: 999;" + c + ">");
            strMailBody.Append("<div style=" + c + "background: url('" + url + "images/image.png') repeat-x scroll 0 0 transparent;height: 75px; width:798px;  position: relative;top: 0;z-index: 999;" + c + ">" + "<br/>");

            strMailBody.Append("<p>&nbsp;</p><table style='font-family: Tahoma;' border='0' cellpadding='0' cellspacing='0' width='600'><tbody><tr><td><table style='font-family: Tahoma;' border='0' cellpadding='0' cellspacing='0' width='600'>");
            strMailBody.Append("<tbody><tr style='font-family: Tahoma; font-size: 15px; color: rgb(33, 33, 33); text-align: left; ' valign='top'><td style='padding:35px 20px;font-family: Tahoma;'>");
            strMailBody.Append("<br/>" + dsCus.Tables[0].Rows[0]["FirstName"].ToString() + " " + dsCus.Tables[0].Rows[0]["LastName"].ToString() + "," + "<br /><br />");
            strMailBody.Append("Your Evidence of Coverage has been generated.<br /><br />");
            strMailBody.Append("To view your Evidence of Coverage please click <a href='" + url + "ViewDoc.ashx?" + Crypto.ArgumentEncrypt("ching") + "=" + Crypto.Encrypt(CustID.ToString(), true) + "&" + Crypto.ArgumentEncrypt("type") + "=" + Crypto.Encrypt("eve", true) + "' target='dscoverageview'>here</a><br/><br/>");
            strMailBody.Append("Sincerely,<br/>");
            strMailBody.Append("dscoverage.ca<br/>");
            strMailBody.Append("</tr></tbody></table>");
            strMailBody.Append("<div style=" + c + "background: url('" + url + "images/footer-b.jpg') no-repeat scroll 0 0 transparent;color: #939393;font-size: 10px;height: 60px;line-height: 44px;overflow: hidden;padding: 0 20px;width: 760px;margin-top: 5px;" + c + ">" + "<p style='float: left;color: white;'>Copyright © " + DateTime.Now.Year.ToString() + " <a href='https://dscoverage.ca' target='_blank' style='color:white;font-weight: bolder;'>dscoverage.ca</a>, Inc. All Rights Reserved.</p></div>");
            string pSubject = ConfigurationManager.AppSettings["SendingProofOfEvedence"].ToString();

            CommonFunction.SendEmail(dsCus.Tables[0].Rows[0]["EmailID"].ToString().Trim(), strMailBody.ToString(), pSubject);

            List <usp_GetEvedenceResult> DsCus = new List <usp_GetEvedenceResult>();

            DsCus = Client.GetEvedenceInfoByCusID(CustID);

            if (DsCus != null && DsCus.Count > 0)
            {
                //MKP
                //Guid EVEID = Guid.Parse(DsCus.ToList()[0].EvidenceID.ToString());
                foreach (usp_GetEvedenceResult item in DsCus)
                {
                    if (item.IsActive == true)
                    {
                        Guid EVEID   = Guid.Parse(item.EvidenceID.ToString());
                        bool Updated = Client.Update_Evidence(CustID, DateTime.Now, true, EVEID, true);
                    }
                }
            }
        }
Exemplo n.º 4
0
        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;
            }
        }