コード例 #1
0
        /// <summary>
        /// 굽기완료된 명령정보 삭제
        /// </summary>
        /// <param name="orderId"></param>
        public static void DeleteBurnEndOrder(string orderId)
        {
            try
            {
                bool delOK = true;

                //// 오더 폴더 삭제
                string orderFolder = Path.Combine(GlobalVar.ProgramExecuteFolder, GlobalVar.ORDER_FOLDER, orderId);

                ////foreach (string str in Directory.GetFiles(GlobalVar.BURN_JOB_END_FL))
                ////{
                ////    if (str.Contains(GlobalVar.BURN_JOB_END_FL))
                ////    {
                ////        delOK = true;
                ////        break;
                ////    }
                ////}

                if (delOK)
                {
                    FileControl.ClearDirectory(orderFolder);
                }
            }
            catch { }
        }
コード例 #2
0
        /// <summary>
        /// 다운로드 폴더명 바꾸기 => 다운로드 폴더 -> 환자명
        /// </summary>
        /// <param name="patName"></param>
        public static string ChangeDownloadFolderToPatientFolder(string patNo, string patName)
        {
            ////변경후폴더명
            string patientFolderName = string.Format("MC_{0}_{1}_{2}", DateTime.Now.ToString("yyyyMMdd"), patNo, patName);

            try
            {
                string        fld = Path.Combine(GlobalVar.configEntity.LocalShareFolder, patientFolderName);
                DirectoryInfo dri = new DirectoryInfo(fld);

                if (dri.Exists)
                {
                    string fld_new = "";

                    if (patName.Contains("("))
                    {
                        int    s  = patName.IndexOf("(", 0);
                        int    e  = patName.IndexOf(")", 0);
                        string no = patName.Substring(s + 1, (e - s - 1));
                        int    i  = Convert.ToInt16(no);

                        fld_new = patName.Replace("(" + no + ")", "(" + (i + 1).ToString() + ")");
                    }
                    else
                    {
                        fld_new = patName + "(1)";
                    }

                    patientFolderName = string.Format("MC_{0}_{1}_{2}", DateTime.Now.ToString("yyyyMMdd"), patNo, fld_new);
                    ChangeDownloadFolderToPatientFolder(patNo, fld_new);
                }
                else
                {
                    DirectoryInfo downFld = new DirectoryInfo(GlobalVar.configEntity.DicomDownloadFolder);
                    downFld.MoveTo(fld);

                    DirectoryInfo downFld2 = new DirectoryInfo(GlobalVar.configEntity.DicomDownloadFolder);
                    if (downFld2.Exists)
                    {
                        FileControl.ClearDirectory(downFld2.FullName);
                    }
                    else
                    {
                        downFld2.Create();
                    }
                }

                return(patientFolderName);
            }
            catch
            {
                throw;
            }
        }
コード例 #3
0
 /// <summary>
 /// 폴더 사이즈 가져오기
 /// </summary>
 /// <param name="folderPath"></param>
 /// <returns></returns>
 public static FolderInfo GetFolderLength(string folderPath)
 {
     return(FileControl.DirectoryLength(new DirectoryInfo(folderPath)));
 }
コード例 #4
0
 /// <summary>
 /// 폴더 사이즈 가져오기
 /// </summary>
 /// <param name="folderPath"></param>
 /// <returns></returns>
 public static long GetFolderLengthOnly(string folderPath)
 {
     return(FileControl.DirectoryLengthOnly(new DirectoryInfo(folderPath)));
 }
コード例 #5
0
        //Order Log, 환자폴더, Error log 파일 삭제
        public void Workflow(System.ComponentModel.BackgroundWorker worker, System.ComponentModel.DoWorkEventArgs e)
        {
            try
            {
                //// .pOrd 파일 삭제
                foreach (string file in Directory.GetFiles(folderLoot, "*.pOrd"))
                {
                    File.Delete(file);
                }
            }
            catch { }

            //// 굽기 명령 정보 삭제
            try
            {
                DirectoryInfo logDir = new DirectoryInfo(Path.Combine(folderLoot, GlobalVar.ORDER_FOLDER));
                Dictionary <string, string> delTargetOrderFiles = new Dictionary <string, string>();
                if (1 > retentionPeriod)
                {
                    retentionPeriod = 1;
                }

                foreach (FileInfo fi in logDir.GetFiles())
                {
                    DateTime diDt = fi.CreationTime.Date;
                    if (diDt <= DateTime.Now.AddDays(retentionPeriod * -1).Date)
                    {
                        //// 굽기명령 파일인 경우 하위 환자폴더도 삭제
                        if (fi.Name.EndsWith("ORD"))
                        {
                            string json = File.ReadAllText(fi.FullName);
                            BurnOrderedInfoEntity burnOrderInfo = JsonParser.ConvertToBurnOrderedInfoEntity(json);

                            //// 환자폴더 삭제
                            FileControl.DeleteFolder(burnOrderInfo.patFolderFullPath);
                            //// 머지파일 삭제
                            FileControl.DeleteFile(burnOrderInfo.MegPath);
                            //// EditList 파일 삭제
                            FileControl.DeleteFile(burnOrderInfo.EditListPath);
                            //// TraceLog 폴더 삭제
                            FileControl.DeleteFolder(burnOrderInfo.OrderId);
                        }

                        fi.Delete();
                    }
                }

                //// Order.xml 파일 삭제
                foreach (DirectoryInfo ddr in logDir.GetDirectories("SVR_*"))
                {
                    foreach (FileInfo file in ddr.GetFiles("Orders_*.xml"))
                    {
                        if (file.CreationTime.Date < DateTime.Now.Date)
                        {
                            file.Delete();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogWrite(null, ex.ToString(), folderLoot);
            }

            //// 에러로그 삭제
            try
            {
                DirectoryInfo errDir = new DirectoryInfo(Path.Combine(folderLoot, GlobalVar.LOG_ERR_FLD));
                foreach (FileInfo fi in errDir.GetFiles())
                {
                    if (fi.CreationTime.Date <= DateTime.Now.AddDays(-30).Date)
                    {
                        FileControl.DeleteFile(fi.FullName, false);
                    }
                }
            }
            catch { }

            //에러로그 삭제
            try
            {
                DirectoryInfo errDir = new DirectoryInfo(Path.Combine(folderLoot, GlobalVar.ORDER_FOLDER, "ERRORS"));
                foreach (FileInfo fi in errDir.GetFiles())
                {
                    if (fi.CreationTime.Date <= DateTime.Now.AddDays(-30).Date)
                    {
                        FileControl.DeleteFile(fi.FullName, false);
                    }
                }
            }
            catch { }

            //// 완료로그, 삭제로그 파일 삭제
            try
            {
                DirectoryInfo errDir = new DirectoryInfo(Path.Combine(folderLoot, GlobalVar.LOG_END_FLD));
                foreach (FileInfo fi in errDir.GetFiles())
                {
                    FileControl.DeleteFile(fi.FullName, false);
                }
            }
            catch { }

            //// 작업폴더 내용 삭제하기
            if (deleteInJobFolder == "Y")
            {
                try
                {
                    //// 다운로드 폴더안을 정리
                    foreach (string fl in Directory.GetFiles(this.downloadFolder))
                    {
                        try
                        {
                            File.Delete(fl);
                        }
                        catch { }
                    }

                    foreach (string dir in Directory.GetDirectories(this.downloadFolder))
                    {
                        FileControl.ClearDirectory(dir);
                    }
                }
                catch { }
            }

            //// 굽기 로그 삭제
            try
            {
                DirectoryInfo dirOrder = new DirectoryInfo(Path.Combine(folderLoot, GlobalVar.ORDER_FOLDER));

                foreach (DirectoryInfo dri in dirOrder.GetDirectories())
                {
                    if (dri.Name.StartsWith("ERRORS"))
                    {
                        continue;
                    }

                    if (dri.Name.StartsWith("SVR_"))
                    {
                        ////서버 설정,상태값 파일은 삭제하지 않음.
                        foreach (var fl in Directory.GetFiles(dri.FullName))
                        {
                            if (fl.Contains(GlobalVar.SERVER_CONFIG_FL) || fl.Contains(GlobalVar.SERVER_STATUS_FL))
                            {
                                continue;
                            }

                            try
                            {
                                File.Delete(fl);
                            }
                            catch { }
                        }
                    }
                    else
                    {
                        try
                        {
                            dri.Delete(true);
                        }
                        catch { }
                    }
                }
            }
            catch { }
        }