protected void lnkbtn_otp_Click(object sender, EventArgs e)
 {
     if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
     {
         Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
         if (Page.IsValid)
         {
             txt_otp.Text = "";
             bl.UserID    = txt_username.Text;
             dt           = dl.Select_user_detail(bl);
             if (dt.table.Rows.Count > 0)
             {
                 Session["user"]    = bl.UserID;
                 bl1.RegistrationID = dt.table.Rows[0]["RegistrationID"].ToString();
                 dt = dl1.Select_User_detail(bl1);
                 if (dt.table.Rows.Count > 0)
                 {
                     bl1.OTP            = dl1.GenOTPString(8);
                     bl1.EmailID        = dt.table.Rows[0]["EmailID"].ToString();
                     bl1.UserID         = dt.table.Rows[0]["UserID"].ToString();
                     bl1.MobileNo       = dt.table.Rows[0]["MobileNo"].ToString();
                     bl1.Type           = "Password Forget";
                     bl1.UserIP         = ul.GetClientIpAddress(this.Page);
                     bl1.Sms_detail     = "your OTP for Userid " + bl.UserID + " is " + bl1.OTP + ". Do Not disclose Your OTP With AnyOne. it is Valid For 10 minutes.";
                     bl1.RegistrationID = dt.table.Rows[0]["RegistrationID"].ToString();
                     bl1.EmailID        = dt.table.Rows[0]["EmailID"].ToString();
                     Session.Add("OTP", bl1.OTP);
                     rb = dl1.InsertOtp(bl1);
                     if (rb.status == true)
                     {
                         div1.Visible = true;
                         div2.Visible = false;
                     }
                 }
                 else
                 {
                     Utilities.MessageBoxShow_Redirect("You Are Not Registered User ", "../Login.aspx");
                 }
             }
             else
             {
                 Utilities.MessageBoxShow_Redirect("user id Not Recognised Please Create new ID ", "../Login.aspx");
             }
         }
     }
 }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
            try
            {
                if (Session["username"].ToString() != null)
                {
                    bl.UserID = Session["username"].ToString();
                    dt        = dl.CheckUserID(bl);
                    if (dt.table.Rows.Count == 0)
                    {
                        bl.RegistrationID = Session["REGID"].ToString();
                        dt = dl.Select_User_detail(bl);
                        if (dt.table.Rows.Count > 0)
                        {
                            bl.MobileNo = dt.table.Rows[0]["MobileNo"].ToString();
                            bl.UserID   = dt.table.Rows[0]["UserID"].ToString();
                            Session["VERIFICATION_TYPE"] = "User";
                        }
                    }
                    else if (dt.table.Rows.Count > 0)
                    {
                        if (Session["VERIFICATION_TYPE"].ToString() == "Rti")  // For Rti
                        {
                            bl.RegistrationID     = dt.table.Rows[0]["LoginID"].ToString();
                            Session["REGID"]      = bl.RegistrationID;
                            bl_rti.RTI_Request_id = Session["RTI_ID"].ToString();
                            dt = dl_rti.GetMobileNumForVerification(bl_rti);
                            if (dt.table.Rows.Count > 0)
                            {
                                bl.MobileNo = dt.table.Rows[0]["Mobile_No"].ToString();
                                bl.UserID   = dt.table.Rows[0]["User_ID"].ToString();
                            }
                        }
                        else
                        {
                            bl.RegistrationID = dt.table.Rows[0]["LoginID"].ToString();
                            Session["REGID"]  = bl.RegistrationID;
                            dt = dl.Select_User_detail(bl);
                            if (dt.table.Rows.Count > 0)
                            {
                                bl.MobileNo = dt.table.Rows[0]["MobileNo"].ToString();
                                bl.UserID   = dt.table.Rows[0]["UserID"].ToString();
                            }
                        } // VERIFICATION_TYPE ==User
                    }
                }
                else
                {
                    Response.Redirect("../LogOut.aspx");
                }
            }
            catch (NullReferenceException ex)
            {
                Response.Redirect("../LogOut.aspx");
            }
            txt_mobile.Text = bl.MobileNo;

            ////btn_send.Text = "Send";  // moved this line to pre_render event
        }
    }