Ejemplo n.º 1
0
        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");
            }
        }