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"); } } } }
protected void btn_send_Click(object sender, EventArgs e) { if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); txt_otp.Text = ""; bl.RegistrationID = Session["REGID"].ToString(); dt = dl.Select_User_detail(bl); if (dt.table.Rows.Count > 0) { bl.OTP = dl.GenOTPString(8); bl.EmailID = dt.table.Rows[0]["EmailID"].ToString(); bl.UserID = dt.table.Rows[0]["UserID"].ToString(); bl.MobileNo = txt_mobile.Text; bl.Type = Session["VERIFICATION_TYPE"].ToString(); bl.UserIP = ul.GetClientIpAddress(this.Page); bl.Sms_detail = "your OTP for Userid " + bl.UserID + " is " + bl.OTP + ". Do Not disclose Your OTP With AnyOne. it is Valid For 10 minutes."; bl.RegistrationID = dt.table.Rows[0]["RegistrationID"].ToString(); bl.EmailID = dt.table.Rows[0]["EmailID"].ToString(); Session.Add("OTP", bl.OTP); rb = dl.InsertOtp(bl); if (rb.status == true) { btn_send.Text = "Resend"; div_otp.Visible = true; Utilities.MessageBox_UpdatePanel(udp, "One Time Password Has Been Sended To Your Mobile Please Varify"); } else { btn_send.Text = "send"; } } else { Response.Redirect("../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 btn_send_Click(object sender, EventArgs e) { if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); txt_otp.Text = ""; bl.RegistrationID = Session["REGID"].ToString(); dt = dl.Select_User_detail(bl); if (dt.table.Rows.Count > 0) { bl.OTP = dl.GenOTPString(8); bl.EmailID = dt.table.Rows[0]["EmailID"].ToString(); bl.UserID = dt.table.Rows[0]["UserID"].ToString(); bl.MobileNo = txt_mobile.Text; bl.Type = Session["VERIFICATION_TYPE"].ToString(); bl.UserIP = ul.GetClientIpAddress(this.Page); bl.Sms_detail = "your OTP for Userid " + bl.UserID + " is " + bl.OTP + ". Do Not disclose Your OTP With AnyOne. it is Valid For 10 minutes."; bl.RegistrationID = dt.table.Rows[0]["RegistrationID"].ToString(); bl.EmailID = dt.table.Rows[0]["EmailID"].ToString(); Session.Add("OTP", bl.OTP); rb = dl.InsertOtp(bl); if (rb.status == true) { div_otp.Visible = true; // Email sending Code Added By Naveen on 09-oct-2017 Start // The below code for sending email is working need to give the from account mail id and password /* * string fromMail = "From gmail ID here"; * string fromPass = "******"; * using (MailMessage mm = new MailMessage(fromMail, bl.EmailID)) * { * mm.Subject = "Registration OTP"; * mm.Body = bl.Sms_detail; * mm.IsBodyHtml = false; * SmtpClient smtp = new SmtpClient(); * smtp.Host = "smtp.gmail.com"; * smtp.EnableSsl = true; * NetworkCredential NetworkCred = new NetworkCredential(fromMail, fromPass); * smtp.UseDefaultCredentials = true; * smtp.Credentials = NetworkCred; * smtp.Port = 587; * smtp.Send(mm); * } */ // Email sending Code Added By Naveen on 09-oct-2017 end string str_msg = ""; if (Session["language"].ToString() == "en-GB") { btn_send.Text = "Resend"; str_msg = "One Time Password Has Been Sended To Your Mobile Please Verify"; } else { btn_send.Text = "फिर से भेजें"; str_msg = "आपका वन टाइम पासवर्ड आपके मोबाईल न. पर भेज दिया गया है|कृपया जाँच कर लें| "; } Utilities.MessageBox_UpdatePanel(udp, str_msg); } else { if (Session["language"].ToString() == "en-GB") { btn_send.Text = "send"; } else { btn_send.Text = "भेजें"; } // btn_send.Text = "send"; } } else { Response.Redirect("../LogOut.aspx"); } } }