コード例 #1
0
        /// <summary>
        /// Handles the Click event of the btnSubmitfinal control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void btnSubmitfinal_Click(object sender, EventArgs e)
        {
            //Start Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session VAPT issue
            if (Session["OTP_Frg_User"] != null && Session["OTP_Frg_User"].ToString() != "")
            {
                int cnt = 0;
                if (Int32.TryParse(Session["OTP_Frg_User"].ToString(), out cnt) && cnt >= 3)
                {
                    LabelOTPMessage.Text = Constants.MaxNoOfOTPMessage;
                    DivOTPMessage.Attributes.CssStyle.Add("display", "block");
                    return;
                }
            }
            //End Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session VAPT issue
            if (!string.IsNullOrEmpty(FirstFour.Text) && !string.IsNullOrEmpty(SecondFour.Text) && !string.IsNullOrEmpty(ThirdFour.Text) && !string.IsNullOrEmpty(ForthFour.Text))
            {
                hdnCard1.Value  = FirstFour.Text.Encrypt();
                hdnCard2.Value  = SecondFour.Text.Encrypt();
                hdnCard3.Value  = ThirdFour.Text.Encrypt();
                hdnCard4.Value  = ForthFour.Text.Encrypt();
                FirstFour.Text  = "xxxx";
                SecondFour.Text = "xxxx";
                ThirdFour.Text  = "xxxx";
                ForthFour.Text  = "xxxx";
            }

            bool IsUserExists = false;

            try
            {
                if (IsValidInfo())
                {
                    string fullCardnumber = (FirstFour.Text + SecondFour.Text + ThirdFour.Text + ForthFour.Text).Trim();
                    string DateOfBirth    = Convert.ToString(GetDateTime(txtbirthdate.Text.Trim()));
                    int    ExpiryMonth    = Convert.ToInt32(ddlmonth.SelectedItem.Text);
                    int    ExpiryYear     = Convert.ToInt32(ddlyear.SelectedItem.Text);
                    // Step 1 Find CARD In Oracle Database
                    CardManager cm   = new CardManager();
                    CH_CardDTO  card =
                        cm.AuthenticateCrNumberDOB(new CH_CardDTO()
                    {
                        card_number  = fullCardnumber,
                        EXPIRY_MONTH = ExpiryMonth,
                        EXPIRY_YEAR  = ExpiryYear,
                        BIRTH_DATE   = Convert.ToDateTime(DateOfBirth)
                    });


                    // Step 2 Find CARD In SQL Database Either exists or not
                    //

                    CardHolderManager Cardholder = new CardHolderManager();
                    // CardHolder_MstDTO user = Cardholder.FindUserByCrNumber(fullCardnumber.Encrypt()); Updated by Sahil on 29-jan-2015 as client said to use Acc_num instead of card_num
                    if (card != null)
                    {
                        IsUserExists = Cardholder.FindUserByAccountNumber(card.Cr_Account_Nbr.Encrypt());
                    }
                    else
                    {
                        lblStep1Message.Text = Constants.InvalidEntries;
                        DivStep1Message.Attributes.CssStyle.Add("display", "block");
                        txtCaptchaFirst.Text      = string.Empty;
                        mvFrgtPwd.ActiveViewIndex = 0;
                        return;
                    }

                    // if (card != null && user != null)
                    if (card != null && IsUserExists)
                    {
                        ViewState["Mobile_Num"] = card.PHONE_MOBILE;
                        string mobilenum = card.PHONE_MOBILE;
                        //Session["Card_Num"] = fullCardnumber.Encrypt();
                        Session["Acc_Num"]    = card.Cr_Account_Nbr.Encrypt();
                        ViewState["Email_ID"] = card.EMAIL_ID;
                        string lastFourdgts = string.Empty;
                        if (mobilenum != "")
                        {
                            int numberkength = mobilenum.Length;
                            if (numberkength > 4)
                            {
                                lastFourdgts = mobilenum.Substring(numberkength - 4, 4);
                            }
                            else
                            {
                                lastFourdgts = mobilenum;
                            }
                            txtMobileNo.Text = mobilenum;
                        }
                        //mobilenum = mobilenum.Substring(6, 4);
                        //lblDescOTP.Text = Constants.OTPDescforchangePwd;
                        //lblmob.Text = "(i.e. XXXXXX" + lastFourdgts + ")";
                        //lbl3.Text = Constants.OTPDesc2;

                        string OtpSuccess = GenerateOTP();
                        if (OtpSuccess != "0" && !string.IsNullOrEmpty(OtpSuccess))
                        {
                            mvFrgtPwd.ActiveViewIndex = 1;
                            StartOTPTimer();
                        }
                        else
                        {
                            ClearControls();
                            LblStep1ErrorMessage.Text = Constants.TechnicalError;
                            DivStep1ERROR.Attributes.CssStyle.Add("display", "block");
                            return;
                        }
                    }
                    else// (card != null && user == null)
                    {
                        lblStep1Message.Text = Constants.NotRegister;
                        DivStep1Message.Attributes.CssStyle.Add("display", "block");
                        txtCaptchaFirst.Text      = string.Empty;
                        mvFrgtPwd.ActiveViewIndex = 0;
                    }

                    //else
                    //{
                    //    lblStep1Message.Text = Constants.InvalidEntries;
                    //    mvFrgtPwd.ActiveViewIndex = 0;
                    //}
                }
            }
            catch (Exception ex)
            {
                LblStep1ErrorMessage.Text = Constants.TechnicalError;
                DivStep1ERROR.Attributes.CssStyle.Add("display", "block");
                string path = Server.MapPath("~/ErrorPage/ErrorLog");
                GeneralMethods.ErrorLog(path, ex);
                txtCaptchaFirst.Text      = string.Empty;
                mvFrgtPwd.ActiveViewIndex = 0;
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles the Click event of the btnSubmitfinal control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void btnSubmitfinal_Click(object sender, EventArgs e)
        {
            //Start Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session VAPT issue
            if (Session["OTP_Frg_User"] != null && Session["OTP_Frg_User"].ToString() != "")
            {
                int cnt = 0;
                if (Int32.TryParse(Session["OTP_Frg_User"].ToString(), out cnt) && cnt >= 3)
                {
                    LabelOTPMessage.Text = Constants.MaxNoOfOTPMessage;
                    DivOTPMessage.Attributes.CssStyle.Add("display", "block");
                    return;
                }
            }
            //End Added by abhijeet on 09/10/2019 to restrict 3 OTP in one session VAPT issue
            if (!string.IsNullOrEmpty(FirstFour.Text) && !string.IsNullOrEmpty(SecondFour.Text) && !string.IsNullOrEmpty(ThirdFour.Text) && !string.IsNullOrEmpty(ForthFour.Text))
            {
                hdnCard1.Value  = FirstFour.Text.Encrypt();
                hdnCard2.Value  = SecondFour.Text.Encrypt();
                hdnCard3.Value  = ThirdFour.Text.Encrypt();
                hdnCard4.Value  = ForthFour.Text.Encrypt();
                FirstFour.Text  = "xxxx";
                SecondFour.Text = "xxxx";
                ThirdFour.Text  = "xxxx";
                ForthFour.Text  = "xxxx";
            }

            CardHolder_MstDTO user = new CardHolder_MstDTO();

            if (IsValidInfo())
            {
                string fullCardnumber = (FirstFour.Text + SecondFour.Text + ThirdFour.Text + ForthFour.Text).Trim();
                //string DateOfBirth = DateTime.ParseExact(txtbirthdate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("MM/dd/yyyy");
                string DateOfBirth = Convert.ToString(GetDateTime(txtbirthdate.Text));
                int    ExpiryMonth = Convert.ToInt32(ddlmonth.SelectedItem.Text);
                int    ExpiryYear  = Convert.ToInt32(ddlyear.SelectedItem.Text);
                // Step 1 Find CARD In Oracle Database
                CardManager cm   = new CardManager();
                CH_CardDTO  card =
                    cm.AuthenticateCrNumberDOB(new CH_CardDTO()
                {
                    card_number  = fullCardnumber,
                    EXPIRY_MONTH = ExpiryMonth,
                    EXPIRY_YEAR  = ExpiryYear,
                    BIRTH_DATE   = Convert.ToDateTime(DateOfBirth)
                });


                // Step 2 Find CARD In SQL Database Either exists or not
                //

                CardHolderManager Cardholder = new CardHolderManager();

                if (card != null)
                {
                    user = Cardholder.FindUserByCrNumber(card.Cr_Account_Nbr.Encrypt());
                }
                else
                {
                    lblMessage.Text = Constants.InvalidEntries;
                    DivMessage.Attributes.CssStyle.Add("display", "block");
                    txtCaptchaFirst.Text        = string.Empty;
                    mvFrgtUname.ActiveViewIndex = 0;
                    return;
                }


                //CardHolder_MstDTO user = Cardholder.FindUserByCrNumber(fullCardnumber.Encrypt());

                if (card != null && user != null)
                {
                    string mobilenum = "";

                    ViewState["Mobile_Num"] = card.PHONE_MOBILE;
                    if (ViewState["Mobile_Num"] != null)
                    {
                        mobilenum = ViewState["Mobile_Num"].ToString();
                    }
                    //Session["Card_Num"] = fullCardnumber.Encrypt();
                    Session["Acc_Num"]           = card.Cr_Account_Nbr.Encrypt();
                    ViewState["UserName"]        = user.User_nm;
                    ViewState["CardHolder_name"] = card.FULL_NAME;
                    ViewState["Email_ID"]        = card.EMAIL_ID;

                    string lastFourdgts = string.Empty;
                    if (mobilenum != "")
                    {
                        int numberkength = mobilenum.Length;
                        if (numberkength > 4)
                        {
                            lastFourdgts = mobilenum.Substring(numberkength - 4, 4);
                        }
                        else
                        {
                            lastFourdgts = mobilenum;
                        }
                        txtMobileNo.Text = mobilenum;
                    }

                    //mobilenum = mobilenum.Substring(6, 4);
                    //lblDescOTP.Text = Constants.OTPDescforchangePwd;
                    //lblmob.Text = "(i.e. XXXXXX" + lastFourdgts + ")";
                    //lbl3.Text = Constants.OTPDesc2;
                    string OtpSuccess = GenerateOTP();
                    if (OtpSuccess != "0" && !string.IsNullOrEmpty(OtpSuccess))
                    {
                        mvFrgtUname.ActiveViewIndex = 1;
                        StartOTPTimer();
                        lblMessage.Text = string.Empty;
                        DivMessage.Attributes.CssStyle.Add("display", "none");
                    }
                    else
                    {
                        ClearControls();
                        LblErrorMessage.Text = Constants.TechnicalError;
                        DivERROR.Attributes.CssStyle.Add("display", "block");
                        return;
                    }
                }
                else if (card != null && user == null)
                {
                    lblMessage.Text = Constants.NotRegister;
                    DivMessage.Attributes.CssStyle.Add("display", "block");
                    mvFrgtUname.ActiveViewIndex = 0;
                }

                else
                {
                    lblMessage.Text = Constants.InvalidEntries;
                    DivMessage.Attributes.CssStyle.Add("display", "block");
                    mvFrgtUname.ActiveViewIndex = 0;
                }
            }
        }