Exemplo n.º 1
0
        /// <summary>
        /// 将上传文件加到某个批次
        /// </summary>
        /// <param name="curr_user"></param>
        /// <param name="postedFile"></param>
        /// <param name="batch_id"></param>
        /// <returns></returns>
        public static SysAttachment InsertAttachment(SysUserInfo curr_user, System.Web.HttpPostedFile postedFile, string batch_id)
        {
            string originalFilePath = postedFile.FileName;
            // save file
            // get user's site
            SysSiteList site_entity = AttachmentDataAccess.GetSysSiteList(curr_user.SiteSerial);

            if (site_entity == null)
            {
                throw new ApplicationException(string.Format("site [{0}] does not exists.", curr_user.SiteSerial));
            }

            // get site's upload path
            SysDocPath doc_path_entity = AttachmentDataAccess.GetSysDocPath(site_entity.CurrentUploadPathId);

            if (doc_path_entity == null)
            {
                throw new ApplicationException(string.Format("path_id [{0}]does not configed in db.", site_entity.CurrentUploadPathId));
            }
            string baseDir = doc_path_entity.DocPath;

            // get child dir
            DateTime dt_now  = DateTime.Now;
            string   subDir  = dt_now.ToString("yyyyMM");
            string   fileDir = Path.Combine(baseDir, subDir);

            if (!System.IO.Directory.Exists(fileDir))
            {
                System.IO.Directory.CreateDirectory(fileDir);
            }

            string attachmentId    = System.Guid.NewGuid().ToString("D");
            string currentFileName = attachmentId + Path.GetExtension(originalFilePath);
            string currentFilePath = Path.Combine(fileDir, currentFileName);

            postedFile.SaveAs(currentFilePath);

            SysAttachment item = new SysAttachment();

            item.AttachmentId    = attachmentId;
            item.CurrentFileName = currentFileName;
            item.CurrentFileDir  = subDir;
            item.FileSize        = postedFile.ContentLength;
            // postedFile.
            item.OriginalFileName = Path.GetFileName(originalFilePath);
            item.UploadTime       = dt_now;
            item.UploadUser       = curr_user.UserId;
            item.ContentType      = postedFile.ContentType;
            item.PathId           = site_entity.CurrentUploadPathId;
            item.FileExtension    = Path.GetExtension(originalFilePath);

            SysBatchUpload batch_entity = new SysBatchUpload(batch_id, attachmentId);

            AttachmentDataAccess.InsertAttachment(item, batch_entity);

            return(item);
        }
Exemplo n.º 2
0
        public static void DeleteForm(string form_kind, int form_no, string user_id)
        {
            FormHeader formheader = FormHeaderBiz.GetFormHeader(form_kind, form_no);

            FormList formlist = FormListBiz.GetFormList(form_kind);

            SysSiteList sitelist = SysSiteListBiz.GetSiteList(formheader.SiteSerial);

            SimpleFlow.WebFramework.FlowerService.DeleteForm(formlist.FlowerFormKind, formheader.FlowerFormNo, user_id, sitelist.FlowerEngineservice);
        }
Exemplo n.º 3
0
        public static string GetFormFooterHTML(string form_kind, int form_no, string WidthType, string Width, string LogonRegion, bool IsAttachCss, bool IsShowApproveList)
        {
            FormHeader formheader = FormHeaderBiz.GetFormHeader(form_kind, form_no);

            FormList formlist = FormListBiz.GetFormList(form_kind);

            SysSiteList sitelist = SysSiteListBiz.GetSiteList(formheader.SiteSerial);

            return(SimpleFlow.WebFramework.FlowerService.GetFormFooterHTML(formlist.FlowerFormKind, formheader.FlowerFormNo, WidthType, Width, LogonRegion, IsAttachCss, IsShowApproveList, sitelist.FlowerFlowerapi));
        }
Exemplo n.º 4
0
        public static string ApplyForm(string form_kind, int form_no, string form_package)
        {
            FormHeader formheader = FormHeaderBiz.GetFormHeader(form_kind, form_no);

            FormList formlist = FormListBiz.GetFormList(form_kind);

            SysSiteList sitelist = SysSiteListBiz.GetSiteList(formheader.SiteSerial);

            return(SimpleFlow.WebFramework.FlowerService.ApplyForm(formlist.FlowerFormKind, form_package, sitelist.FlowerFormcradle));
        }
Exemplo n.º 5
0
        public static void RecallForm(string form_kind, int form_no,
                                      string user_id, string reason)
        {
            FormHeader formheader = FormHeaderBiz.GetFormHeader(form_kind, form_no);

            FormList formlist = FormListBiz.GetFormList(form_kind);

            SysSiteList sitelist = SysSiteListBiz.GetSiteList(formheader.SiteSerial);

            SimpleFlow.WebFramework.FlowerService.RecallForm(formlist.FlowerFormKind, formheader.FlowerFormNo,
                                                             user_id, reason, sitelist.FlowerFlowerapi);
        }