コード例 #1
0
        /// <summary>
        /// 儲存至DB
        /// </summary>
        /// <param name="docID"></param>
        /// <param name="isoNum"></param>
        /// <param name="savePath"></param>
        /// <param name="file"></param>
        public void SaveDB(int docID, string isoNum, string savePath, string urlPath, string fileName, double fileSize, string saveMode)
        {
            double b  = (double)fileSize;
            double kb = b / 1024;
            double mb = kb / 1024;
            double gb = mb / 1024;

            IsoFiles f = new IsoFiles()
            {
                MAP_MAIN_ID = docID,
                BUD_DT      = DateTime.UtcNow.AddHours(8),
                FILE_NM     = fileName,
                FILE_SZ     = mb,
                FILE_PATH   = savePath,
                URL_PATH    = urlPath,
                REF_ISO_NUM = isoNum,
                UP_MODE     = saveMode
            };

            try
            {
                this.DB.IsoFiles.Add(f);
                this.DB.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        /// <summary>
        /// 取得所有ISO表單列表
        /// </summary>
        /// <returns></returns>
        public List <IsoManageDataModel> GetAllIsoAppListForManage()
        {
            List <IsoManageDataModel> data = new List <IsoManageDataModel>();
            var resultList = this.DB.IsoMain.ToList();

            foreach (var r in resultList)
            {
                IsoManageDataModel d = new IsoManageDataModel()
                {
                    ID                = r.ID,
                    Applicant         = r.APP_USR,
                    ApplicationDate   = r.APP_DT,
                    ApplicationStatus = r.APP_ST,
                    IsoNumber         = r.ISO_NUM,
                    IsoDocmentLevel   = r.DOC_LEVEL,
                    AppUser           = r.APP_USR,
                    Remark            = r.REMARK
                };
                var userFileProto = GetFileByDocID(r.ID, "User");
                foreach (var f in userFileProto)
                {
                    IsoFiles file = new IsoFiles()
                    {
                        ID        = f.ID,
                        FILE_NM   = f.FILE_NM,
                        FILE_PATH = f.FILE_PATH,
                        URL_PATH  = f.URL_PATH,
                        FILE_SZ   = f.FILE_SZ,
                        BUD_DT    = f.BUD_DT
                    };
                    d.UserFiles.Add(file);
                }

                var manageFileProto = GetFileByDocID(r.ID, "Manage");
                foreach (var f in manageFileProto)
                {
                    IsoFiles file = new IsoFiles()
                    {
                        ID        = f.ID,
                        FILE_NM   = f.FILE_NM,
                        FILE_PATH = f.FILE_PATH,
                        URL_PATH  = f.URL_PATH,
                        FILE_SZ   = f.FILE_SZ,
                        BUD_DT    = f.BUD_DT
                    };
                    d.ManageFiles.Add(file);
                }

                data.Add(d);
            }

            foreach (var d in data)
            {
                d.EmployeeData = GetEmployeeDataWithIso(d.AppUser);
            }
            return(data);
        }