void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "size", "top.$get(\"" + uploadResult.ClientID + "\").innerHTML = 'Uploaded size: " + AsyncFileUpload1.FileBytes.Length.ToString() + "';", true); // Uncomment to save to AsyncFileUpload\Uploads folder. // ASP.NET must have the necessary permissions to write to the file system. string extension = Path.GetExtension(AsyncFileUpload1.PostedFile.FileName); string filename = "Applicant-" + applicantID + "-Letter Of Entitlement" + extension; string path = Server.MapPath("/Applicant_Data/applicant-" + applicantID); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (loe != null) { File.Delete(Server.MapPath(loe)); } AsyncFileUpload1.SaveAs(path + "/" + filename); ApplicantReg obj = new ApplicantReg(); obj.ApplicantID = applicantID; obj.saveLOE("Applicant_Data/applicant-" + applicantID + "/" + filename); DataSet dset = obj.retrieveData(applicantID); loadData(dset); //string savePath = MapPath("Uploads/" + Path.GetFileName(e.filename)); //AsyncFileUpload1.SaveAs(savePath); }
protected void Page_Load(object sender, EventArgs e) { if (Session["type"] == null) { Session["noti"] = "Session Timed out"; Response.Redirect("Default.aspx"); } //AsyncFileUpload1.UploaderStyle = AjaxControlToolkit.AsyncFileUpload.UploaderStyleEnum.Modern; AsyncFileUpload1.UploadedComplete += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedComplete); AsyncFileUpload1.UploadedFileError += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedFileError); AsyncFileUploadFard.UploadedComplete += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUploadFard_UploadedComplete); AsyncFileUploadFard.UploadedFileError += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedFileError); AsyncFileUploadAks.UploadedComplete += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUploadAks_UploadedComplete); AsyncFileUploadAks.UploadedFileError += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedFileError); AsyncFileUploadSite.UploadedComplete += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUploadSite_UploadedComplete); AsyncFileUploadSite.UploadedFileError += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedFileError); AsyncFileUploadAffi.UploadedComplete += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUploadAffi_UploadedComplete); AsyncFileUploadAffi.UploadedFileError += new EventHandler <AsyncFileUploadEventArgs>(AsyncFileUpload1_UploadedFileError); if (!IsPostBack) { if (Session["type"] != null && Session["type"].ToString() == "1") { ApplicantReg obj = new ApplicantReg(); obj.Username = Session["unm"].ToString(); DataSet dset = obj.retrieveData(); applicantID = obj.ApplicantID; if (!phase1(obj)) { loadData(dset); } else { Session["appID"] = applicantID; Response.Redirect("ApplicantNOC.aspx"); } } else { Session["noti"] = "Session Timed out"; Response.Redirect("Default.aspx"); } } }
//protected void LinkButtonLetterOfEnt_Click(object sender, EventArgs e) //{ // if (FileUploadLetterOfEnt.HasFile) // { // string extension = Path.GetExtension(FileUploadLetterOfEnt.PostedFile.FileName); // string filename = "Applicant-" + applicantID + "-Letter Of Entitlement" + extension; // string path = Server.MapPath("/Applicant_Data/applicant-" + applicantID); // if (!Directory.Exists(path)) // { // Directory.CreateDirectory(path); // } // if (loe != null) // File.Delete(Server.MapPath(loe)); // FileUploadLetterOfEnt.SaveAs(path + "/" + filename); // ApplicantReg obj = new ApplicantReg(); // obj.ApplicantID = applicantID; // obj.saveLOE("Applicant_Data/applicant-" + applicantID + "/" + filename); // DataSet dset = obj.retrieveData(applicantID); // loadData(dset); // } //} void AsyncFileUploadFard_UploadedComplete(object sender, AsyncFileUploadEventArgs e) { if (AsyncFileUploadFard.HasFile) { string extension = Path.GetExtension(AsyncFileUploadFard.PostedFile.FileName); string filename = "Applicant-" + applicantID + "-Fard" + extension; string path = Server.MapPath("/Applicant_Data/applicant-" + applicantID); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (fard != null) { File.Delete(Server.MapPath(fard)); } AsyncFileUploadFard.SaveAs(path + "/" + filename); ApplicantReg obj = new ApplicantReg(); obj.ApplicantID = applicantID; obj.saveFard("Applicant_Data/applicant-" + applicantID + "/" + filename); DataSet dset = obj.retrieveData(applicantID); loadData(dset); } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { try { ApplicantReg obj = new ApplicantReg(); DataSet dset = obj.retrieveData(applicantID); if (dset.Tables[0].Rows[0]["Affidavit"].ToString().Length > 1 && dset.Tables[0].Rows[0]["Aks_Sajra"].ToString().Length > 1 && dset.Tables[0].Rows[0]["Letter_of_Entitlement"].ToString().Length > 1 && dset.Tables[0].Rows[0]["Site_Plan"].ToString().Length > 1 && dset.Tables[0].Rows[0]["Fard"].ToString().Length > 1) { //string oilCompany = TextBoxOliCompany.Text.Trim(); //string applicantName = TextBoxApplicant_Name.Text.Trim(); //string temp = null; //if (RadioButtonSO.Checked == true) // temp = "S/o"; //else if (RadioButtonWO.Checked == true) // temp = "W/o"; //else // temp = "D/o"; //string swd = temp + " " + TextBoxSWD.Text.Trim(); //string address = TextBoxAddress.Text.Trim(); //string subdivision = DropDownListSubDivision.SelectedItem.ToString(); //string district = DropDownListDistrict.SelectedItem.ToString(); //string loc = TextBoxLOCPetrolPump.Text.Trim(); //ApplicantReg obj = new ApplicantReg(); //string result = obj.saveData(oilCompany, applicantName, swd, address, subdivision, district, loc,applicantID); //if (result == "Exception Occured") // Response.Write("<script>alert(" + result + ")</script>"); //else if (Convert.ToInt32(result) > 0) //{ // result = obj.addAppIDtoNOC_View(applicantID); // if (result.Contains("Occured")) // { // Response.Write("<script>alert(" + result + ")</script>"); // } // else // Response.Redirect("Receipt.aspx?r=" + applicantID); //} //else // Response.Write("<script>alert('error occured!')</script>"); string query = "update Applicant set Complete=1 where Applicant_ID=" + applicantID; dbConnect d = new dbConnect(); string result = d.executeNonQuery(query); if (result.Contains("Occured")) { Response.Write("<script>alert(" + result + ")</script>"); } else if (Convert.ToInt32(result) > 0) { result = obj.addAppIDtoNOC_View(applicantID); if (result.Contains("Occured")) { Response.Write("<script>alert(" + result + ")</script>"); } else { Email em = new Email(); em.SendEmail(Session["unm"].ToString(), "Success", "Dear Applicant, \r\n We have successfully received your application. Your reference number is " + applicantID + " You may submit your application in Suwidha Centre along with all original documents mentioned at the time of registration within one week after the generation of this receipt."); Response.Redirect("Receipt.aspx?r=" + applicantID, false); } } } else { Response.Write("<script>alert(\"Please upload all the documents\")</script>"); } } catch (Exception ex) { writeException obj = new writeException(); obj.WriteExceptionToFile(ex, "Applicant.aspx.cs=ButtonSubmit_Click"); } }