Esempio n. 1
0
        /// <summary>
        /// Tray專案排序(依創建日期)
        /// </summary>
        /// <param name="array">專案陣列</param>
        /// <param name="left">輸入0</param>
        /// <param name="right">輸入array.count()-1</param>
        /// <param name="FirstIn">輸入true</param>
        public void Sort_Tray(List <TrayInformation> array, int left, int right, bool FirstIn)
        {
            if (FirstIn == true)
            {
                Filter_Tray(array, ref right);
            }

            if (left < right)
            {
                int             i    = left - 1;                  //left margin
                int             j    = right + 1;                 //right margin
                TrayInformation axle = array[(left + right) / 2]; //axle

                while (true)
                {
                    while (array[++i].CreateDate > axle.CreateDate)
                    {
                        ;
                    }
                    while (array[--j].CreateDate < axle.CreateDate)
                    {
                        ;
                    }
                    if (i >= j)
                    {
                        break;
                    }

                    Swap_TrayCase(array, i, j);
                }

                Sort_Tray(array, left, (i - 1), false);
                Sort_Tray(array, (j + 1), right, false);
            }
        }
Esempio n. 2
0
        private void Swap_TrayCase(List <TrayInformation> array, int left, int right)
        {
            TrayInformation tmpCase = array[left];

            array[left]  = array[right];
            array[right] = tmpCase;
        }
 public void SetTrayDetailInfo(TrayInformation Import)
 {
     TrayInfo                = Import;
     textbox_Order.Text      = TrayInfo.OrderID;
     textbox_DesignStep.Text = TrayInfo.DesignStepString;
     textbox_Brand.Text      = TrayInfo.Brand;
     textbox_CreateDate.Text = TrayInfo.CreateDate.ToLongDateString() + " " + TrayInfo.CreateDate.ToLongTimeString();
     textbox_ModifyDate.Text = TrayInfo.ModifyDate.ToLongDateString() + " " + TrayInfo.ModifyDate.ToLongTimeString();
 }
 public Detail_traysplint()
 {
     InitializeComponent();
     TrayInfo                = null;
     SplintInfo              = null;
     textbox_Order.Text      = "";
     textbox_DesignStep.Text = "";
     textbox_Brand.Text      = "";
     textbox_CreateDate.Text = "";
     textbox_ModifyDate.Text = "";
 }
Esempio n. 5
0
        /// <summary>
        /// 讀各專案Xml檔內的資料
        /// </summary>
        /// <param name="SoftwareID">軟體ID 參考_SoftwareID</param>
        /// <param name="XmlPath">Xml路徑</param>
        /// <returns></returns>
        private bool LoadXml(int SoftwareID, string XmlPath)
        {
            XDocument xmlDoc;
            FileInfo  fInfo = new FileInfo(XmlPath);//要取得檔案創建日期和修改日期

            try
            {
                xmlDoc = XDocument.Load(XmlPath);
            }
            catch
            {
                return(false);
            }

            switch (SoftwareID)
            {
            case (int)_softwareID.EZCAD:
            {
                //判斷是否為Material的XML
                if (xmlDoc.Element("OrderExport") == null)
                {
                    return(false);
                }

                try
                {
                    XElement xml         = xmlDoc.Element("OrderExport");
                    string   xOrderID    = xml.Element("OrderInfo").Element("OrderID").Value;     //ordernumer-custom
                    string   xClient     = xml.Element("OrderInfo").Element("Client").Value;      //Client
                    string   xTechnician = xml.Element("OrderInfo").Element("Technician").Value;  //Technicain
                    string   xPatient    = xml.Element("OrderInfo").Element("Patient").Value;     //patient
                    string   xOrderNote  = xml.Element("OrderInfo").Element("Note").Value;        //Note
                    string   xDesignStep = xml.Element("DesignInfo").Element("DesignStep").Value; //DesignStep
                    string   xVersion    = xml.Element("DesignInfo").Element("Version").Value;    //Version

                    CadInformation cadInfo = new CadInformation
                    {
                        OrderID           = xOrderID,
                        PatientName       = xPatient,
                        CreateDate        = fInfo.CreationTime,
                        ModifyDate        = fInfo.LastWriteTime,
                        DesignStep        = Convert.ToInt32(xDesignStep),
                        CaseDirectoryPath = Path.GetDirectoryName(XmlPath),
                        CaseXmlPath       = XmlPath,
                        Client            = xClient,
                        Technician        = xTechnician,
                        Note       = xOrderNote,
                        CADversion = new Version(xVersion)
                    };
                    Caselist_EZCAD.Add(cadInfo);

                    return(true);
                }
                catch (Exception ex)
                {
                    log.RecordLog(new StackTrace(true).GetFrame(0).GetFileLineNumber().ToString(), "ProjectHandle.cs LoadXml(EZCAD) Exception", ex.Message);
                    return(false);
                }
            }

            case (int)_softwareID.Implant:
            {
                if (xmlDoc.Element("ImplantOrderExport") == null)
                {
                    return(false);
                }

                try
                {
                    XElement xml = xmlDoc.Element("ImplantOrderExport");

                    ImplantOuterInformation tmpImpOuterInfo = new ImplantOuterInformation
                    {
                        OrderNumber       = xml.Element("OrderInfo").Element("OrderNo").Value,
                        PatientName       = xml.Element("OrderInfo").Element("PatientName").Value,
                        CaseDirectoryPath = Path.GetDirectoryName(XmlPath) + @"\",
                        CreateDate        = fInfo.CreationTime,
                        ModifyDate        = fInfo.LastWriteTime
                    };
                    try
                    {
                        if (xml.Element("OrderInfo").Element("PatientGender").Value.ToLower() == "male")
                        {
                            tmpImpOuterInfo.Gender = true;
                        }
                        else
                        {
                            tmpImpOuterInfo.Gender = false;
                        }
                    }
                    catch
                    {
                        tmpImpOuterInfo.Gender = false;
                    }
                    try
                    {
                        string pbirthday = xml.Element("OrderInfo").Element("PatientBirthday").Value + "T00:00:00";
                        tmpImpOuterInfo.PatientBirth = Convert.ToDateTime(pbirthday);
                    }
                    catch
                    {
                        tmpImpOuterInfo.PatientBirth = new DateTime();
                    }
                    try { tmpImpOuterInfo.Clinic = xml.Element("OrderInfo").Element("Clinic").Value; } catch { tmpImpOuterInfo.Clinic = ""; }
                    try { tmpImpOuterInfo.Note = xml.Element("OrderInfo").Element("Note").Value; } catch { tmpImpOuterInfo.Note = ""; }

                    try { tmpImpOuterInfo.SurgicalGoal = xml.Element("CaseInfo").Element("SurgicalGoal").Value; } catch { tmpImpOuterInfo.SurgicalGoal = ""; }
                    try { tmpImpOuterInfo.SurgicalGuide = xml.Element("CaseInfo").Element("SurgicalGuide").Value; } catch { tmpImpOuterInfo.SurgicalGuide = ""; }
                    try { tmpImpOuterInfo.SurgicalOption = xml.Element("CaseInfo").Element("SurgicalOption").Value; } catch { tmpImpOuterInfo.SurgicalOption = ""; }
                    try { tmpImpOuterInfo.Surgicalkit = xml.Element("CaseInfo").Element("Surgicalkit").Value; } catch { tmpImpOuterInfo.Surgicalkit = ""; }

                    try { tmpImpOuterInfo.CBCTPath = xml.Element("ImageData").Element("CBCTPath").Value; } catch { tmpImpOuterInfo.CBCTPath = ""; }
                    try { tmpImpOuterInfo.JawPath = xml.Element("ImageData").Element("JawPath").Value; } catch { tmpImpOuterInfo.JawPath = ""; }
                    try { tmpImpOuterInfo.JawTrayPath = xml.Element("ImageData").Element("JawTrayPath").Value; } catch { tmpImpOuterInfo.JawTrayPath = ""; }
                    try { tmpImpOuterInfo.DenturePath = xml.Element("ImageData").Element("DenturePath").Value; } catch { tmpImpOuterInfo.DenturePath = ""; }
                    tmpImpOuterInfo.XmlfilePath = XmlPath;
                    Caselist_ImplantOuterCase.Add(tmpImpOuterInfo);

                    return(true);
                }
                catch (Exception ex)
                {
                    log.RecordLog(new StackTrace(true).GetFrame(0).GetFileLineNumber().ToString(), "ProjectHandle.cs LoadXml(Implant) Exception", ex.Message);
                    return(false);
                }
            }

            case (int)_softwareID.Ortho:
            {
                if (xmlDoc.Element("CreateProjectInfo") == null)
                {
                    return(false);
                }
                try
                {
                    XElement xml = xmlDoc.Element("CreateProjectInfo");

                    bool Gender = false;
                    try
                    {
                        if (xml.Element("PatientSex").Value.ToLower() == "true" || xml.Element("PatientSex").Value.ToLower() == "1")
                        {
                            Gender = true;
                        }
                        else
                        {
                            Gender = false;
                        }
                    }
                    catch { }

                    OrthoOuterInformation orthoInfo = new OrthoOuterInformation
                    {
                        CaseDirectoryPath = Path.GetDirectoryName(XmlPath) + @"\",
                        PatientID         = xml.Element("PatientID").Value,
                        PatientName       = xml.Element("PatientName").Value,
                        PatientSex        = Gender
                    };
                    try { orthoInfo.PatientBirth = Convert.ToDateTime(xml.Element("PatientBday").Value); } catch { orthoInfo.PatientBirth = new DateTime(); }
                    try { orthoInfo.PatientAddress = xml.Element("PatientAddress").Value; } catch { orthoInfo.PatientAddress = ""; }
                    try { orthoInfo.DentistName = xml.Element("DentistName").Value; } catch { orthoInfo.DentistName = ""; }
                    try { orthoInfo.ClinicName = xml.Element("ClinicName").Value; } catch { orthoInfo.ClinicName = ""; }
                    try { orthoInfo.CreateDate = Convert.ToDateTime(xml.Element("CreateTime")?.Value); } catch { orthoInfo.CreateDate = fInfo.CreationTime; }

                    Caselist_OrthoOuterCase.Add(orthoInfo);

                    return(true);
                }
                catch (Exception ex)
                {
                    log.RecordLog(new StackTrace(true).GetFrame(0).GetFileLineNumber().ToString(), "ProjectHandle.cs LoadouterXml(Ortho) Exception", ex.Message);
                    return(false);
                }
            }

            case (int)_softwareID.Tray:
            {
                if (xmlDoc.Element("GuideExport") == null)
                {
                    return(false);
                }

                try
                {
                    XElement xml         = xmlDoc.Element("GuideExport");
                    string   xGuideType  = xml.Element("OrderInfo").Element("GuideType").Value;
                    string   xDesignStep = xml.Element("OrderInfo").Element("DesignStep").Value; //DesignStep
                    string   xOrderID    = xml.Element("ProjectName").Value;                     //ordernumer-custom

                    TrayInformation trayInfo = new TrayInformation
                    {
                        OrderID           = xOrderID,
                        Brand             = xml.Element("OrderInfo").Element("Brand").Value,
                        CreateDate        = fInfo.CreationTime,
                        ModifyDate        = fInfo.LastWriteTime,
                        GuideType         = Convert.ToInt16(xGuideType),
                        DesignStep        = Convert.ToInt32(xDesignStep),
                        CaseDirectoryPath = Path.GetDirectoryName(XmlPath),
                        CaseXmlPath       = XmlPath
                    };
                    Caselist_Tray.Add(trayInfo);

                    return(true);
                }
                catch (Exception ex)
                {
                    log.RecordLog(new StackTrace(true).GetFrame(0).GetFileLineNumber().ToString(), "ProjectHandle.cs LoadXml(Tray) Exception", ex.Message);
                    return(false);
                }
            }

            case (int)_softwareID.Splint:
            {
                if (xmlDoc.Element("GuideExport") == null)
                {
                    return(false);
                }

                try
                {
                    XElement xml         = xmlDoc.Element("GuideExport");
                    string   xGuideType  = xml.Element("OrderInfo").Element("GuideType").Value;
                    string   xDesignStep = xml.Element("OrderInfo").Element("DesignStep").Value; //DesignStep
                    string   xOrderID    = xml.Element("ProjectName").Value;                     //ordernumer-custom

                    SplintInformation splintInfo = new SplintInformation
                    {
                        OrderID           = xOrderID,
                        Brand             = xml.Element("OrderInfo").Element("Brand").Value,
                        CreateDate        = fInfo.CreationTime,
                        ModifyDate        = fInfo.LastWriteTime,
                        GuideType         = Convert.ToInt16(xGuideType),
                        DesignStep        = Convert.ToInt32(xDesignStep),
                        CaseDirectoryPath = Path.GetDirectoryName(XmlPath),
                        CaseXmlPath       = XmlPath
                    };
                    Caselist_Splint.Add(splintInfo);

                    return(true);
                }
                catch (Exception ex)
                {
                    log.RecordLog(new StackTrace(true).GetFrame(0).GetFileLineNumber().ToString(), "ProjectHandle.cs LoadXml(Splint) Exception", ex.Message);
                    return(false);
                }
            }
            }

            return(true);
        }