public string InsertDocument_po_step1(Model.PO_Document criteria) { Class.clsDB db = new Class.clsDB(); string sql; sql = "Insert into po_document("; sql += "doc_id,"; sql += "pr_doc_id,"; sql += "doc_name,"; sql += "create_by,"; sql += "content,"; sql += "comment,"; sql += "secure_prepare) Values("; sql += "'" + criteria.doc_id + "',"; sql += "'" + criteria.pr_doc_id + "',"; sql += "'" + criteria.doc_name + "',"; sql += "'" + criteria.create_by + "',"; sql += "'" + criteria.content + "',"; sql += "'" + criteria.comment + "',"; sql += "'" + criteria.secure_prepare + "')"; int ret; ret = db.ExecuteNonQuery(sql); db.Close(); return(ret.ToString()); }
public int Update_sign_prepare_date(Model.PO_Document criteria) { string sql; sql = "Update po_document SET sign_prepare_date = '" + criteria.sign_prepare_date + "',step2=1 "; sql += " WHERE doc_id='" + criteria.doc_id + "'"; Class.clsDB db = new Class.clsDB(); int ret; ret = db.ExecuteNonQuery(sql); db.Close(); return(ret); }
public int Update_sign_approve_problem(Model.PO_Document criteria) { string sql; sql = "Update po_document SET approve_problem = '" + criteria.approve_problem + "',step4=1 "; sql += " WHERE doc_id='" + criteria.doc_id + "'"; Class.clsDB db = new Class.clsDB(); int ret; ret = db.ExecuteNonQuery(sql); db.Close(); return(ret); }
public int Update_AttachFile(Model.PO_Document criteria, int val) { string sql; sql = "Update po_document SET attach_file_name = " + val; sql += " WHERE doc_id='" + criteria.doc_id + "'"; Class.clsDB db = new Class.clsDB(); int ret; ret = db.ExecuteNonQuery(sql); db.Close(); return(ret); }
public int Update_Upload_date(Model.PO_Document criteria) { string sql; sql = "Update po_document SET upload_date = '" + criteria.upload_date + "',"; sql += "step1='1',page_count = " + criteria.page_count + ",paper_type = '" + criteria.paper_type + "'"; sql += " WHERE doc_id='" + criteria.doc_id + "'"; Class.clsDB db = new Class.clsDB(); int ret; ret = db.ExecuteNonQuery(sql); db.Close(); return(ret); }
void testPostback() { string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/tmpFrmApplication.html"; //string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/testHtml.html"; var url = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/PO_FrmApplicationRequest.aspx?doc_id=" + doc_id.Value + "&signature=" + signature_file.Value + "&page_count=" + page_count.Value + "&paper_type=" + paper_type.Value; var http = (HttpWebRequest)WebRequest.Create(url); var response = http.GetResponse(); var stream = response.GetResponseStream(); var sr = new StreamReader(stream); string content = sr.ReadToEnd(); Int32 pos_start, pos_stop; string MidString; pos_start = content.IndexOf("submit", 0); pos_stop = content.IndexOf("/>", pos_start); MidString = content.Substring(pos_start - 13, (pos_stop + 2) - (pos_start - 13)); content = content.Replace(MidString, ""); //content = content.Replace("Images/", "Images/" + signature_file.Value); //content = content.Replace("PdfToImage/", "PdfToImage/" + doc_id.Value); content = content.Replace("top:123px", "top:" + dTop.Value.Replace("'", "")); content = content.Replace("left:123px", "left:" + dLeft.Value.Replace("'", "")); content = content.Replace("hidden='hidden'", ""); content = content.Replace("<div class='row vertical-center-row'><div class='text-center col-md-1 col-md-offset-1'></div></div></div>", ""); //if (paper_type.Value =="L") //{ // content = content.Replace("width='790'", "width='1120'"); // content = content.Replace("height='1120'", "height='790'"); //} string path = System.AppDomain.CurrentDomain.BaseDirectory + "tmpFrmApplication.html"; System.IO.File.WriteAllText(path, content); // test git // string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/tmpFormApplication.html"; //DateTime time = DateTime.Now; //string format = "M-d-h-mm-ss"; //string tmp = time.ToString(format); if (HtmlToPdf(currentFile, doc_id.Value, paper_type.Value)) { Model.Log L = new Model.Log(); Helper.Utility Log = new Helper.Utility(); L.content = "Sign PO request success."; L.create_by = Session["EMAIL"].ToString(); Log.WriteLog(L); Model.PO_Document _Doc = new Model.PO_Document(); BLL.PO _BLL = new BLL.PO(); _Doc.sign_prepare_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); _Doc.doc_id = doc_id.Value; _BLL.Update_sign_prepare_date(_Doc); PdfToImage("", _Doc.doc_id); Response.Redirect("./PO_DataDocument.aspx"); //Response.Redirect("./PdfPrepare/" + doc_id.Value + ".Pdf"); } else { // Response.Redirect("./PdfPrepare/" + doc_id.Value + ".Pdf"); } }
void testPostback() { if (txtNot.Text != "") { Model.PO_Document _doc = new Model.PO_Document(); _doc.doc_id = doc_id.Value; _doc.approve_problem = txtNot.Text; BLL.PO _BLL = new BLL.PO(); _BLL.Update_sign_approve_problem(_doc); // Response.Redirect("./DataDocument.aspx"); } else { Model.PO_Document _doc = new Model.PO_Document(); _doc.doc_id = doc_id.Value; _doc.approve_problem = "0"; BLL.PO _BLL = new BLL.PO(); _BLL.Update_sign_approve_problem(_doc); } string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/tmpFrmApplication.html"; var url = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/PO_FrmApplicationApprove.aspx?doc_id=" + doc_id.Value + "&signature=" + signature_file.Value + "&page_count=" + page_count.Value + "&paper_type=" + paper_type.Value + "&top=" + dTop.Value + "&left=" + dLeft.Value; var http = (HttpWebRequest)WebRequest.Create(url); var response = http.GetResponse(); var stream = response.GetResponseStream(); var sr = new StreamReader(stream); string content = sr.ReadToEnd(); Int32 pos_start, pos_stop; string MidString; pos_start = content.IndexOf("submit", 0); pos_stop = content.IndexOf("/>", pos_start); MidString = content.Substring(pos_start - 13, (pos_stop + 2) - (pos_start - 13)); content = content.Replace(MidString, ""); pos_start = content.IndexOf("txtNot", 0); pos_stop = content.IndexOf("/>", pos_start); MidString = content.Substring(pos_start - 13, (pos_stop + 2) - (pos_start - 13)); content = content.Replace(MidString, ""); content = content.Replace("top:5000px", "top:" + dTop.Value.Replace("'", "")); content = content.Replace("left:5000px", "left:" + dLeft.Value.Replace("'", "")); if (txtNot.Text == "") { content = content.Replace("hidden='hidden'", ""); } string path = System.AppDomain.CurrentDomain.BaseDirectory + "tmpFrmApplication.html"; System.IO.File.WriteAllText(path, content); // string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/tmpFormApplication.html"; DateTime time = DateTime.Now; string format = "M-d-h-mm-ss"; string tmp = time.ToString(format); if (HtmlToPdf(currentFile, doc_id.Value, paper_type.Value)) { Model.Log L = new Model.Log(); Helper.Utility Log = new Helper.Utility(); L.content = "Sign PO approve success."; L.create_by = Session["EMAIL"].ToString(); Log.WriteLog(L); Model.PO_Document _Doc = new Model.PO_Document(); BLL.PO _BLL = new BLL.PO(); _Doc.sign_approve_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); _Doc.doc_id = doc_id.Value; _BLL.Update_sign_approve_date(_Doc); ///////////////////////// ReplyMail(); Response.Redirect("./PO_DataDocument.aspx"); } else { // Response.Redirect("./Pdf/" + tmp + ".Pdf"); } }
public int Update_sign_approve_date(Model.PO_Document criteria) { return(_DAL.Update_sign_approve_date(criteria)); }
public int Update_sign_review_date(Model.PO_Document criteria) { return(_DAL.Update_sign_review_date(criteria)); }
public int Update_AttachFile(Model.PO_Document criteria, int val) { return(_DAL.Update_AttachFile(criteria, val)); }
public int Update_Upload_date(Model.PO_Document criteria) { return(_DAL.Update_Upload_date(criteria)); }
public string InsertDocument_po_step1(Model.PO_Document criteria) { return(_DAL.InsertDocument_po_step1(criteria)); }
private bool PdfToImage(string pdfName, string fileCurrentName) { int desired_x_dpi = 300; int desired_y_dpi = 300; int pageCount = 1; string ServerPath = Server.MapPath(".\\"); string pdfPath = Server.MapPath("~/PO_Pdf/" + fileCurrentName + ".pdf"); PdfSharp.Pdf.PdfDocument inputDocument = PdfReader.Open(pdfPath, PdfDocumentOpenMode.ReadOnly); int widthPage = 0; widthPage = (int)inputDocument.Pages[0].Width; if (widthPage > 800) { paper_type = "L"; } else { paper_type = "P"; } using (var rasterizer = new GhostscriptRasterizer()) { rasterizer.Open(pdfPath); pageCount = rasterizer.PageCount; for (var pageNumber = 1; pageNumber <= rasterizer.PageCount; pageNumber++) { if (rasterizer.PageCount > 1) { var pageFilePath = Path.Combine(Server.MapPath("~/PO_PdfToImage/"), fileCurrentName + "_" + (pageNumber) + ".PNG"); var img = rasterizer.GetPage(desired_x_dpi, desired_y_dpi, pageNumber); img.Save(pageFilePath); } else { var pageFilePath = Path.Combine(Server.MapPath("~/PO_PdfToImage/"), fileCurrentName + ".PNG"); var img = rasterizer.GetPage(desired_x_dpi, desired_y_dpi, pageNumber); img.Save(pageFilePath); } } } Model.PO_Document doc = new Model.PO_Document(); doc.doc_id = fileCurrentName; doc.upload_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); doc.page_count = pageCount; doc.paper_type = paper_type; BLL.PO _BLL = new BLL.PO(); _BLL.Update_Upload_date(doc); // Write LOG Model.Log L = new Model.Log(); Helper.Utility Log = new Helper.Utility(); L.content = "Convert PO_PDF to Image success."; L.create_by = Session["EMAIL"].ToString(); Log.WriteLog(L); return(true); }