protected void cmdUpload_Click(object source, EventArgs e) { BLL_TRV_Attachment att = new BLL_TRV_Attachment(); try { int RequestID = 0; if (flName.PostedFile.ContentLength > 0) { string sFileName, filePath; sFileName = System.Guid.NewGuid().ToString() + System.IO.Path.GetExtension(flName.PostedFile.FileName); filePath = ConfigurationManager.AppSettings["TRV_UPLOAD_PATH"].ToString(); if (flName.PostedFile.ContentLength <= 3048000) { filePath = Server.MapPath("~/") + ConfigurationManager.AppSettings["TRV_UPLOAD_PATH"].ToString() + sFileName; flName.PostedFile.SaveAs(filePath); att.SaveAttchement(RequestID, sFileName, System.IO.Path.GetFileName(flName.PostedFile.FileName), "INVOICE", "", Convert.ToInt32(Session["USERID"].ToString()), UDFLib.ConvertIntegerToNull(Request.QueryString["SUPPLIER_ID"])); SaveInvoice(); GetInvoices(""); } } } catch (UnauthorizedAccessException ex) { throw new Exception(ex.Message + "Permission to upload file denied"); } finally { att = null; } }
public Boolean SaveAttchement(int requestid, string attachment_name, string attachment_path, string attachment_type, string refnumber, int userid) { BLL_TRV_Attachment objTrv = new BLL_TRV_Attachment(); try { return(objTrv.SaveAttchement(requestid, attachment_name, attachment_path, attachment_type, refnumber, userid, null)); } catch { throw; } finally { objTrv = null; } }
protected void btnCreateTicket_Click(object s, EventArgs e) { try { string sFileName = Guid.NewGuid().ToString(); string filePath = Server.MapPath("~/") + ConfigurationManager.AppSettings["TRV_UPLOAD_PATH"].ToString() + sFileName + ".pdf"; EO.Pdf.Runtime.AddLicense("p+R2mbbA3bNoqbTC4KFZ7ekDHuio5cGz4aFZpsKetZ9Zl6TNHuig5eUFIPGe" + "tcznH+du5PflEuCG49jjIfewwO/o9dB2tMDAHuig5eUFIPGetZGb566l4Of2" + "GfKetZGbdePt9BDtrNzCnrWfWZekzRfonNzyBBDInbW6yuCwb6y9xtyxdabw" + "+g7kp+rp2g+9RoGkscufdePt9BDtrNzpz+eupeDn9hnyntzCnrWfWZekzQzr" + "peb7z7iJWZekscufWZfA8g/jWev9ARC8W7zTv/vjn5mkBxDxrODz/+ihb6W0" + "s8uud4SOscufWbOz8hfrqO7CnrWfWZekzRrxndz22hnlqJfo8h8="); EO.Pdf.HtmlToPdf.Options.AfterRenderPage = new EO.Pdf.PdfPageEventHandler(On_AfterRenderPage); EO.Pdf.HtmlToPdf.ConvertHtml(@"<html><div>" + txtMailBody.Text + "</div> </html> ", filePath); BLL_TRV_TravelRequest TRequest = new BLL_TRV_TravelRequest(); BLL_TRV_Attachment att = new BLL_TRV_Attachment(); int RequestID = UDFLib.ConvertToInteger(Request.QueryString["requestid"].ToString()); if (!String.IsNullOrEmpty(hdf_TicketNumber.Value)) { if (TRequest.UpdateETicketNumber(RequestID, Convert.ToInt32(hdf_Flightid.Value), hdf_TicketNumber.Value, UDFLib.ConvertToInteger(Session["USERID"].ToString()), Convert.ToInt32(hdf_PaxID.Value))) { att.SaveAttchement(RequestID, sFileName + ".pdf", sFileName + ".pdf", "ETICKET", hdf_TicketNumber.Value, Convert.ToInt32(Session["USERID"].ToString()), UDFLib.ConvertIntegerToNull(Request.QueryString["SUPPLIER_ID"])); } } GetETickets(); } catch (Exception ex) { String msgmodalexp = String.Format("alert('" + ex.Message + "');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "expCreateTicket", msgmodalexp, true); } String msgmodal = String.Format("hideModal('dvCreateTicket');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "dvCreateTicket", msgmodal, true); }
protected void cmdUpload_Click(object source, EventArgs e) { BLL_TRV_Attachment att = new BLL_TRV_Attachment(); try { if (IsPostBack) { if (Attach_Type.ToString().ToUpper() == "INVOICE") { SaveInvoice(); ddlAttachmentType.SelectedIndex = 0; txtInvAmount.Text = ""; txtInvNo.Text = ""; } if (flName.PostedFile.ContentLength > 0) { string sFileName, filePath; sFileName = System.Guid.NewGuid().ToString() + Path.GetExtension(flName.PostedFile.FileName); filePath = ConfigurationManager.AppSettings["TRV_UPLOAD_PATH"].ToString(); if (flName.PostedFile.ContentLength <= 3048000) { filePath = Server.MapPath("~/") + ConfigurationManager.AppSettings["TRV_UPLOAD_PATH"].ToString() + sFileName; flName.PostedFile.SaveAs(filePath); att.SaveAttchement(RequestID, Path.GetFileName(flName.PostedFile.FileName), sFileName, Attach_Type, "", Convert.ToInt32(Session["USERID"].ToString()), UDFLib.ConvertIntegerToNull(Request.QueryString["SUPPLIER_ID"])); } } } GetAttachment(RequestID, Attach_Type); } catch (UnauthorizedAccessException ex) { throw new Exception(ex.Message + "Permission to upload file denied"); } finally { att = null; } }
/// Agent will be able to upload the ticket if the status is Issued or Approved /// Status can be checked in TRequest.Get_TravelStatus menthod protected void cmdTicketNo_onClick(object source, EventArgs e) { lblMessage.Text = ""; TextBox txtETicketNumber = (TextBox)((GridViewRow)((Button)source).Parent.Parent).FindControl("txtETicketNumber"); FileUpload flName = (FileUpload)((GridViewRow)((Button)source).Parent.Parent).FindControl("flName"); BLL_TRV_TravelRequest TRequest = new BLL_TRV_TravelRequest(); BLL_TRV_Attachment att = new BLL_TRV_Attachment(); BLL_Infra_UploadFileSize objUploadFilesize = new BLL_Infra_UploadFileSize(); DataTable dt = new DataTable(); dt = objUploadFilesize.Get_Module_FileUpload("TRV_"); string status = ""; DataTable dtStatus = TRequest.Get_TravelStatus(UDFLib.ConvertToInteger(Request.QueryString["requestid"].ToString())); if (dtStatus.Rows.Count > 0) { status = dtStatus.Rows[0]["currentStatus"].ToString(); if (status == "APPROVED" || status == "ISSUED") { if (dt.Rows.Count > 0) { string datasize = dt.Rows[0]["Size_KB"].ToString(); if (flName.PostedFile.ContentLength < Int32.Parse(dt.Rows[0]["Size_KB"].ToString()) * 1024) { try { int RequestID = UDFLib.ConvertToInteger(Request.QueryString["requestid"].ToString()); int Flightid; PaxID = UDFLib.ConvertToInteger(((Button)source).CommandArgument.Split(',')[0]); Flightid = UDFLib.ConvertToInteger(((Button)source).CommandArgument.Split(',')[1]); if (!String.IsNullOrEmpty(txtETicketNumber.Text) && flName.PostedFile.ContentLength > 0) { if (TRequest.UpdateETicketNumber(RequestID, Flightid, txtETicketNumber.Text, UDFLib.ConvertToInteger(Session["USERID"].ToString()), PaxID)) { //string msg = "E-TICKET for Request #" + RequestID.ToString() + " has been uploaded on the website, please download the same"; // UDFLib.ConvertToInteger(Session["USERID"].ToString())); if (flName.PostedFile.ContentLength > 0) { string sFileName, filePath; sFileName = System.Guid.NewGuid().ToString() + Path.GetExtension(flName.PostedFile.FileName); filePath = ConfigurationManager.AppSettings["TRV_UPLOAD_PATH"].ToString(); if (flName.PostedFile.ContentLength <= 3048000) { flName.PostedFile.SaveAs((Server.MapPath("~/") + ConfigurationManager.AppSettings["TRV_UPLOAD_PATH"].ToString() + sFileName)); att.SaveAttchement(RequestID, Path.GetFileName(flName.PostedFile.FileName), sFileName, "ETICKET", txtETicketNumber.Text, Convert.ToInt32(Session["USERID"].ToString()), UDFLib.ConvertIntegerToNull(Request.QueryString["SUPPLIER_ID"])); //File.Copy(filePath, @"\\server01\uploads\Travel\ticket\" + sFileName); } } } GetETickets(); } } catch { } finally { TRequest = null; } } else { lblMessage.Text = datasize + " KB File size exceeds maximum limit"; } } else { string js2 = "alert('Upload size not set!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert9", js2, true); } } } }
protected void rptParent_ItemCommand(object source, RepeaterCommandEventArgs e) { try { if ("SENDTICKET" == e.CommandName) { string UploadFilePath = ConfigurationManager.AppSettings["TRV_UPLOAD_PATH"]; BLL_TRV_Attachment objatt = new BLL_TRV_Attachment(); int MailID = objatt.Send_Ticket(int.Parse(e.CommandArgument.ToString()), int.Parse(Session["userid"].ToString())); string URL = String.Format("window.open('../crew/EmailEditor.aspx?ID=+" + MailID.ToString() + @"&FILEPATH=" + UploadFilePath.Remove(UploadFilePath.Length - 1, 1).Replace(@"\", @"\\") + "');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "k" + MailID.ToString(), URL, true); } if (e.CommandName == "delete") { BLL_TRV_TravelRequest TRequest = new BLL_TRV_TravelRequest(); TRequest.CancelRequest(Convert.ToInt32(e.CommandArgument), Convert.ToInt32(Session["USERID"].ToString())); TRequest = null; ViewState["Status"] = ""; string jsc = @"__doPostBack('ctl00$MainContent$lnkMenu' + currentlink, '')"; // string msgmodal = String.Format("asyncGet_Quote_Count_Approval(" + e.CommandArgument.ToString() + ",'divSendForApproval');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "jsc", jsc, true); } if (e.CommandName == "refund") { hdnRequestID.Value = e.CommandArgument.ToString(); lblRequestIDRefund.Text = "Request ID : " + e.CommandArgument.ToString(); string js = "showModal('dvPopup_Refund');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsPopup_Refund", js, true); } if (e.CommandName == "RequestApproval") { BLL_TRV_QuoteRequest QR = new BLL_TRV_QuoteRequest(); ViewState["RequestID_App"] = e.CommandArgument.ToString(); hdnRequestID_App.Value = e.CommandArgument.ToString(); DataTable dt = QR.Get_Qtn_Approver_DeptMgr(0, 0); lstUserList.DataSource = dt; lstUserList.DataBind(); lstUserList.Items.Insert(0, new ListItem("SELECT", "0")); lstUserList.SelectedIndex = 0; ListItem itemrmv = lstUserList.Items.FindByValue(Session["userid"].ToString()); lstUserList.Items.Remove(itemrmv); ListBoxPOApprover.DataSource = QR.Get_Qtn_Approver(); ListBoxPOApprover.DataBind(); ListBoxPOApprover.Items.Insert(0, new ListItem("SELECT", "0")); ListBoxPOApprover.SelectedIndex = 0; lstUserList.Items.Remove(itemrmv); string msgmodal = String.Format("asyncGet_Quote_Count_Approval(" + e.CommandArgument.ToString() + ",'divSendForApproval');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Apprmodal", msgmodal, true); } } catch { } }