}//end of Insert_rti_filed_user public ReturnClass.ReturnBool Insert_RTI_files(bl_RTI_RequestFiles ur) { string strQuery = "INSERT INTO rti_files " + "( rti_fileID, fileName, fileType, fileData, FileDescription, rti_id, BPL_RTI_FileType ) " + " VALUES (@rti_fileID, @fileName, @fileType, @fileData,@FileDescription, @rti_requestID,@bpl_rti_FileType )"; MySqlParameter[] pm = new MySqlParameter[] { new MySqlParameter("rti_fileID", ur.RTI_fileID), new MySqlParameter("fileName", ur.RTI_fileName), new MySqlParameter("fileType", ur.RTI_fileType), new MySqlParameter("fileData", ur.RTI_fileData), new MySqlParameter("FileDescription", ur.FileDescription), new MySqlParameter("rti_requestID", ur.RTI_Request_id), new MySqlParameter("bpl_rti_FileType", ur.BPL_RTI_FileType) }; ReturnClass.ReturnBool dt = null; db_maria_connection objDB = new db_maria_connection(); dt = objDB.executeInsertQuery(strQuery, pm); return(dt); }//end of Insert_RTI_files
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
public ReturnClass.ReturnBool insert_ofc_new(bl_Dio bl, bl_RTI_RequestFiles blr) { using (TransactionScope ts = new TransactionScope()) { string str = @"insert into office_req(office_id,filename,file_type,file_data, ipaddress,user_agent,user_system,user_browser,approved_by_user_id) values(@office_id,@filename,@file_type,@file_data,@ipaddress, @user_agent,@user_system,@user_browser,@approved_by_user_id)"; MySqlParameter[] pm = new MySqlParameter[] { new MySqlParameter("office_id", bl.Officeid), new MySqlParameter("filename", blr.RTI_fileName), new MySqlParameter("file_type", blr.RTI_fileType), new MySqlParameter("file_data", blr.RTI_fileData), new MySqlParameter("ipaddress", bl.Ipaddress), new MySqlParameter("user_agent", bl.Useragent), new MySqlParameter("user_system", bl.Clientos), new MySqlParameter("user_browser", bl.Client_browser), new MySqlParameter("approved_by_user_id", bl.Userid) }; rb = db.executeInsertQuery(str, pm); if (rb.status == true) { string str1 = @"insert into office(NewOfficeCode,OfficeName,DistrictCodeNew,BaseDeptCode, OfficeLevel,OfficeCategory,CountryCode,StateCode,OfficeAddress,ContactNo,Fax,Email,OfficeURL,Status) values(@NewOfficeCode,@OfficeName,@DistrictCodeNew,@BaseDeptCode,@OfficeLevel,@OfficeCategory,@CountryCode ,@StateCode,@OfficeAddress,@ContactNo,@Fax,@Email,@OfficeURL,@isvalid)"; MySqlParameter[] pm1 = new MySqlParameter[] { new MySqlParameter("NewOfficeCode", bl.Officeid), new MySqlParameter("OfficeName", bl.Office), new MySqlParameter("DistrictCodeNew", bl.District), new MySqlParameter("BaseDeptCode", bl.Base_department), new MySqlParameter("OfficeLevel", bl.Officelvl), new MySqlParameter("OfficeCategory", bl.Category), new MySqlParameter("CountryCode", bl.Country), new MySqlParameter("StateCode", bl.State), new MySqlParameter("OfficeAddress", bl.Address), new MySqlParameter("ContactNo", bl.Contact), new MySqlParameter("Fax", bl.Fax), new MySqlParameter("Email", bl.Email), new MySqlParameter("OfficeURL", bl.Url), new MySqlParameter("isvalid", bl.Active) }; rb = db.executeInsertQuery(str1, pm1); if (rb.status == true) { string temp = @"insert into office_temp(NewOfficeCode,OfficeName,DistrictCodeNew,BaseDeptCode, OfficeLevel,OfficeCategory,CountryCode,StateCode,OfficeAddress,ContactNo,Fax,Email,OfficeURL,isvalid,userid,useragent,user_os,User_browser,Ip_address) values(@NewOfficeCode,@OfficeName,@DistrictCodeNew,@BaseDeptCode,@OfficeLevel,@OfficeCategory,@CountryCode ,@StateCode,@OfficeAddress,@ContactNo,@Fax,@Email,@OfficeURL,@isvalid,@userid,@useragent,@user_os,@User_browser,@Ip_address)"; MySqlParameter[] pm2 = new MySqlParameter[] { new MySqlParameter("NewOfficeCode", bl.Officeid), new MySqlParameter("OfficeName", bl.Office), new MySqlParameter("DistrictCodeNew", bl.District), new MySqlParameter("BaseDeptCode", bl.Base_department), new MySqlParameter("OfficeLevel", bl.Officelvl), new MySqlParameter("OfficeCategory", bl.Category), new MySqlParameter("CountryCode", bl.Country), new MySqlParameter("StateCode", bl.State), new MySqlParameter("OfficeAddress", bl.Address), new MySqlParameter("ContactNo", bl.Contact), new MySqlParameter("Fax", bl.Fax), new MySqlParameter("Email", bl.Email), new MySqlParameter("OfficeURL", bl.Url), new MySqlParameter("isvalid", bl.Active), new MySqlParameter("userid", bl.Userid), new MySqlParameter("useragent", bl.Useragent), new MySqlParameter("user_os", bl.Clientos), new MySqlParameter("User_browser", bl.Client_browser), new MySqlParameter("Ip_address", bl.Ipaddress) }; rb = db.executeInsertQuery(temp, pm2); } if (rb.status) { ts.Complete(); } } } return(rb); }