Ejemplo n.º 1
0
        private bool PdfToImage(string pdfName, string fileCurrentName)
        {
            int desired_x_dpi = 300;
            int desired_y_dpi = 300;

            string ServerPath = Server.MapPath(".\\");
            string pdfPath    = Server.MapPath(".\\") + "PO_PdfReview/" + fileCurrentName + ".pdf";


            string pageCount;

            BLL.PO _BLL = new BLL.PO();
            pageCount = _BLL.Get_PageCount(Session["DOC_ID"].ToString());


            using (var rasterizer = new GhostscriptRasterizer())
            {
                rasterizer.Open(pdfPath);

                for (var pageNumber = 1; pageNumber <= int.Parse(pageCount); pageNumber++)
                {
                    if (int.Parse(pageCount) > 1)
                    {
                        var pageFilePath = Path.Combine(Server.MapPath("~/PO_PdfToImageReview/"), 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_PdfToImageReview/"), fileCurrentName + ".PNG");
                        var img          = rasterizer.GetPage(desired_x_dpi, desired_y_dpi, pageNumber);
                        img.Save(pageFilePath);
                    }
                }
            }



            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);
        }
        public static Receipt CreateReceiptInvoiceAndReceiptForTransfer(int receiptTypeID, int POID, int warehouseID, int IDPrinted, int userID)
        {
            BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice();
            rctInvoice.AddNew();
            var po = new BLL.PO();

            po.LoadByPrimaryKey(POID);
            var activityID = po.StoreID;

            //Enter Invoice Related Information
            //We should Save the STV Number Here
            rctInvoice.POID           = POID;
            rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000");
            rctInvoice.ExchangeRate   = 1;
            rctInvoice.Insurance      = 0;
            rctInvoice.DateOfEntry    = DateTimeHelper.ServerDateTime;
            rctInvoice.SavedByUserID  = userID;
            rctInvoice.ActivityID     = activityID;
            rctInvoice.IsDeliveryNote = false;
            rctInvoice.InvoiceTypeID  = BLL.InvoiceType.InternalSTV;

            rctInvoice.PrintedDate  = DateTimeHelper.ServerDateTime;
            rctInvoice.Rowguid      = Guid.NewGuid();
            rctInvoice.IsVoided     = false;
            rctInvoice.ShippingSite = " ";
            rctInvoice.IsConvertedFromDeliveryNote = false;
            rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.STV;

            rctInvoice.Save();
            //Save the receipt
            BLL.Receipt receipt   = new Receipt();
            int         receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED);

            receipt.LoadByPrimaryKey(receiptID);
            return(receipt);
        }
Ejemplo n.º 3
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string        message = null;
            List <string> _mailCC = new List <string>();

            foreach (ListItem item in dlemailCC.Items)
            {
                if (item.Selected)
                {
                    _mailCC.Add(item.Value);
                }
            }
            //   ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('" + message + "');", true);

            //string[] _mailCC = null;
            //if (strCC != null)
            //{
            //    _mailCC = strCC.Split(',');
            ////String strCC = Request.Form["dlemailCC"].ToString();
            ////string[] _mailCC = null;
            ////if (strCC != null)
            ////{
            ////    _mailCC = strCC.Split(',');
            ////}


            String tmpMail;


            tmpMail = Request.Form["dlemail"].ToString();

            initDataAccount(tmpMail);

            string[]      mailTo       = new string[] { tmpMail };
            List <string> myCollection = new List <string>();      // Attach File

            string serverName    = ConfigurationManager.AppSettings["serverName"];
            string strPathAttach = MapPath(".//PO_AttachFiles/" + Session["DOC_ID"].ToString() + ".zip");

            myCollection.Add(strPathAttach);
            StringBuilder mailBody = new StringBuilder();
            string        sTAB     = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

            string mailForm = Session["TITLE"].ToString() + " " + Session["NAME"].ToString() + "   " + Session["SURNAME"].ToString();

            mailBody.AppendLine("<table>");
            mailBody.AppendLine("<tr><td>Subject :" + sTAB + Session["CONTENT"].ToString() + "</td></tr>");
            mailBody.AppendLine("<tr><td>To :" + sTAB + Account.title + "  " + Account.name + "   " + Account.surname + "</td></tr>");
            mailBody.AppendLine("</table><br />");


            string paper_type = Session["PAPER_TYPE"].ToString();
            string page_count = Session["PAGE_COUNT"].ToString();
            string signature;

            BLL.ManageAccount M_BLL = new BLL.ManageAccount();
            signature = M_BLL.Get_Signature_By_Email(tmpMail);



            mailBody.AppendLine("<table>");
            mailBody.AppendLine("<tr><td>Please sign form applicaion <a href='ht" + "tp://" + serverName + "/PO_FrmApplicationApprove.aspx?doc_id=" + Session["DOC_ID"].ToString() + "&email=" + tmpMail + "&page_count=" + page_count + "&paper_type=" + paper_type + "&signature=" + signature + "'>Click here.</a> </td></tr>");
            mailBody.AppendLine("<tr><td><BR/></td></tr>");
            mailBody.AppendLine("<tr><td><BR/>Best Regards,<td></tr>");
            mailBody.AppendLine("<tr><td><BR/>" + mailForm + "</td></tr>");
            mailBody.AppendLine("</table><br />");



            Model.Criteria.Document _DOC = new Model.Criteria.Document();
            _DOC.send_mail_approve_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            _DOC.secure_approve         = tmpMail;
            _DOC.doc_id = Session["DOC_ID"].ToString();
            BLL.PO _BLL = new BLL.PO();
            //    _BLL.Update_send_mail_approve_date(_DOC);


            m_content = Session["CONTENT"].ToString();

            //Helper.Utility.SendEmail(mailTo, _mailCC.ToArray(), m_content,mailBody.ToString(),true,myCollection.ToArray(),mailForm);



            Response.Redirect("DataDocument.aspx");
        }
Ejemplo n.º 4
0
        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");
            }
        }
Ejemplo n.º 5
0
        private bool PdfToImage(string pdfName, string fileCurrentName)
        {
            int desired_x_dpi = 300;
            int desired_y_dpi = 300;

            string ServerPath = Server.MapPath(".\\");
            string pdfPath    = Server.MapPath(".\\") + "PO_PdfRequest/" + fileCurrentName + ".pdf";



            string pageCount;

            BLL.PO _BLL = new BLL.PO();
            pageCount = _BLL.Get_PageCount(Session["DOC_ID"].ToString());



            //for (int i = 0; i < int.Parse(pageCount); i++)
            //{



            //    if (int.Parse(pageCount) > 1)
            //    {
            //        zoomImg.Save(@ServerPath + "/PdfToImageApprove/" + fileCurrentName + "_" + (i + 1) + ".PNG");

            //    }
            //    else
            //    {
            //        zoomImg.Save(@ServerPath + "/PdfToImageApprove/" + fileCurrentName + ".PNG");

            //    }
            //}


            using (var rasterizer = new GhostscriptRasterizer())
            {
                rasterizer.Open(pdfPath);

                for (var pageNumber = 1; pageNumber <= int.Parse(pageCount); pageNumber++)
                {
                    if (int.Parse(pageCount) > 1)
                    {
                        var pageFilePath = Path.Combine(Server.MapPath("~/PO_PdfToImageRequest/"), 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_PdfToImageRequest/"), fileCurrentName + ".PNG");
                        var img          = rasterizer.GetPage(desired_x_dpi, desired_y_dpi, pageNumber);
                        img.Save(pageFilePath);
                    }
                }
            }

            //Model.Criteria.Document doc = new Model.Criteria.Document();
            //doc.doc_id = fileCurrentName;
            //doc.upload_date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");

            //BLL.Upload _BLL = new BLL.Upload();
            //int ret;
            //ret = _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);
        }
Ejemplo n.º 6
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");
            }
        }
        public static Receipt CreateReceiptInvoiceAndReceiptForTransfer(int receiptTypeID, int POID, int warehouseID, int IDPrinted, int userID)
        {
            BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice();
            rctInvoice.AddNew();
            var po = new BLL.PO();
            po.LoadByPrimaryKey(POID);
            var activityID = po.StoreID;

            //Enter Invoice Related Information
            //We should Save the STV Number Here
            rctInvoice.POID = POID;
            rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000");
            rctInvoice.ExchangeRate = 1;
            rctInvoice.Insurance = 0;
            rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime;
            rctInvoice.SavedByUserID = userID;
            rctInvoice.ActivityID = activityID;
            rctInvoice.IsDeliveryNote = false;
            rctInvoice.InvoiceTypeID = BLL.InvoiceType.InternalSTV;

            rctInvoice.PrintedDate = DateTimeHelper.ServerDateTime;
            rctInvoice.Rowguid = Guid.NewGuid();
            rctInvoice.IsVoided = false;
            rctInvoice.ShippingSite = " ";
            rctInvoice.IsConvertedFromDeliveryNote = false;
            rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.STV;

            rctInvoice.Save();
            //Save the receipt
            BLL.Receipt receipt = new Receipt();
            int receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED);
            receipt.LoadByPrimaryKey(receiptID);
            return receipt;
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        //protected void UploadMultipleFiles(object sender, EventArgs e)
        //{

        //    foreach (HttpPostedFile postedFile in FileUpload2.PostedFiles)
        //    {
        //        string fileName = Path.GetFileName(postedFile.FileName);
        //        postedFile.SaveAs(Server.MapPath("~/PDF/") + fileName);
        //    }
        //    lblSuccess.Text = string.Format("{0} files have been uploaded successfully.", FileUpload1.PostedFiles.Count);
        //}


        protected void btnUpload_Click(object sender, EventArgs e)
        {
            //// For test

            // String  strCC = Request.Form["dlemailCC"].ToString();
            // string[] _mailCC = null;
            //if (strCC != null)
            //{
            //    _mailCC = strCC.Split(',');
            //}

            //////////

            //String tmpMail;
            //tmpMail = Request.Form["dlemail"].ToString();

            //       string[] mailTo = new string[] {tmpMail };
            List <string> myCollection  = new List <string>();
            List <string> ZipCollection = new List <string>();

            ///  UploadMain PDF

            if (UploadMain())
            {
                HttpFileCollection fileCollection = Request.Files;
                for (int i = 1; i < fileCollection.Count; i++)
                {
                    HttpPostedFile uploadfile = fileCollection[i];
                    string         fileName   = Path.GetFileName(uploadfile.FileName);
                    if (uploadfile.ContentLength > 0)
                    {
                        uploadfile.SaveAs(Server.MapPath("~/PO_AttachFiles/") + fileName);
                        myCollection.Add(Server.MapPath("~/PO_AttachFiles/") + fileName);
                        lblMessage.Text += fileName + "  Saved  Successfully<br>";
                        BLL.PO _BLL = new BLL.PO();
                        _BLL.Update_AttachFile(Doc, 1);
                    }

                    else
                    {
                        BLL.PO _BLL = new BLL.PO();
                        _BLL.Update_AttachFile(Doc, 0);
                    }
                }


                //Zip

                using (Ionic.Zip.ZipFile compress = new Ionic.Zip.ZipFile())
                {
                    string zipfilepath = Server.MapPath("~/PO_AttachFiles/");
                    compress.AddFiles(myCollection.ToArray(), Doc.doc_id);
                    compress.Save(Server.MapPath("~/PO_AttachFiles/") + Doc.doc_id + ".zip");
                }

                Response.Redirect("PO_DataDocument.aspx");
            }


            //     Helper.Utility.SendEmail("Test ODS",mailTo, _mailCC , myCollection.ToArray(),"This is link",false);

            //       Response.Redirect("Default.aspx");
        }
Ejemplo n.º 10
0
        private bool UploadMain()
        {
            if (FileUpload1.HasFile)
            {
                string folderPath = Server.MapPath("~/PO_Pdf/");
                //Check whether Directory (Folder) exists.


                if (!Directory.Exists(folderPath))
                {
                    //If Directory (Folder) does not exists. Create it.
                    Directory.CreateDirectory(folderPath);
                }

                FileUpload fu = FileUpload1;

                String   fileExtension     = System.IO.Path.GetExtension(fu.FileName).ToLower();
                String[] allowedExtensions = { ".pdf" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        try
                        {
                            ClsModule mdl = new ClsModule();
                            Doc.doc_id           = Request.QueryString["doc_id"].ToString();
                            Doc.pr_doc_id        = Request.QueryString["doc_id"].ToString();
                            Doc.doc_name         = fu.FileName;
                            Doc.create_by        = Session["NAME"].ToString();
                            Doc.secure_prepare   = Session["EMAIL"].ToString();
                            Doc.attach_file_name = Doc.doc_id + ".zip";
                            Doc.content          = Content.Text;
                            Doc.comment          = comment.Value;
                            Doc.pr_flag          = 1;


                            string s_newfilename = Doc.doc_id + fileExtension;
                            fu.PostedFile.SaveAs(folderPath + s_newfilename);
                            Thread.Sleep(3000);
                            // Insert DB

                            string ret;
                            BLL.PO _BLL = new BLL.PO();
                            string temp;

                            ret = _BLL.InsertDocument_po_step1(Doc);

                            if (ret == "1")
                            {
                                Response.Write("1");
                                Model.Log      L   = new Model.Log();
                                Helper.Utility Log = new Helper.Utility();

                                L.content   = "Upload success.";
                                L.create_by = Session["EMAIL"].ToString();

                                Log.WriteLog(L);



                                PdfToImage("", Doc.doc_id);
                            }
                            else
                            {
                                Model.Log      L   = new Model.Log();
                                Helper.Utility Log = new Helper.Utility();

                                L.content   = "Can not upload.";
                                L.create_by = Session["EMAIL"].ToString();

                                Log.WriteLog(L);
                            }



                            //    lblMessage.Text = Path.GetFileName(FileUpload1.FileName) + " has been uploaded.";
                            //imagepath = ImageSavedPath + s_newfilename;
                            return(true);
                        }
                        catch (Exception ex)
                        {
                            Response.Write(ex.Message);
                            Response.Write("File could not be uploaded.");
                            Response.End();
                            //  return false;
                        }
                    }
                    else
                    {
                        Response.Write("Please upload pdf file only.");
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                Response.Write("<script>alert('โปรดเลือกเอกสารที่ต้องการ Approve ก่อน');</script>");
                return(false);
            }
        }