Example #1
0
        public string InsertDocument_step1(Model.Criteria.Document criteria)
        {
            Class.clsDB db = new Class.clsDB();
            string      sql;

            sql  = "Insert into document(";
            sql += "doc_id,";
            sql += "doc_name,";
            sql += "create_by,";
            sql += "content,";
            sql += "supplier_id,";
            sql += "supplier_name,";
            sql += "attach_file_name,";
            sql += "comment,";
            sql += "secure_prepare) Values(";
            sql += "'" + criteria.doc_id + "',";
            sql += "'" + criteria.doc_name + "',";
            sql += "'" + criteria.create_by + "',";
            sql += "'" + criteria.content + "',";
            sql += "'" + criteria.suplier_id + "',";
            sql += "'" + criteria.supplier_name + "',";
            sql += "'" + criteria.attach_file_name + "',";
            sql += "'" + criteria.comment + "',";
            sql += "'" + criteria.secure_prepare + "')";



            int ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();

            return(ret.ToString());
        }
Example #2
0
        public List <Model.Document> getAll_Document(Model.Criteria.Document criteria)
        {
            //string connStr = Properties.Settings.Default.InventoryControl_ConnectionString;
            //SqlConnection conn = Common.DataHelper.getSQLServerConnectionObject(connStr);
            DataSet ds = new DataSet();
            String  sql;

            sql = "Select * From document where doc_id=" + criteria.doc_id;
            Class.clsDB db = new Class.clsDB();
            ds = db.ExecuteDataSet(sql);
            db.Close();
            //SqlDataAdapter adp = new SqlDataAdapter("usp_Permission_Read", conn);
            //adp.SelectCommand.CommandType = CommandType.StoredProcedure;
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@PRJ_Code", criteria.PRJ_Code));
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@UserAccount", criteria.UserAccount));
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@PAG_Code", criteria.PAG_Code));
            //  adp.Fill(ds);

            return(ds.Tables[0].AsEnumerable().Select(s => new Model.Document
            {
                doc_id_int = s.Field <int>("doc_id"),
                doc_name = s.Field <string>("doc_name"),
                secure_approve = s.Field <string>("secure_approve"),
                secure_prepare = s.Field <string>("secure_prepare"),
                approve_problem = s.Field <string>("approve_problem"),
                content = s.Field <string>("content")
            }).ToList());
        }
Example #3
0
        public int Update_AttachFile(Model.Criteria.Document criteria, int val)
        {
            string sql;

            sql  = "Update 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);
        }
Example #4
0
        public int Update_sign_review_date(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Update 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);
        }
Example #5
0
        public int Update_sign_approve_problem(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Update 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);
        }
Example #6
0
        public int Update_send_mail_Review(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Update document SET send_mail_approve_date = '" + criteria.send_mail_approve_date + "',step3=1,secure_approve='" + criteria.secure_approve + "'";
            sql += " WHERE doc_id='" + criteria.doc_id + "'";

            Class.clsDB db = new Class.clsDB();
            int         ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();
            return(ret);
        }
Example #7
0
        public int Update_Upload_date(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Update 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);
        }
Example #8
0
        public int Delete_Document(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Delete From document ";
            sql += " WHERE doc_id='" + criteria.doc_id + "'";

            Class.clsDB db = new Class.clsDB();
            int         ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();

            return(ret);
        }
Example #9
0
        protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int         idx = Convert.ToInt32(e.RowIndex);
            GridViewRow Row = grid.Rows[idx];



            Model.Criteria.Document MDL = new Model.Criteria.Document();
            MDL.doc_id = Row.Cells[0].Text;

            BLL.Upload _BLL = new BLL.Upload();
            _BLL.Delete_Document(MDL);

            BindGrid();
            //BLL.job _BLL = new BLL.job();
            //_BLL.Delete_Job(job_id);

            //BindGrid();
        }
Example #10
0
 public List <Model.Document> getAll_Document(Model.Criteria.Document criteria)
 {
     return(_uplDAL.getAll_Document(criteria));
 }
Example #11
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("~/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("~/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("~/PdfToImage/"), 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");
            doc.page_count  = pageCount;
            doc.paper_type  = paper_type;

            BLL.Upload _BLL = new BLL.Upload();


            _BLL.Update_upload_date(doc);


            // Write LOG

            Model.Log      L   = new Model.Log();
            Helper.Utility Log = new Helper.Utility();

            L.content   = "Convert PDF to Image success.";
            L.create_by = Session["EMAIL"].ToString();

            Log.WriteLog(L);

            return(true);
        }
Example #12
0
 public int Delete_Document(Model.Criteria.Document criteria)
 {
     return(_uplDAL.Delete_Document(criteria));
 }
Example #13
0
 public string InsertDocument_step1(Model.Criteria.Document criteria)
 {
     return(_uplDAL.InsertDocument_step1(criteria));
 }
Example #14
0
 public int Update_sign_review_date(Model.Criteria.Document criteria)
 {
     return(_uplDAL.Update_sign_review_date(criteria));
 }
Example #15
0
 public int Update_upload_date(Model.Criteria.Document criteria)
 {
     return(_uplDAL.Update_Upload_date(criteria));
 }
Example #16
0
 public int Update_sign_approve_problem(Model.Criteria.Document criteria)
 {
     return(_uplDAL.Update_sign_approve_problem(criteria));
 }
Example #17
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 + "/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 request success.";
                L.create_by = Session["EMAIL"].ToString();
                Log.WriteLog(L);

                Model.Criteria.Document _Doc = new Model.Criteria.Document();
                BLL.Upload _BLL = new BLL.Upload();

                _Doc.sign_prepare_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                _Doc.doc_id            = doc_id.Value;
                _BLL.Update_send_mail_Request(_Doc);


                PdfToImage("", _Doc.doc_id);

                Response.Redirect("./DataDocument.aspx");

//Response.Redirect("./PdfPrepare/" + doc_id.Value + ".Pdf");
            }
            else
            {
                // Response.Redirect("./PdfPrepare/" + doc_id.Value + ".Pdf");
            }
        }
Example #18
0
 public int Update_AttachFile(Model.Criteria.Document criteria, int val)
 {
     return(_uplDAL.Update_AttachFile(criteria, val));
 }
Example #19
0
 public int Update_send_mail_Request(Model.Criteria.Document criteria)
 {
     return(_uplDAL.Update_send_mail_Request(criteria));
 }
        void testPostback()
        {
            if (txtNot.Text != "")
            {
                Model.Criteria.Document _doc = new Model.Criteria.Document();
                _doc.doc_id          = doc_id.Value;
                _doc.approve_problem = txtNot.Text;
                BLL.Upload _BLL = new BLL.Upload();
                _BLL.Update_sign_approve_problem(_doc);


                //   Response.Redirect("./DataDocument.aspx");
            }
            else
            {
                Model.Criteria.Document _doc = new Model.Criteria.Document();
                _doc.doc_id          = doc_id.Value;
                _doc.approve_problem = "0";
                BLL.Upload _BLL = new BLL.Upload();
                _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 + "/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 approve success.";
                L.create_by = Session["EMAIL"].ToString();
                Log.WriteLog(L);

                Model.Criteria.Document _Doc = new Model.Criteria.Document();
                BLL.Upload _BLL = new BLL.Upload();

                _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("./DataDocument.aspx");
            }
            else
            {
                //   Response.Redirect("./Pdf/" + tmp + ".Pdf");
            }
        }
Example #21
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(".//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 + "/FrmApplicationReview.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.Upload _BLL = new BLL.Upload();
//_BLL.Update_send_mail_Review(_DOC);


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

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



            Response.Redirect("DataDocument.aspx");
        }
Example #22
0
 public int Update_send_mail_Review(Model.Criteria.Document criteria)
 {
     return(_DAL.Update_send_mail_Review(criteria));
 }