Exemplo n.º 1
0
        public static bool SendEmail(string EmailID, string MessageBody, string MessageSub)
        {
            string message = "success";
            bool   sent    = false;

            try
            {
                SmtpClient sclient;
                String     userName, passWord, smtpHost;
                int        portDetails;
                sclient             = new SmtpClient();
                smtpHost            = ConfigurationManager.AppSettings["smtpClient"].ToString();
                sclient.Host        = smtpHost;
                portDetails         = Convert.ToInt16(ConfigurationManager.AppSettings["portDetails"]);
                sclient.Port        = portDetails;
                userName            = ConfigurationManager.AppSettings["useremailId"].ToString();
                passWord            = ConfigurationManager.AppSettings["userPassword"].ToString();
                sclient.Credentials = new System.Net.NetworkCredential(userName, passWord);
                MailMessage mmsg;
                MailAddress maddr;
                mmsg            = new MailMessage();
                mmsg.IsBodyHtml = true;

                mmsg.From = new System.Net.Mail.MailAddress("*****@*****.**", "dscoverage.com");
                maddr     = new MailAddress(EmailID);
                mmsg.To.Add(maddr);
                mmsg.Subject  = MessageSub;
                mmsg.Body     = MessageBody;
                mmsg.Priority = MailPriority.High;
                bool ebablessl = Convert.ToBoolean(ConfigurationManager.AppSettings["ssl"].ToString());
                sclient.EnableSsl = ebablessl;

                sclient.Send(mmsg);
                sclient.Dispose();


                sent = true;
            }
            catch (Exception e)
            {
                string errmessage = LogWritter.CreateErrorMessage(e);
                LogWritter.LogFileWrite(errmessage);
                message = e.Message;
                sent    = false;
            }
            return(sent);
        }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
0
        protected void btn4AutoRize_Click(object sender, EventArgs e)
        {
            bool Completed = false;

            if (creditCardInformation.Is4Valid())
            {
                string enterFunctionLogger = "Enter :: btn4AutoRize_Click";
                LogWritter.LogFileWrite(enterFunctionLogger);
                try
                {
                    if (ViewState["custID"] != null)
                    {
                        Session["CustomerID"] = ViewState["custID"].ToString();
                    }

                    ManageUserSVC.ManageUserClient Userinfo = new ManageUserSVC.ManageUserClient();
                    DataSet Data = new DataSet();
                    Data = Userinfo.GetCustomerInfo(Guid.Parse(Session["CustomerID"].ToString()));
                    if (Data != null && Data.Tables[0].Rows.Count > 0)
                    {
                        string EmailAdd = Data.Tables[0].Rows[0]["EmailID"].ToString();
                        if (EmailAdd.Trim().Equals(creditCardInformation.EmailID.Text.Trim()))
                        {
                            SPSServiceSVC.SPSServiceClient service = new SPSServiceSVC.SPSServiceClient();

                            SPSServiceSVC.ID identityinfo = new SPSServiceSVC.ID();
                            identityinfo.AuthenticationToken = ConfigurationManager.AppSettings["AuthenticationToken"].ToString();
                            identityinfo.BillerAccountId     = ConfigurationManager.AppSettings["BillerID"].ToString();

                            SPSServiceSVC.TempTokenRequest tokn = new SPSServiceSVC.TempTokenRequest();
                            tokn.PayerInfo      = new SPSServiceSVC.PayerInformation();
                            tokn.PayerInfo.Name = "Insurance";
                            tokn.Identification = identityinfo;
                            SPSServiceSVC.TempTokenResult toknres = service.GetTempToken(tokn);

                            SPSServiceSVC.Transaction trans = new SPSServiceSVC.Transaction();
                            trans.CurrencyCode = "USD";

                            double val    = Convert.ToDouble(creditCardInformation.LabelAmount.Text);
                            double amount = val * 100;
                            trans.Amount         = Convert.ToDouble(amount).ToString();
                            Session["Amount"]    = trans.Amount;
                            trans.PayerAccountId = toknres.PayerId;

                            /////////////////////////////////////////////////////////////////////////////////////////////////////////
                            //Code Added By Mohit Paliwal
                            //As suggested Merchant Profile Id need to pass
                            trans.MerchantProfileId = ConfigurationManager.AppSettings["MerchantProfileId"].ToString();

                            /////////////////////////////////////////////////////////////////////////////////////////////////////////

                            SPSServiceSVC.PaymentMethodAdd payadd = new SPSServiceSVC.PaymentMethodAdd();
                            payadd.AccountNumber     = creditCardInformation.CardNumber.Text.Trim();      //credit card no.
                            payadd.Description       = ConfigurationManager.AppSettings["AccountDescription"].ToString();
                            payadd.PayerAccountId    = toknres.PayerId;
                            payadd.PaymentMethodType = creditCardInformation.CardType.SelectedValue.Trim();

                            SPSServiceSVC.CreatePaymentMethodResult paymethodres = service.CreatePaymentMethod(identityinfo, payadd);

                            SPSServiceSVC.PaymentInfoOverrides payereriditinfo = new SPSServiceSVC.PaymentInfoOverrides();
                            payereriditinfo.CreditCard = new SPSServiceSVC.CreditCardOverrides();
                            payereriditinfo.CreditCard.ExpirationDate  = creditCardInformation.Month.SelectedItem.Text.Trim() + creditCardInformation.Year.SelectedItem.Text.Trim().Substring(2, 3 - 1);
                            payereriditinfo.CreditCard.Billing         = new SPSServiceSVC.Billing();
                            payereriditinfo.CreditCard.Billing.City    = creditCardInformation.City.Text.Trim();
                            payereriditinfo.CreditCard.Billing.Country = "CA";
                            payereriditinfo.CreditCard.Billing.Email   = creditCardInformation.EmailID.Text.Trim();
                            payereriditinfo.CreditCard.Billing.ZipCode = creditCardInformation.Zip.Text.Trim();
                            payereriditinfo.CreditCard.FullName        = creditCardInformation.CardHolderFirstName.Text.Trim() + " " + creditCardInformation.CardHolderLastName.Text.Trim();


                            if (string.IsNullOrEmpty(paymethodres.PaymentMethodId))
                            {
                                string paymentMethodIdLogger = "Payment Not succed becuase of PaymentMethodId is null";
                                LogWritter.LogFileWrite(paymentMethodIdLogger);
                            }
                            SPSServiceSVC.TransactionResult MainRes = service.ProcessPaymentMethodTransaction(identityinfo, trans, Guid.Parse(paymethodres.PaymentMethodId), payereriditinfo);

                            SPSServiceSVC.Result delres = service.DeletePaymentMethod(identityinfo, toknres.PayerId, paymethodres.PaymentMethodId);

                            if (MainRes.RequestResult.ResultCode.Equals("00"))
                            {
                                Completed = true;
                                Response.Redirect("PaymentSucced.aspx?" + Crypto.ArgumentEncrypt("Resp") + "=" + Crypto.Encrypt("approved", true), false);
                            }
                            else
                            {
                                string resultCode = "Payment Not succed becuase of ResultCode :: " + MainRes.RequestResult.ResultCode;
                                LogWritter.LogFileWrite(resultCode);
                                Response.Redirect("PaymentSucced.aspx?" + Crypto.ArgumentEncrypt("Resp") + "=" + Crypto.Encrypt("notapproved", true), false);
                            }
                        }
                        else
                        {
                            creditCardInformation.LBL6.Visible     = true;
                            creditCardInformation.LBL6.Text        = "Your entered Email doesn't match to registered Email.";
                            creditCardInformation.LBL6.Style.Value = "margin-left:28px;";
                        }
                    }
                    string exitFunctionLogger = "Exit :: btn4AutoRize_Click";
                    LogWritter.LogFileWrite(exitFunctionLogger);

                    Response.Cookies.Clear();
                }
                catch (Exception ex)
                {
                    string errmessage = LogWritter.CreateErrorMessage(ex);
                    LogWritter.LogFileWrite(errmessage);

                    if (!Completed)
                    {
                        Response.Redirect("PaymentSucced.aspx?" + Crypto.ArgumentEncrypt("Resp") + "=" + Crypto.Encrypt("notapproved", true), false);
                    }
                }
            }
        }