Ejemplo n.º 1
0
        /// <summary>
        /// Active Page
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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_Reg_User"] != null && Session["OTP_Reg_User"].ToString() != "")
            {
                int cnt = 0;
                if (Int32.TryParse(Session["OTP_Reg_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;

            if (IsValidInfo())
            {
                //FirstFour.Text = hdnCard1.Value;
                //SecondFour.Text = hdnCard2.Value;
                //ThirdFour.Text = hdnCard3.Value;
                //ForthFour.Text = hdnCard4.Value;
                //string FullCardnumber = hdnCard.Value;

                string FullCardnumber = (FirstFour.Text + SecondFour.Text + ThirdFour.Text + ForthFour.Text).Trim();



                int    ExpiryMonth = Convert.ToInt32(ddlmonth.SelectedItem.Text);
                int    ExpiryYear  = Convert.ToInt32(ddlyear.SelectedItem.Text);
                string DateOfBirth = Convert.ToString(GetDateTime(txtbirthdate.Text));

                //string DateOfBirth = txtbirthdate.Text;
                // Step 1 Find CARD In Oracle Database

                CardManager cm   = new CardManager();
                CH_CardDTO  card = cm.AuthenticateCrNumberDOBForRegis(new CH_CardDTO()
                {
                    card_number = FullCardnumber, EXPIRY_MONTH = ExpiryMonth, EXPIRY_YEAR = ExpiryYear, BIRTH_DATE = Convert.ToDateTime(DateOfBirth)
                });


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

                CardHolderManager Cardholder = new CardHolderManager();
                // CardHolder_MstDTO user = Cardholder.FindUserByCrNumber(FullCardnumber.Encrypt());
                if (card != null)
                {
                    IsUserExists = Cardholder.FindUserByAccountNumber(card.Cr_Account_Nbr.Encrypt());
                }
                else
                {
                    lblStep1Message.Text = Constants.DataNotFoundindb;
                    DivStep1Message.Attributes.CssStyle.Add("display", "block");
                    txtCaptchaFirst.Text = string.Empty;
                    mvNewUserRegistration.ActiveViewIndex = 0;
                    return;
                }


                if (card != null && IsUserExists == false)
                {
                    mvNewUserRegistration.ActiveViewIndex = 1;
                    ViewState["mobile"]         = card.PHONE_MOBILE;
                    ViewState["CARD_NUMBER"]    = card.card_number;
                    ViewState["CR_ACCOUNT_NBR"] = card.Cr_Account_Nbr;
                    ViewState["Email_ID"]       = card.EMAIL_ID;
                    lblhdnfullname.Value        = card.FULL_NAME;

                    //string ImageCaptcha = ImgOTPCaptcha.ClientID; // Request.Form[ImgOTPCaptcha.UniqueID].ToString();
                    //ScriptManager.RegisterStartupScript(this, GetType(), "GenerateCaptcha", "RefreshCaptcha('" + ImageCaptcha + "');", true);
                    // mvNewUserRegistration.ActiveViewIndex = 1;

                    string OtpSuccess = GenerateOTP();
                    if (OtpSuccess != "0" && !string.IsNullOrEmpty(OtpSuccess))
                    {
                        mvNewUserRegistration.ActiveViewIndex = 1;
                        //divremaining.Visible = true;
                        StartOTPTimer();
                    }
                    else
                    {
                        Clearcontrols();
                        LblStep1ErrorMessage.Text = Constants.TechnicalError;
                        DivStep1ERROR.Attributes.CssStyle.Add("display", "block");
                        return;
                    }

                    if (ViewState["mobile"] != null)
                    {
                        string mobilenum    = ViewState["mobile"].ToString();
                        string lastFourdgts = string.Empty;
                        if (mobilenum != "")
                        {
                            int numberkength = mobilenum.Length;
                            if (numberkength > 4)
                            {
                                lastFourdgts = mobilenum.Substring(numberkength - 4, 4);
                            }
                            else
                            {
                                lastFourdgts = mobilenum;
                            }
                        }

                        // mobilenum = mobilenum.Substring(6, 4);
                        //lblOTPdesc.Text = Constants.OTPDesc1;
                        //lblmob.Text = "(i.e. XXXXXX" + lastFourdgts + ")";
                        //lbl3.Text = Constants.OTPDesc2;
                        txtMobileNo.Text = Convert.ToString(ViewState["mobile"]);
                    }
                    //else
                    //{
                    //    lblOTPdesc.Text = Constants.OTPDesc1;
                    //    lblmob.Text = "(i.e. XXXXXXXXXX)";
                    //    lbl3.Text = Constants.OTPDesc2;
                    //}
                }

                else //if (card != null && user != null)
                {
                    lblStep1Message.Text = Constants.AlreadyRegister;
                    DivStep1Message.Attributes.CssStyle.Add("display", "block");
                    Clearcontrols();
                }

                //else
                //{
                //    lblStep1Message.Text = Constants.DataNotFoundindb;
                //    // Clearcontrols();
                //}
            }
        }