protected void btnUploadAttachments_Click(object sender, EventArgs e) { try { if (FileUploader1.FileName.Length > 0) { int CrewID = int.Parse(getQueryString("CrewID")); int VoyID = int.Parse(getQueryString("VoyID")); string sFileName = CrewID.ToString() + "_" + VoyID.ToString() + "_2" + ".pdf"; string Upload_Path = System.Web.HttpContext.Current.Server.MapPath("~/Uploads/CrewDocuments/"); FileUploader1.SaveAs(Upload_Path + "\\" + sFileName); int DocID = objCrewBLL.Insert_CrewAgreementRecord(CrewID, VoyID, 2, 0, "Crew Agreement - Signed by Office", sFileName, sFileName, GetSessionUserID()); Load_Agreements(); Load_Agreement_Status(); } } catch (Exception ex) { string js = "alert('Error in saving data!! Error: " + ex.Message + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "errorsaving", js, true); } }
protected void lnkAttachedFile_Click(object sender, EventArgs e) { try { if (FileUploader1.HasFile) { str1 = System.IO.Path.GetFileName(FileUploader1.PostedFile.FileName); FileUploader1.SaveAs(Server.MapPath("~/TempAttachment/") + str1); path1 = Server.MapPath("~/TempAttachment/") + str1; ChkAttach1.Visible = true; ChkAttach1.Checked = true; ChkAttach1.Text = str1; FileUploader1.Visible = false; } if (FileUpload2.HasFile) { str2 = System.IO.Path.GetFileName(FileUpload2.PostedFile.FileName); FileUpload2.SaveAs(Server.MapPath("~/TempAttachment/") + str2); path2 = Server.MapPath("~/TempAttachment/") + str2; ChkAttach2.Visible = true; ChkAttach2.Checked = true; ChkAttach2.Text = str2; FileUpload2.Visible = false; } if (FileUpload3.HasFile) { str3 = System.IO.Path.GetFileName(FileUpload3.PostedFile.FileName); FileUpload3.SaveAs(Server.MapPath("~/TempAttachment/") + str3); path3 = Server.MapPath("~/TempAttachment/") + str3; ChkAttach3.Visible = true; ChkAttach3.Checked = true; ChkAttach3.Text = str3; FileUpload3.Visible = false; } if (path1 != "" && path2 != "" && path3 != "") { lnkAttachedFile.Visible = false; } } catch (Exception ex) { obj_Comman.ShowPopUpMsg("Files Not Attched, Please try Again..", this.Page); } }