Example #1
0
        //[HttpPost]
        public string GetDataUrl()
        {
            // return Session["url"].ToString();
            if (Session["UserID"] != null)
            {
                return Session["url"].ToString();

            }
            else
            {
                IDataFactoty dataFactoty=new DataFactoty();
                List<int> cout = dataFactoty.CreatDataService().GetByAppID(Convert.ToInt32(Session["id"]));
                if (cout[0]>0)
                {
                    return Session["url"].ToString();
                }

            }
            return null;
            //ViewBag.URL = url;
        }
Example #2
0
        public dynamic Uploaded(bu_datum datum, AnyModel model, List<HttpPostedFileBase> fileUpload)
        {
            //int Resid = BllBuilder.BuilRes().DataAdd(modelRe, Num, modelCase, modelSuspect);
            try
            {
                IDataFactoty dataFactoty = new DataFactoty();
                foreach (HttpPostedFileBase item in fileUpload)
                {

                    if (item != null && Array.Exists(model.FilesToBeUploaded.Split(','), s => s.Equals(item.FileName)))
                    {
                        // string path = AppDomain.CurrentDomain.BaseDirectory + "Picture/";
                        // string filename = Path.GetFileName(Request.Files[upload].FileName);
                        string dt =
                            (DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.Hour +
                             Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10)).Substring(0, 15);

                        item.SaveAs(Server.MapPath(Path.Combine("~/File/Pdf", dt+".pdf")));
                        datum.CreateDate = DateTime.Now;
                        datum.DataURL = "/File/Pdfs/" + dt ;
                        datum.DataSize = item.ContentLength.ToString();
                        datum.DataSeq = dt;
                        int useid = (int) Session["UserID"];
                        dataFactoty.CreatDataService().Uploaded(datum, useid);

                       // PDFSetWaterMark.setWatermark(Server.MapPath(Path.Combine("~/File/Pdf", dt + ".pdf")), Server.MapPath(Path.Combine("~/File/Pdfs", dt + ".pdf")), "咸宁市人民检察院卷宗");
                        //System.IO.File.Delete(Server.MapPath(Path.Combine("~/File/Pdf", dt + ".pdf")));

                        PDFSetWaterMark.PDFStamp(Server.MapPath(Path.Combine("~/File/Pdf", dt + ".pdf")), Server.MapPath(Path.Combine("~/File/Pdfs", dt + ".pdf")), Server.MapPath("~/File/WarterImade/water.png"));
                        System.IO.File.Delete(Server.MapPath(Path.Combine("~/File/Pdf", dt + ".pdf")));

                        //ww_Photo myPhoto = new ww_Photo()
                        //{
                        //    BoolDel = false,
                        //    ResID = Resid,
                        //    PhotoURL = "/Picture/" + dt + item.FileName,
                        //};
                        //BllBuilder.BuilPhoto().Upload(myPhoto);
                        // item.SaveAs(Server.MapPath("~/Picture/NewFolder1"));
                        //Save or do your action -  Each Attachment ( HttpPostedFileBase item )
                    }
                }
                return Redirect("/admin/index");
            }
            catch (Exception)
            {

                throw;
            }
            return Redirect("/admin/index");
            //return "KO";
        }