protected void forgot_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                if (Session["CheckRefresh"] != null)
                {
                    if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
                    {
                        Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());

                        bool cptch_expired = false;
                        try
                        {
                            Captcha1.ValidateCaptcha(txt_captcha.Text.Trim());
                        }
                        catch { cptch_expired = true; }
                        txt_captcha.Text = "";

                        if (!cptch_expired)
                        {
                            if (Captcha1.UserValidated)
                            {
                                Captcha1.DataBind();
                                bl.Cell_No  = txt_login.Text.Trim();
                                bl.Verified = "Y";
                                dt          = dl.user_login_details_for_forgot_password(bl);
                                if (dt.table.Rows.Count > 0)
                                {
                                    Session["Mobile_No"]    = bl.Cell_No;
                                    Session["Reset_Method"] = "Y";
                                    Random randomclass = new Random();
                                    Int32  rno1        = randomclass.Next(1000000, 9999999);
                                    string random      = Convert.ToString(rno1);
                                    string rno         = random.ToString();
                                    bl.Success = send_sms(rno, bl.Cell_No);
                                    rb         = dl.sms_log(bl);

                                    Utilities.MessageBox_UpdatePanel_Redirect(UpdatePanel2, "OTP has been sent to Your Mobile Number", "OtpVerification_Reg.aspx");
                                }
                                else
                                {
                                    Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Please check your mobile number.");
                                }
                            }
                            else
                            {
                                Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Invalid Captcha!!! Please enter same characters as you see in image.");
                            }
                        }
                        else
                        {
                            Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Captcha Expired!!! Please re open this page in new window.");
                        }
                    }
                    else
                    {
                        Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Page Refresh or Back button is now allowed");
                    }
                }
                else
                {
                    Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Page expired!!! Please re open this page in new window.");
                }
            }
            catch (NullReferenceException)
            {
                Utilities.MessageBox_UpdatePanel_Redirect(UpdatePanel2, "Your Session Has Expired Please Login Again", "../Logout.aspx");
            }
        }
    }
    protected void btn_Submit_Click1(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
            {
                Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
                bool cptch_expired = false;
                try
                {
                    Captcha1.ValidateCaptcha(txtCaptcha.Text.Trim());
                }
                catch { cptch_expired = true; }
                txtCaptcha.Text = "";
                if (!cptch_expired)
                {
                    if (Captcha1.UserValidated)
                    {
                        Captcha1.DataBind();
                        dl_RTI_Registration dl    = new dl_RTI_Registration();
                        bl_RTI_Request      objBL = new bl_RTI_Request();
                        dl_RTI_Request      objDl = new dl_RTI_Request();
                        // set data for rti_request
                        objBL.RTI_Request_id = objDl.Get_unique_RtiRequest_code(); //"<NTC>RTI Request ID from DL";//objDl.GetMaxValue("SELECT IFNULL(MAX(rti_request_id),0) as NO FROM rti_detail ");
                        objBL.UserType       = ddl_usertype.SelectedItem.Value;
                        objBL.NameEnglish    = txtName.Text;
                        objBL.Gender         = DDL_Gender.SelectedItem.Value;
                        objBL.Email          = txtEmailID.Text;
                        objBL.Address        = txtAddress.Text;
                        objBL.Country        = ddl_country.SelectedItem.Value;
                        objBL.Securitycode   = dl.GenOTPString(4);
                        HttpBrowserCapabilities browse = Request.Browser;
                        objBL.UserAgent       = Request.UserAgent.ToString();
                        objBL.Client_os       = Utilities.System_Info(this.Page);
                        objBL.ClientBrowser   = browse.Browser;
                        objBL.IsRTIFileUpload = "N";
                        objBL.IsNew           = "Y";
                        if (objBL.Country == "091")
                        {
                            objBL.State       = DDL_State.SelectedItem.Value;
                            objBL.District    = ddl_district.SelectedItem.Value;
                            objBL.CountryName = null;
                        }
                        else
                        {
                            objBL.CountryName = txtState_Other.Text;
                        }
                        objBL.Pincode            = txtPinCode.Text;
                        objBL.Mobile             = txtMobile.Text;
                        objBL.Rti_Subject        = txt_subject.Text;
                        objBL.RTI_Text           = txt_RequestApplicationText.Text;
                        objBL.RTI_login_userName = userID;
                        //objBL.RTI_request_date = DateTime.Now.ToString("yyyy-MM-dd");
                        Utilities util = new Utilities();
                        objBL.RTI_ipaddress = util.GetClientIpAddress(this.Page);//GetIPAddress();
                        objBL.RTI_Is_bpl    = DDL_BPL.SelectedItem.Value;
                        # region check for BPL
                        if (objBL.RTI_Is_bpl == "Y")
                        {
                            if (FU_BPL.PostedFile == null || FU_BPL.PostedFile.ContentLength < 1)
                            {
                                Utilities.MessageBox_UpdatePanel(update1, "Attach one BPL Supporting Document ");
                                return;
                            }
                            objBL.BPL_Card_No = txtBPLNo.Text;
                            int Current_year = Convert.ToInt32(DateTime.Now.Year);
                            int find_year    = Convert.ToInt32(txtYearOfIssue.Text);

                            if (find_year > Current_year)
                            {
                                // Utilities.MessageBoxShow("Year should not be greater then current year");
                                Utilities.MessageBox_UpdatePanel(update1, "Year should not be greater then current year ");
                                return;
                            }
                            else
                            {
                                objBL.BPL_Issue_Year = txtYearOfIssue.Text;
                            }
                            objBL.BPL_Issuing_Authority = txtIssuingAuthority.Text;
                            //objBL.RTI_Fees = "0";
                        }

                        else
                        {
                            //objBL.RTI_Fees = "10";
                        }
                        #endregion BPL
                        // set data for rti_filed_user
                        // objBL.RTI_filed_user_id = objDl.GetMaxValueRtiFiledUser();//"<NTC>RTI Filed user ID from DL"; //objDl.GetMaxValue("SELECT IFNULL(MAX(rti_FiledUserID),0) as NO FROM rti_filed_user ");
                        # region file submit problem is generating here
                        objBL.RTI_filed_user_id = objBL.RTI_Request_id;
                        objBL.Rti_Status        = "REG"; //Initial status of RTI Filed
                        objBL.Action_id         = "";
                        objBL.IsValid           = "N";
                        objBL.Office_mapping_id = DDL_RTI_Officer.SelectedValue;
                        objBL.Action_date       = DateTime.Now.ToString("yyyy-MM-dd"); // Need to ask
                        //objBL.Rti_Status = "registered"; // initial status
                        //set data for rti_file
                        string RTI_fileID = objDl.GetMaxValueRtiFiles();// "<NTC> file iD";//objDl.GetMaxValue("SELECT IFNULL(MAX(rti_fileID),0) as NO FROM rti_files ");

                        List <bl_RTI_RequestFiles> objList = new List <bl_RTI_RequestFiles>();

                        int maxCountFileID = Convert.ToInt32(RTI_fileID);
                        if (FU_BPL.PostedFile != null && FU_BPL.PostedFile.FileName != "")
                        {
                            if (FU_BPL.PostedFile.ContentLength > 0)
                            {
                                bl_RTI_RequestFiles objBLFile  = new bl_RTI_RequestFiles();
                                HttpPostedFile      postedFile = FU_BPL.PostedFile;

                                objBLFile.FileDescription  = txt_FU_BPL_Disc.Text;
                                objBLFile.RTI_fileID       = maxCountFileID.ToString();
                                objBLFile.RTI_fileName     = Path.GetFileName(postedFile.FileName);
                                objBLFile.RTI_fileType     = postedFile.ContentType;
                                objBLFile.BPL_RTI_FileType = "BPL_DOC";  // it is a BPL Supporting Document
                                objBLFile.RTI_Request_id   = objBL.RTI_Request_id;
                                Stream fs = postedFile.InputStream;

                                if ((objBLFile.RTI_fileType == "application/pdf" || objBLFile.RTI_fileType == "application/x-pdf" || objBLFile.RTI_fileType == "application/x-unknown") && fs.Length < 2097152)
                                {
                                    BinaryReader br    = new BinaryReader(fs);
                                    byte[]       bytes = br.ReadBytes((Int32)fs.Length);
                                    objBLFile.RTI_fileData = bytes;
                                    maxCountFileID         = maxCountFileID + 1;
                                    objList.Add(objBLFile);   // Add into the list
                                }
                                else
                                {
                                    //statusCount = 1;
                                    // Utilities.MessageBoxShow("Only Image File and less then 1000 KB is accepted");
                                    //lbl_status.Text = " Only Image File and less then 1000 KB is accepted ";
                                    Utilities.MessageBox_UpdatePanel(update1, " Only PDF File and less then 2000 KB is accepted for BPL File");
                                    return;
                                }
                            }
                            else
                            {
                                Utilities.MessageBox_UpdatePanel(update1, " BPL File Size Must be great then Zero");
                                return;
                            }
                        }
                        // RTI File Insert in data base
                        if (FU_RTI.PostedFile != null && FU_RTI.PostedFile.FileName != "")
                        {
                            if (FU_RTI.PostedFile.ContentLength > 0)
                            {
                                bl_RTI_RequestFiles objBLFile  = new bl_RTI_RequestFiles();
                                HttpPostedFile      postedFile = FU_RTI.PostedFile;

                                objBLFile.FileDescription  = txt_FU_RTI_Disc.Text;
                                objBLFile.RTI_fileID       = maxCountFileID.ToString();
                                objBLFile.RTI_fileName     = Path.GetFileName(postedFile.FileName);
                                objBLFile.RTI_fileType     = postedFile.ContentType;
                                objBLFile.BPL_RTI_FileType = "RTI_DOC";    // it is RTI Document
                                objBLFile.RTI_Request_id   = objBL.RTI_Request_id;
                                Stream fs = postedFile.InputStream;

                                if ((objBLFile.RTI_fileType == "application/pdf" || objBLFile.RTI_fileType == "application/x-pdf" || objBLFile.RTI_fileType == "application/x-unknown") && fs.Length < 2097152)
                                {
                                    BinaryReader br    = new BinaryReader(fs);
                                    byte[]       bytes = br.ReadBytes((Int32)fs.Length);
                                    objBLFile.RTI_fileData = bytes;
                                    maxCountFileID         = maxCountFileID + 1;
                                    objList.Add(objBLFile);   // Add into the list
                                }
                                else
                                {
                                    //statusCount = 1;
                                    // Utilities.MessageBoxShow("Only Image File and less then 1000 KB is accepted");
                                    //lbl_status.Text = " Only Image File and less then 1000 KB is accepted ";
                                    Utilities.MessageBox_UpdatePanel(update1, " Only PDF File and less then 2000 KB is accepted for RTI File");
                                    return;
                                }
                            }

                            else
                            {
                                Utilities.MessageBox_UpdatePanel(update1, "RTI File Size Must be greater then Zero");
                                return;
                            }
                            objBL.IsRTIFileUpload = "Y";
                        }
                        #endregion
                        if (objBL.Mobile == H_LoginMobileNo.Value)
                        {
                            objBL.IsValid = "Y";
                        }

                        ReturnClass.ReturnBool dt = objDl.Insert_RTI_Info(objBL, objList);
                        if (dt.status == true)
                        {
                            if (objBL.Mobile == H_LoginMobileNo.Value)
                            {      // Directly go to success page No Need OTP
                                string rti_message = "RTI Submition successfull your Registration no. is: " + objBL.RTI_Request_id + "  And  Your Security Code is:  " + objBL.Securitycode + "   please save  details for further Information.";
                                Utilities.MessageBox_UpdatePanel_Redirect(update1, rti_message, "./UserWelcome.aspx");
                            }
                            else
                            {
                                Session["RTI_ID"]            = objBL.RTI_Request_id;
                                Session["VERIFICATION_TYPE"] = "Rti";

                                Utilities.MessageBox_UpdatePanel_Redirect(update1, "Your RTI Request has been submited Need Mobile Verification for Registeration", "./User_Mobile_Varification.aspx");
                            }
                        }
                        else
                        {
                            Utilities.MessageBox_UpdatePanel(update1, "RTI Submition Failed");
                        }
                    }//end of captcha1 validated
                    else
                    {
                        Utilities.MessageBox_UpdatePanel(update1, "Incorrect Security Code");
                    }
                } // If ! captch expired
            }     // End of If checkRefresh
    protected void Signup_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                if (ChkContent.Checked)
                {
                    if (Session["CheckRefresh"] != null)
                    {
                        if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
                        {
                            Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
                            Captcha1.ValidateCaptcha(txt_captcha.Text.Trim());
                            txt_captcha.Text = "";
                            if (Captcha1.UserValidated)
                            {
                                Captcha1.DataBind();
                                bl.Name                      = txt_first_Name.Text.Trim();
                                bl.Last_name                 = txt_last_Name.Text.Trim();
                                bl.Cell_No                   = Mobile.Text.Trim();
                                bl.Email                     = Email.Text.Trim();
                                bl.Password_Plain            = Password.Text.Trim();
                                bl.Password                  = bl.Password_Plain;
                                bl.Applicant_active          = "N";
                                bl.Applicant_mobile_verified = "N";
                                bl.Applicant_email_verified  = "N";
                                bl.Action_Date               = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                                bl.ClientIp                  = util.GetClientIpAddress(this.Page);
                                bl.User_type                 = user_type.SelectedValue;
                                //   bl.Country_code = ddl_code.SelectedValue;
                                bl.Classes      = ddl_class.SelectedValue;
                                bl.Stream       = ddl_stream.SelectedValue;
                                bl.Country_code = "91";
                                if (bl.User_type == "USER")
                                {
                                    bl.Role_Id = "01";
                                }
                                else if (bl.User_type == "TEA")
                                {
                                    bl.Role_Id = "02";
                                }
                                //if (Request.QueryString["reco"] != null)
                                //{
                                //    string uid = util.Encrypt_AES(Request.QueryString["reco"].ToString(), key);
                                //    //   bl.Refer_code = Request.QueryString["reco"].ToString();
                                //    bl.Refer_code = uid;
                                //}
                                //else
                                //{
                                bl.Refer_code = DBNull.Value.ToString();
                                //}
                                Session["User_type"] = bl.User_type;
                                rb = dl.Insert_user_signup(bl);
                                if (rb.status)
                                {
                                    Session["Mobile_No"] = bl.Cell_No;
                                    Random randomclass = new Random();
                                    Int32  rno1        = randomclass.Next(1000000, 9999999);
                                    string random      = Convert.ToString(rno1);
                                    string rno         = random.ToString();
                                    Session["OTP"] = rno;
                                    //Thread Stamp_Action = new Thread(delegate ()
                                    //{
                                    //    bl.Success = send_sms(rno, bl.Cell_No);
                                    //    rb = dl.sms_log(bl);
                                    //    bl.Type = null;
                                    //    bl.Success = email_to_user(rno, bl.Email);
                                    //    rb = dl.sms_log(bl);
                                    //});
                                    //Stamp_Action.IsBackground = true;
                                    //Stamp_Action.Start();

                                    Utilities.MessageBox_UpdatePanel_Redirect(UpdatePanel2, "Please verify your number with otp to complete the registration process " + rno, "otp_verification.aspx");
                                }
                                else
                                {
                                    Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Records could not be saved: Please Try Again");
                                }
                            }
                            else
                            {
                                Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Invalid Captcha!!! Please enter same characters as you see in image.");
                            }
                        }
                        else
                        {
                            Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Page Refresh or Back button is now allowed");
                        }
                    }
                    else
                    {
                        Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Page expired!!! Please re open this page in new window.");
                    }
                }
                else
                {
                    Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Please check I agree to terms ");
                }
            }
            catch (NullReferenceException)
            {
                Utilities.MessageBox_UpdatePanel_Redirect(UpdatePanel2, "Your Session Has Expired Please Login Again", "../Logout.aspx");
            }
        }
        //else
        //{
        //    //   Utilities.MessageBox_UpdatePanel(UpdatePanel2, "( *  ) Indicates  Mandatory Fields, Please Fill");
        //}
    }
Esempio n. 4
0
    protected void Login_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                if (Session["CheckRefresh"] != null)
                {
                    if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
                    {
                        Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
                        if (Session["rno"] == null)
                        {
                            Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Page has expired!!! Please open this page in a new window..");
                        }
                        else
                        {
                            bool cptch_expired = false;
                            try
                            {
                                Captcha1.ValidateCaptcha(txt_captcha.Text.Trim());
                            }
                            catch { cptch_expired = true; }
                            txt_captcha.Text = "";

                            if (!cptch_expired)
                            {
                                if (Captcha1.UserValidated)
                                {
                                    Captcha1.DataBind();
                                    if (!check_user())
                                    {
                                        Utilities.MessageBoxShow("Invaild User Id and Password..");
                                        fn_logintrail(false);
                                    }
                                    else
                                    {
                                        if (ChkContent.Checked == true)
                                        {
                                            Response.Cookies["useridd"].Value   = txt_login.Text.Trim();
                                            Response.Cookies["pwd"].Value       = Password.Text.Trim();
                                            Response.Cookies["useridd"].Expires = DateTime.Now.AddDays(365);
                                            Response.Cookies["pwd"].Expires     = DateTime.Now.AddDays(365);
                                        }
                                        else
                                        {
                                            Response.Cookies["useridd"].Expires = DateTime.Now.AddDays(-1);
                                            Response.Cookies["pwd"].Expires     = DateTime.Now.AddDays(-1);
                                        }
                                        fn_logintrail(true);
                                        FormsAuthentication.Initialize();
                                        String strRole = role_id;
                                        FormsAuthenticationTicket tkt = new FormsAuthenticationTicket(1, txt_login.Text, DateTime.Now, DateTime.Now.AddMinutes(30), false, strRole, FormsAuthentication.FormsCookiePath);
                                        Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(tkt)));
                                        if (Session["Default_page"] != null)
                                        {
                                            string str    = Session["Default_page"].ToString();
                                            string newstr = str.Replace(".aspx", "");
                                            // Response.Redirect(Session["Default_page"].ToString(), false);
                                            Response.Redirect(newstr, false);
                                        }
                                        else
                                        {
                                            //  Response.Redirect("User/DashBoard.aspx", false);
                                        }
                                    }
                                }
                                else
                                {
                                    Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Invalid Captcha!!! Please enter same characters as you see in image.");
                                }
                            }
                            else
                            {
                                Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Captcha Expired!!! Please re open this page in new window.");
                            }
                        }
                    }
                    else
                    {
                        Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Page Refresh or Back button is now allowed");
                    }
                }
                else
                {
                    Utilities.MessageBox_UpdatePanel(UpdatePanel2, "Page expired!!! Please re open this page in new window.");
                }
            }
            catch (NullReferenceException)
            {
                //  Utilities.MessageBox_UpdatePanel_Redirect(UpdatePanel2, "Your Session Has Expired Please Login Again", "../Logout.aspx");
                Response.Redirect("login.aspx");
            }
        }
    }