protected void Button1_Click(object sender, EventArgs e) { if (FileUpLoad1.HasFile) { string filePath = @"C:\temp\" + FileUpLoad1.FileName; FileUpLoad1.SaveAs(@"C:\temp\" + FileUpLoad1.FileName); Label1.Text = "File Uploaded: " + FileUpLoad1.FileName; try { SqlConnection con = new SqlConnection(strcon); if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("INSERT INTO files(file_title, file_path) values(@file_title,@file_path)", con); cmd.Parameters.AddWithValue("@file_title", TextBox1.Text.Trim()); cmd.Parameters.AddWithValue("@file_path", filePath); cmd.ExecuteNonQuery(); con.Close(); Page.ClientScript.RegisterStartupScript(this.GetType(), "toastr_message", "toastr.success('File added Successfully')", true); //Response.Write("<script>alert('Coordinator added Successfully');</script>"); } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } } else { Label1.Text = "No File Uploaded."; } }
protected void Button1_Click(object sender, EventArgs e) { if (FileUpLoad1.HasFile) { string ext = Path.GetExtension(FileUpLoad1.FileName); string name = Session["username"].ToString() + DropDownList2.SelectedItem.Value + ext; string filePath = @"C:\temp\School\" + name; FileUpLoad1.SaveAs(@"C:\temp\School\" + name); //string filePath = @"C:\temp\" + FileUpLoad1.FileName; //FileUpLoad1.SaveAs(@"C:\temp\" + FileUpLoad1.FileName); //Label1.Text = "File Uploaded: " + FileUpLoad1.FileName; Page.ClientScript.RegisterStartupScript(this.GetType(), "toastr_message", "toastr.success('File Uploaded')", true); try { SqlConnection con = new SqlConnection(strcon); if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("INSERT INTO school_document_master_tbl(learner_username,learner_fullname, institute_name,standard,status,coordinator_id,document_path) values(@learner_username,@learner_fullname,@institute_name,@standard,@status,@coordinator_id,@document_path)", con); cmd.Parameters.AddWithValue("@learner_username", TextBox1.Text.Trim()); cmd.Parameters.AddWithValue("@learner_fullname", Session["fullname"].ToString()); cmd.Parameters.AddWithValue("@institute_name", DropDownList1.SelectedItem.Value); cmd.Parameters.AddWithValue("@standard", DropDownList2.SelectedItem.Value); cmd.Parameters.AddWithValue("@status", "Pending"); cmd.Parameters.AddWithValue("@coordinator_id", Session["coordinator_id"].ToString()); cmd.Parameters.AddWithValue("@document_path", filePath); cmd.ExecuteNonQuery(); con.Close(); Page.ClientScript.RegisterStartupScript(this.GetType(), "toastr_message", "toastr.success('File added Successfully')", true); //Response.Write("<script>alert('Coordinator added Successfully');</script>"); } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "');</script>"); } } else { //Label1.Text = "No File Uploaded."; Page.ClientScript.RegisterStartupScript(this.GetType(), "toastr_message", "toastr.error('No File Uploaded')", true); } FileUpLoadValidator.IsValid = true; HtmlMeta oScript = new HtmlMeta(); oScript.Attributes.Add("http-equiv", "REFRESH"); oScript.Attributes.Add("content", "5; url='https://localhost:44312/schoolupload.aspx'"); Page.Header.Controls.Add(oScript); }
private void UploadImageFile(string parImageFilename) { const string PATH_TO_IMAGES_FOLDER = "~/Images/"; //Build path and filename string string pathToSavedFile = Server.MapPath(PATH_TO_IMAGES_FOLDER) + parImageFilename; //Upload chosen file FileUpLoad1.SaveAs(pathToSavedFile); Trace.Warn("Inside UploadImageFile", "File Uploaded Sucessfully!!!"); }
protected void UploadBtn_Click(object sender, EventArgs e) { if (FileUpLoad1.HasFile) { FileUpLoad1.SaveAs(@"C:\temp\" + FileUpLoad1.FileName); Label1.Text = "File Uploaded: " + FileUpLoad1.FileName; readEmail(); formTable(); } else { Label1.Text = "No File Uploaded."; } }
protected void LinkButton1_Click(object sender, EventArgs e) { string fname = ddlpgm.SelectedItem.Text; string pgm = txtpgm.Text; string id = ddlpgm.SelectedItem.Value; //string lng=txtlng.Text; string rdate = txtrdate.Text; //string ln = txtleng.Text; string hour = ddlhour.SelectedItem.Text; string min = ddlmin.SelectedItem.Text; string sec = ddlsec.SelectedItem.Text; string time = hour + ":" + min + ":" + sec; string fPath = ""; int st = 0; string fp = DateTime.Now.Ticks.ToString() + System.IO.Path.GetExtension(FileUpLoad1.FileName); if (FileUpLoad1.HasFile) { st = 1; fPath = "video/" + fp; FileUpLoad1.SaveAs(Server.MapPath("~/video/" + fp)); lblmsg.Text = "File Uploaded: " + FileUpLoad1.FileName; } else { lblmsg.Text = "No File Uploaded."; } if (st == 1) { qry = "insert into fun values(null,'" + fname + "','" + pgm + "','" + id + "','" + time + "','" + fPath + "','" + rdate + "')"; obj = new ForController(); obj.controllerNonQuery(qry); lblmsg.Text = "Sucessfully uploaded..."; } txtpgm.Text = ""; txtrdate.Text = ""; ddlpgm.SelectedIndex = -1; ddlhour.SelectedIndex = -1; ddlmin.SelectedIndex = -1; ddlsec.SelectedIndex = -1; }
protected void Button1_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } else { if (FileUpLoad1.HasFile) { //save file with row_id prefix Session["Filename"] = FileUpLoad1.FileName; FileUpLoad1.SaveAs("c:\\Resume\\" + FileUpLoad1.FileName); } if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); isSubmit = true; Server.Transfer("ReferralbonusSubmit.aspx?submit=no", true); } else { isSubmit = false; Server.Transfer("ReferralbonusSubmit.aspx?submit=yes", true); } } /* * if (!Page.IsValid) * { * return; * } * else * { * if (FileUpLoad1.HasFile) * { * //save file with row_id prefix * Session["Filename"] = FileUpLoad1.FileName; * FileUpLoad1.SaveAs("c:\\Resume\\" + FileUpLoad1.FileName); * } * Session["RequestValue"] = Guid.NewGuid(); * Server.Transfer("ReferralbonusSubmit.aspx?Request=" + Session["RequestValue"], true); * }*/ }
protected void btn_upload_Click(object sender, EventArgs e) { if (FileUpLoad1.HasFile) { string fileName = FileUpLoad1.FileName; string Ruta1; Ruta1 = Server.MapPath(ConfigurationManager.AppSettings["conductores_yms"]); if (!System.IO.Directory.Exists(Ruta1)) { System.IO.Directory.CreateDirectory(Ruta1); } if (Path.GetExtension(FileUpLoad1.FileName) == ".png" || Path.GetExtension(FileUpLoad1.FileName) == ".jpg") { ConductorBC c = new ConductorBC(); c = c.ObtenerXId(Convert.ToInt32(hf_id.Value)); string sName = "COND_" + c.RUT + Path.GetExtension(FileUpLoad1.FileName); try { FileUpLoad1.SaveAs(Ruta1 + sName); c.IMAGEN = sName; if (c.AgregarFoto()) { utils.ShowMessage2(this, "subirFoto", "success"); ObtenerConductores(true); } else { utils.ShowMessage2(this, "subirFoto", "error"); } } catch (Exception ex) { utils.ShowMessage(this, ex.Message, "error", false); } } else { utils.ShowMessage2(this, "subirFoto", "warn_archivoInvalido"); } } }
protected void UploadBtn_Click(object sender, EventArgs e) { if (!HasUploadFile()) { Label1.Text = "No File Uploaded."; string testScript = "alert('ファイルが指定されていません');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "key", testScript, true); return; } var aa = FileUpLoad1.Width; //ResizeImageKeepingAspectRatio(); var fPfx = CurrentFileNamePrefix(); //var pngFileName = fPfx + "_output.png"; var pngPath = Path.Combine(_savePath, fPfx + FileUpLoad1.FileName); FileUpLoad1.SaveAs(Path.Combine(_savePath, fPfx + FileUpLoad1.FileName)); AddFile(fPfx + FileUpLoad1.FileName, pngPath); return; Label1.Text = "File Uploaded: " + FileUpLoad1.FileName; _registeredFiles.Add(new RegisteredFile { RegisterNumber = "1", RegisterDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), RegisterFileName = FileUpLoad1.FileName });; LoadGrid(); // ここでは、Iconファイルに変換するルートとする if (!CheckBox1.Checked) { var icoFilePath = Path.Combine(_savePath, fPfx + ".ico"); using (FileStream stream = File.OpenWrite(icoFilePath)) { Bitmap bitmap = (Bitmap)System.Drawing.Image.FromFile(pngPath); Icon.FromHandle(bitmap.GetHicon()).Save(stream); } } }
protected void UploadBtn_Click(object sender, EventArgs e) { if (FileUpLoad1.HasFile) { FileUpLoad1.SaveAs(Server.MapPath("~/App_Data/" + FileUpLoad1.FileName)); Label1.Text = "<br /> <br /><div class='alert alert-success' role='alert'>Profile Picture Updated!</div>"; HttpPostedFile file = FileUpLoad1.PostedFile; byte[] data = new byte[file.ContentLength]; file.InputStream.Read(data, 0, file.ContentLength); Profile.Picture = data; Profile.PictureType = file.ContentType; } else { Label1.Text = "<br /> <br /><div class='alert alert-danger' role='alert'>No file to upload!</div>"; } }
private void GioiThieu_save_update() { //try //{ info.TieuDe = txtTitle.Text; info.Noidung = editor.Text; info.DienGiai = lblHeadingText.Text; info.NguonBaiViet = txtSource.Text; //ko co du lieu info.Ngayviet = DateTime.Now; info.Nguoiviet = NhanVien(); info.Img = FileUpLoad1.FileName; info.MaLoaiTin = int.Parse("0" + ddlDichvu.Text); info.TrangThai = 1; if (Request.QueryString["info_id"] == null) { if (FileUpLoad1.FileName != "") { string path = Server.MapPath("~/uploads/tintuc/") + FileUpLoad1.FileName; FileUpLoad1.SaveAs(path); //luu va co image info.Gioithieu_luu(); Response.Redirect("info_send.aspx?add=1"); } } else { info.MaGioiThieu = int.Parse("0" + Request.QueryString["info_id"].ToString()); info.Gioithieu_capnhat(); Response.Redirect("info_send.aspx?update=1"); } //} //catch (Exception) //{ // lblMessageStatus.Text = "<dl id=\"system-message\"><dd class=\"message message error\"><ul><li> Hệ thống chưa cấp quyền ghi thư mục Upload/baiviet</li></ul></dd></dl>"; // lblMessageStatus.Visible = true; //} }
protected void upload_ServerClick(object sender, EventArgs e) { if (FileUpLoad1.HasFile) { error.Visible = false; Global.imagePath = Server.MapPath("/img/Products/") + FileUpLoad1.FileName; string extension = Path.GetExtension(FileUpLoad1.FileName); if (extension.Equals(".jpg") || extension.Equals(".png")) { FileUpLoad1.SaveAs(Global.imagePath); imgPath.InnerHtml = "<img src='../img/Products/" + FileUpLoad1.FileName + "' alt='Image placeholder' class='card-img-top'>"; } else { error.Visible = true; error.InnerText = "Please enter a valid image type (.jpg or .png)"; } } else { error.Visible = true; error.InnerText = "Error: No image uploaded"; } }
protected void btnUpdate_Click1(object sender, EventArgs e) { if (ddlServiceType.Text != "") { clsConnect cn = new clsConnect(); int Nparameter = 11; string[] name = new string[Nparameter]; object[] value = new object[Nparameter]; string sql = ""; //upload file vao thu muc thuvien/taptin //try //{ if (FileUpLoad1.FileName != "") { string path = Server.MapPath("~/thuvien/taptin/") + FileUpLoad1.FileName; FileUpLoad1.SaveAs(path); Nparameter = 11; sql = "UPDATE information SET service_id=?service_id,title=?title,date_post=?date_post,human_post=?human_post,source_link=?source_link, " + "content=?content,heading_text=?heading_text,file=?file,status_id=?status_id , id=?id " + "WHERE information_id=?information_id"; name[0] = "?service_id"; name[1] = "?title"; name[2] = "?date_post"; name[3] = "?human_post"; name[4] = "?source_link"; name[5] = "?content"; name[6] = "?heading_text"; name[7] = "?file"; name[8] = "?status_id"; name[9] = "?information_id"; name[10] = "?id"; value[0] = ddlService.Text; value[1] = txtTitle.Text.Trim(); value[2] = DateTime.Now; value[3] = cn.LoadData("select nhanvien_ten FROM nhanvien WHERE nhanvien_ma=" + Session["nhanvien_ma"].ToString()).Rows[0][0].ToString(); value[4] = txtSource.Text.Trim(); value[5] = txtContent.Value; value[6] = lblHeadingText.Text.Trim(); value[7] = FileUpLoad1.FileName; //lay id chuyen muc, gan cho trang thai if (rbtChoise.SelectedValue == "0") { value[8] = "0"; } if (rbtChoise.SelectedValue == "1") { value[8] = "1"; } if (rbtChoise.SelectedValue == "2") { value[8] = "2"; } value[9] = Request.QueryString["content_id"]; value[10] = ddlMon.SelectedIndex.ToString(); cn.UpdateData(sql, name, value, Nparameter); } else { Nparameter = 9; sql = "UPDATE information SET service_id=?service_id,title=?title,date_post=?date_post,human_post=?human_post,source_link=?source_link, " + "content=?content,heading_text=?heading_text,status_id=?status_id " + "WHERE information_id=?information_id"; name[0] = "?service_id"; name[1] = "?title"; name[2] = "?date_post"; name[3] = "?human_post"; name[4] = "?source_link"; name[5] = "?content"; name[6] = "?heading_text"; name[7] = "?status_id"; name[8] = "?information_id"; value[0] = ddlService.Text; value[1] = txtTitle.Text.Trim(); value[2] = DateTime.Now; value[3] = cn.LoadData("select nhanvien_ten FROM nhanvien WHERE nhanvien_ma=" + Session["nhanvien_ma"].ToString()).Rows[0][0].ToString(); value[4] = txtSource.Text.Trim(); value[5] = txtContent.Value; value[6] = lblHeadingText.Text.Trim(); //lay id chuyen muc, gan cho trang thai if (rbtChoise.SelectedValue == "0") { value[7] = "0"; } if (rbtChoise.SelectedValue == "1") { value[7] = "1"; } if (rbtChoise.SelectedValue == "2") { value[7] = "2"; } value[8] = Request.QueryString["content_id"]; cn.UpdateData(sql, name, value, Nparameter); } cn.close(); Response.Redirect("web_send.aspx"); } }
void UploadTinGioithieu() { clsConnect cn = new clsConnect(); int Nparameter = 10; string[] name = new string[Nparameter]; object[] value = new object[Nparameter]; string sql = ""; //upload file vao thu muc thuvien/taptin //try //{ if (FileUpLoad1.FileName != "") { string path = Server.MapPath("~/thuvien/taptin/") + FileUpLoad1.FileName; FileUpLoad1.SaveAs(path); Nparameter = 10; sql = "INSERT INTO information(service_id,title,date_post,human_post,source_link,content,heading_text,file,status_id,id)VALUES( " + "?service_id,?title,?date_post,?human_post,?source_link,?content,?heading_text,?file,?status_id,?id)"; name[0] = "?service_id"; name[1] = "?title"; name[2] = "?date_post"; name[3] = "?human_post"; name[4] = "?source_link"; name[5] = "?content"; name[6] = "?heading_text"; name[7] = "?file"; name[8] = "?status_id"; name[9] = "?id"; value[0] = ddlService.Text; value[1] = txtTitle.Text.Trim(); value[2] = DateTime.Now; value[3] = cn.LoadData("select nhanvien_ten FROM nhanvien WHERE nhanvien_ma=" + Session["nhanvien_ma"].ToString()).Rows[0][0].ToString(); value[4] = txtSource.Text.Trim(); value[5] = txtContent.Value; value[6] = lblHeadingText.Text.Trim(); value[7] = FileUpLoad1.FileName; //lay id chuyen muc, gan cho trang thai if (rbtChoise.SelectedValue == "0") { value[8] = "0"; } if (rbtChoise.SelectedValue == "1") { value[8] = "1"; } if (rbtChoise.SelectedValue == "2") { value[8] = "2"; } value[9] = ddlMon.SelectedIndex.ToString(); cn.UpdateData(sql, name, value, Nparameter); } else { Nparameter = 9; sql = "INSERT INTO information(service_id,title,date_post,human_post,source_link,content,heading_text,status_id,id)VALUES( " + "?service_id,?title,?date_post,?human_post,?source_link,?content,?heading_text,?status_id,?id)"; name[0] = "?service_id"; name[1] = "?title"; name[2] = "?date_post"; name[3] = "?human_post"; name[4] = "?source_link"; name[5] = "?content"; name[6] = "?heading_text"; name[7] = "?status_id"; name[8] = "?id"; value[0] = ddlService.Text; value[1] = txtTitle.Text.Trim(); value[2] = DateTime.Now; value[3] = cn.LoadData("select nhanvien_ten FROM nhanvien WHERE nhanvien_ma=" + Session["nhanvien_ma"].ToString()).Rows[0][0].ToString(); value[4] = txtSource.Text.Trim(); value[5] = txtContent.Value; value[6] = lblHeadingText.Text.Trim(); if (rbtChoise.SelectedValue == "0") { value[7] = "0"; } if (rbtChoise.SelectedValue == "1") { value[7] = "1"; } if (rbtChoise.SelectedValue == "2") { value[7] = "2"; } value[8] = ddlMon.SelectedIndex.ToString(); cn.UpdateData(sql, name, value, Nparameter); } cn.close(); }
//rehab permit //rabies vacc //resume protected void Button1_Click(object sender, EventArgs e) { String personID = "0"; string fileNameRehabPermit = ""; byte[] fileByteRehabPermit = BitConverter.GetBytes(1); String filePathRehabPermit = ""; String fileTypeRehabPermit = ""; long fileLengthRehabPermit = 0; String fileNameRabiesVacc = ""; byte[] fileByteRabiesVacc = BitConverter.GetBytes(1); String filePathRabiesVacc = ""; String fileTypeRabiesVacc = ""; long fileLengthRabiesVacc = 0; String fileNameResume = ""; byte[] fileByteResume = BitConverter.GetBytes(1); String filePathResume = ""; String fileTypeResume = ""; long fileLengthResume = 0; try { firstName = tbfirstName.Text.ToString(); lastName = tblastName.Text.ToString(); outreachPassword = password.Text.ToString(); email = tbemail.Text.ToString(); phoneNum = phone.Text.ToString(); addressProvided = address.Text.ToString(); City = city.Text.ToString(); State = homestate.Value.ToString(); zipcode = zip.Text.ToString(); DOB = DOBDatePick.Text.ToString(); bool rpIsChecked = RadioButton1.Checked; if (rpIsChecked) { rehabPermitYN = RadioButton1.Text.ToString(); rehabPermitCat = permitCategory.Value.ToString(); fileNameRehabPermit = Path.GetFileName(FileUpLoad1.FileName); FileUpLoad1.SaveAs(Server.MapPath("~/") + fileNameRehabPermit); FileInfo permitRehabFI = new FileInfo(fileNameRehabPermit); filePathRehabPermit = Server.MapPath("~/") + fileNameRehabPermit; fileTypeRehabPermit = permitRehabFI.Extension; using (var stream = new FileStream(filePathRehabPermit, FileMode.Open, FileAccess.Read)) { using (var reader3 = new BinaryReader(stream)) { fileByteRehabPermit = reader3.ReadBytes((int)stream.Length); fileLengthRehabPermit = fileByteRehabPermit.Length; } } System.IO.File.Delete(Server.MapPath("~/") + fileNameRehabPermit); } else { rehabPermitYN = RadioButton2.Text.ToString(); rehabPermitCat = "NULL"; } bool rvIsChecked = RadioButton3.Checked; if (rvIsChecked) { rabiesVacYN = RadioButton3.Text.ToString(); rabiesVacDate = RabiesDatePick.Text.ToString(); fileNameRabiesVacc = Path.GetFileName(FileUpLoad2.FileName); FileUpLoad1.SaveAs(Server.MapPath("~/") + fileNameRabiesVacc); FileInfo FIRabiesVacc = new FileInfo(fileNameRabiesVacc); filePathRabiesVacc = Server.MapPath("~/") + fileNameRabiesVacc; fileTypeRabiesVacc = FIRabiesVacc.Extension; using (var stream = new FileStream(filePathRabiesVacc, FileMode.Open, FileAccess.Read)) { using (var reader3 = new BinaryReader(stream)) { fileByteRabiesVacc = reader3.ReadBytes((int)stream.Length); fileLengthRabiesVacc = fileByteRehabPermit.Length; } } System.IO.File.Delete(Server.MapPath("~/") + fileNameRabiesVacc); } else { rabiesVacYN = RadioButton4.Text.ToString(); rabiesVacDate = "NULL"; } bool lift40IsChecked = RadioButton5.Checked; if (lift40IsChecked) { lift40 = RadioButton5.Text.ToString(); } else { lift40 = RadioButton6.Text.ToString(); } bool allergIsChecked = RadioButton7.Checked; if (allergIsChecked) { allergiesLimitsYN = RadioButton7.Text.ToString(); allergiesLimitsTB = TextBox1.Text.ToString(); } else { allergiesLimitsYN = RadioButton7.Text.ToString(); allergiesLimitsTB = "NULL"; } bool woIsChecked = RadioButton10.Checked; if (woIsChecked) { outdoorWorkYN = RadioButton10.Text.ToString(); outdoorWorkTB = TextBox2.Text.ToString(); } else { outdoorWorkYN = RadioButton9.Text.ToString(); outdoorWorkTB = "NULL"; } fileNameResume = Path.GetFileName(FileUpLoad3.FileName); FileUpLoad1.SaveAs(Server.MapPath("~/") + fileNameResume); FileInfo FIResume = new FileInfo(fileNameResume); filePathResume = Server.MapPath("~/") + fileNameResume; fileTypeResume = FIResume.Extension; using (var stream = new FileStream(filePathResume, FileMode.Open, FileAccess.Read)) { using (var reader3 = new BinaryReader(stream)) { fileByteResume = reader3.ReadBytes((int)stream.Length); fileLengthResume = fileByteResume.Length; } } System.IO.File.Delete(Server.MapPath("~/") + fileNameResume); interest = TextBox7.Text.ToString(); passionateIssue = TextBox3.Text.ToString(); publicSpeaking = TextBox4.Text.ToString(); animalRightsGroup = TextBox5.Text.ToString(); bringToTeam = TextBox6.Text.ToString(); System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection(); sc.ConnectionString = @"Server=LOCALHOST;Database=Wildlife;Trusted_Connection=Yes;"; sc.Open(); System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand(); insert.Connection = sc; insert.CommandText = "INSERT INTO Person(" + "Person_UserName, " + "Person_PasswordHash, " + "Person_UserType, " + "Person_FirstName, " + "Person_LastName, " + "Person_Email, " + "Person_PhonePrimary, " + "Person_StreetAddress, " + "Person_City, " + "Person_State, " + "Person_Zipcode, " + "Person_DateOfBirth, " + "Person_Status, " + "Person_RabiesYN, " + "Person_RabbiesVaccinationDate, " + "Person_RehabilitatePermitCategory, " + "Person_AllergiesYN, " + "Person_Allergies, " + "Person_WorkOutside, " + "Person_OutsideLimitations, " + "Person_Lift40Lbs, " + "Person_RehabilitateYN) VALUES(" + "@email, " + "@outreachPassword, " + "'Applicant', " + "@firstName, " + "@lastName, " + "@email, " + "@phoneNum, " + "@addressProvided, " + "@City, " + "@homeState, " + "@zipcode, " + "@DOB, " + "'Applicant', " + "@rabiesVacYN, " + "@rabiesVacDate, " + "@rehabPermitCat, " + "@allergiesLimitsYN, " + "@allergiesLimitsTB, " + "@outdoorWorkYN, " + "@outdoorWorkTB, " + "@lift40, " + "@rehabPermitYN)"; insert.Parameters.AddWithValue("@email", email); insert.Parameters.AddWithValue("@outreachPassword", outreachPassword); insert.Parameters.AddWithValue("@firstName", firstName); insert.Parameters.AddWithValue("@lastName", lastName); insert.Parameters.AddWithValue("@phoneNum", phoneNum); insert.Parameters.AddWithValue("@addressProvided", addressProvided); insert.Parameters.AddWithValue("@city", City); insert.Parameters.AddWithValue("@homeState", State); insert.Parameters.AddWithValue("@zipcode", zipcode); insert.Parameters.AddWithValue("@DOB", DOB); insert.Parameters.AddWithValue("@rabiesVacYN", rabiesVacYN); if (rabiesVacDate == "NULL") { insert.Parameters.AddWithValue("@rabiesVacDate", DBNull.Value); } else { insert.Parameters.AddWithValue("@rabiesVacDate", rabiesVacDate); } if (rehabPermitCat == "NULL") { insert.Parameters.AddWithValue("@rehabPermitCat", DBNull.Value); } else { insert.Parameters.AddWithValue("@rehabPermitCat", rehabPermitCat); } insert.Parameters.AddWithValue("@allergiesLimitsYN", allergiesLimitsYN); if (allergiesLimitsTB == "NULL") { insert.Parameters.AddWithValue("@allergiesLimitsTB", DBNull.Value); } else { insert.Parameters.AddWithValue("@allergiesLimitsTB", allergiesLimitsTB); } insert.Parameters.AddWithValue("@outdoorWorkYN", outdoorWorkYN); if (outdoorWorkTB == "NULL") { insert.Parameters.AddWithValue("@outdoorWorkTB", DBNull.Value); } else { insert.Parameters.AddWithValue("@outdoorWorkTB", outdoorWorkTB); } insert.Parameters.AddWithValue("@lift40", lift40); insert.Parameters.AddWithValue("@rehabPermitYN", rehabPermitYN); insert.ExecuteNonQuery(); insert.CommandText = "SELECT TOP 1 [Person_ID] FROM Person ORDER BY Person_ID DESC"; insert.ExecuteNonQuery(); System.Data.SqlClient.SqlDataReader reader = insert.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { personID = reader.GetInt32(0).ToString(); } reader.Close(); } insert.CommandText = "INSERT INTO OutreachApp(" + "OutreachApp_PersonID, " + "OutreachApp_WhyInterested, " + "OutreachApp_PassionateWildlifeIssue, " + "OutreachApp_ExperiencePublicSpeaking, " + "OutreachApp_BelongToAnimalRightsGroup, " + "OutreachApp_BringToTeam) VALUES(" + "@personID, " + "@interest, " + "@passionateIssue, " + "@publicSpeaking, " + "@animalRightsGroup, " + "@bringToTeam)"; insert.Parameters.AddWithValue("@personID", personID); insert.Parameters.AddWithValue("@interest", interest); insert.Parameters.AddWithValue("@passionateIssue", passionateIssue); insert.Parameters.AddWithValue("@publicSpeaking", publicSpeaking); insert.Parameters.AddWithValue("@animalRightsGroup", animalRightsGroup); insert.Parameters.AddWithValue("@bringToTeam", bringToTeam); insert.ExecuteNonQuery(); if (rpIsChecked) { insert.CommandText = "INSERT INTO Documentation(" + "Documentation_PersonID, " + "Documentation_TypeOfDocument, " + "Documentation_FileName, " + "Documentation_FileType, " + "Documentation_FileSize, " + "Documentation_FileContent) VALUES(" + "@personID, " + "'RehabPermit', " + "@fileNameRehabPermit, " + "@fileTypeRehabPermit, " + "@fileLengthRehabPermit, " + "@permitBinary)"; insert.Parameters.AddWithValue("@fileNameRehabPermit", fileNameRehabPermit); insert.Parameters.AddWithValue("@fileTypeRehabPermit", fileTypeRehabPermit); insert.Parameters.AddWithValue("@fileLengthRehabPermit", fileLengthRehabPermit); insert.Parameters.Add("@permitBinary", System.Data.SqlDbType.VarBinary, fileByteRehabPermit.Length).Value = fileByteRehabPermit; insert.ExecuteNonQuery(); } if (rvIsChecked) { insert.CommandText = "INSERT INTO Documentation(" + "Documentation_PersonID, " + "Documentation_TypeOfDocument, " + "Documentation_FileName, " + "Documentation_FileType, " + "Documentation_FileSize, " + "Documentation_FileContent) VALUES(" + "@personID, " + "'RabiesVacc', " + "@fileNameRabiesVacc, " + "@fileTypeRabiesVacc, " + "@fileLengthRabiesVacc, " + "@binaryRabiesVacc)"; insert.Parameters.AddWithValue("@fileNameRabiesVacc", fileNameRabiesVacc); insert.Parameters.AddWithValue("@fileTypeRabiesVacc", fileTypeRabiesVacc); insert.Parameters.AddWithValue("@fileLengthRabiesVacc", fileLengthRabiesVacc); insert.Parameters.Add("@binaryRabiesVacc", System.Data.SqlDbType.VarBinary, fileByteRabiesVacc.Length).Value = fileByteRabiesVacc; insert.ExecuteNonQuery(); } insert.CommandText = "INSERT INTO Documentation(" + "Documentation_PersonID, " + "Documentation_TypeOfDocument, " + "Documentation_FileName, " + "Documentation_FileType, " + "Documentation_FileSize, " + "Documentation_FileContent) VALUES(" + "@personID, " + "'Resume', " + "@fileNameResume, " + "@fileTypeResume, " + "@fileLengthResume, " + "@binaryResume)"; insert.Parameters.AddWithValue("@fileNameResume", fileNameResume); insert.Parameters.AddWithValue("@fileTypeResume", fileTypeResume); insert.Parameters.AddWithValue("@fileLengthResume", fileLengthResume); insert.Parameters.Add("@binaryResume", System.Data.SqlDbType.VarBinary, fileByteResume.Length).Value = fileByteResume; insert.ExecuteNonQuery(); Response.Redirect("clockin.aspx"); sc.Close(); } catch (System.Data.SqlClient.SqlException sqlException) { } }