예제 #1
0
        /// <summary>
        /// EZCAD專案排序(依創建日期)
        /// </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_EZCAD(List <CadInformation> array, int left, int right, bool FirstIn)
        {
            if (FirstIn == true)
            {
                Filter_EZCAD(array, ref right);
            }

            if (left < right)
            {
                int            i    = left - 1;                  //left margin
                int            j    = right + 1;                 //right margin
                CadInformation 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_EZCADCase(array, i, j);
                }

                Sort_EZCAD(array, left, (i - 1), false);
                Sort_EZCAD(array, (j + 1), right, false);
            }
        }
예제 #2
0
        private void Swap_EZCADCase(List <CadInformation> array, int left, int right)
        {
            CadInformation tmpCase = array[left];

            array[left]  = array[right];
            array[right] = tmpCase;
        }
예제 #3
0
        private bool ToothSystem = true;    //isFDI

        public Detail_cad()
        {
            InitializeComponent();

            CADInfo                       = new CadInformation();
            textbox_Order.Text            = "";
            textbox_Client.Text           = "";
            textbox_Patient.Text          = "";
            textbox_Technician.Text       = "";
            textbox_Note.Text             = "";
            image_toothJPG.Source         = null;
            textbox_toothProductInfo.Text = "";
            ToothSystem                   = true;
            image_toothJPG.Visibility     = Visibility.Hidden;

            FDI[0] = "T18"; FDI[1] = "T17";
            FDI[2] = "T16"; FDI[3] = "T15";
            FDI[4] = "T14"; FDI[5] = "T13";
            FDI[6] = "T12"; FDI[7] = "T11";

            FDI[8]  = "T21"; FDI[9] = "T22";
            FDI[10] = "T23"; FDI[11] = "T24";
            FDI[12] = "T25"; FDI[13] = "T26";
            FDI[14] = "T27"; FDI[15] = "T28";

            FDI[16] = "T38"; FDI[17] = "T37";
            FDI[18] = "T36"; FDI[19] = "T35";
            FDI[20] = "T34"; FDI[21] = "T33";
            FDI[22] = "T32"; FDI[23] = "T31";

            FDI[24] = "T41"; FDI[25] = "T42";
            FDI[26] = "T43"; FDI[27] = "T44";
            FDI[28] = "T45"; FDI[29] = "T46";
            FDI[30] = "T47"; FDI[31] = "T48";
        }
예제 #4
0
        /// <summary>
        /// 設定Detail顯示資訊
        /// </summary>
        /// <param name="Import">要匯入的CadInformation</param>
        public void SetDetailInfo(CadInformation Import)
        {
            CADInfo                 = Import;
            textbox_Order.Text      = CADInfo.OrderID.TrimStart('-');
            textbox_Client.Text     = CADInfo.Client;
            textbox_Patient.Text    = CADInfo.PatientName;
            textbox_Technician.Text = CADInfo.Technician;
            textbox_Note.Text       = CADInfo.Note;
            string imgPath = CADInfo.CaseXmlPath.Replace(".xml", ".jpg");

            try
            {
                image_toothJPG.BeginInit();
                image_toothJPG.Source = new BitmapImage(new Uri(imgPath, UriKind.RelativeOrAbsolute));
                image_toothJPG.EndInit();
                image_toothJPG.Visibility = Visibility.Visible;
            }
            catch
            {
                image_toothJPG.Visibility = Visibility.Hidden;
            }
            try
            {
                ReadToothProductDetail();
            }
            catch (Exception ex)
            {
                Inteware_Messagebox Msg = new Inteware_Messagebox();
                Msg.ShowMessage(ex.Message);
            }
        }
예제 #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);
        }