private void CreateProgramLink()
        {
            if (!checkCreateProgLink.Checked)
            {
                return;
            }
            XmlDocument document = new XmlDocument();

            document.Load(textDir.Text + "\\FreeDentalConfig.xml");
            XPathNavigator Navigator = document.CreateNavigator();
            XPathNavigator nav;

            //Database type
            nav = Navigator.SelectSingleNode("//DatabaseType");
            DatabaseType dbType = DatabaseType.MySql;

            if (nav != null && nav.Value == "Oracle")
            {
                dbType = DatabaseType.Oracle;
            }
            //See if there's a DatabaseConnection
            nav = Navigator.SelectSingleNode("//DatabaseConnection");
            string serverName   = "";
            string databaseName = "";
            string userName     = "";
            string password     = "";

            if (nav != null)
            {
                //If there is a DatabaseConnection, then use it.
                serverName   = nav.SelectSingleNode("ComputerName").Value;
                databaseName = nav.SelectSingleNode("Database").Value;
                userName     = nav.SelectSingleNode("User").Value;
                password     = nav.SelectSingleNode("Password").Value;
                XPathNavigator encryptedPwdNode = nav.SelectSingleNode("MySQLPassHash");
                //If the Password node is empty, but there is a value in the MySQLPassHash node, decrypt the node value and use that instead
                string decryptedPwd;
                if (password == "" &&
                    encryptedPwdNode != null &&
                    encryptedPwdNode.Value != "" &&
                    CDT.Class1.Decrypt(encryptedPwdNode.Value, out decryptedPwd))
                {
                    //decrypted value could be an empty string, which means they don't have a password set, so textPassword will be an empty string
                    password = decryptedPwd;
                }
            }
            DataConnection dbCon = new DataConnection();

            dbCon.SetDb(serverName, databaseName, userName, password, "", "", dbType);
            if (ProgramC.GetListt().Count(x => x.ProgDesc == "Voice Command") > 0)           //Program link already exists
            {
                return;
            }
            OpenDentBusiness.Program prog = new OpenDentBusiness.Program();
            prog.ProgDesc      = "Voice Command";
            prog.Enabled       = true;
            prog.PluginDllName = "VoiceCommand.dll";
            Programs.Insert(prog);
        }
Example #2
0
 public static void Resize(ODGrid gridProg, Panel panelImages, Panel panelEcw, TabControl tabControlImages, Size ClientSize, ODGrid gridPtInfo, ToothChartWrapper toothChart, TextBox textTreatmentNotes)
 {
     if (ProgramC.HListIsNull())
     {
         return;
     }
     if (UsingEcwTight())
     {
         //gridProg.Width=524;
         if (gridProg.Columns != null && gridProg.Columns.Count > 0)
         {
             int gridW = 0;
             for (int i = 0; i < gridProg.Columns.Count; i++)
             {
                 gridW += gridProg.Columns[i].ColWidth;
             }
             if (gridW < 524)                   //for example, if not very many columns
             {
                 gridW = 524;
             }
             if (gridW + 20 + toothChart.Width < ClientSize.Width)                 //if space is big enough to allow full width
             {
                 gridProg.Width = gridW + 20;
             }
             else
             {
                 if (ClientSize.Width > 0)                       //prevents an error
                 {
                     if (ClientSize.Width - toothChart.Width - 1 < 524)
                     {
                         gridProg.Width = 524;
                     }
                     else
                     {
                         gridProg.Width = ClientSize.Width - toothChart.Width - 1;
                     }
                 }
             }
             //now, bump the other controls over
             toothChart.Location         = new Point(gridProg.Width + 2, 26);
             textTreatmentNotes.Location = new Point(gridProg.Width + 2, toothChart.Bottom + 1);
             panelEcw.Location           = new Point(gridProg.Width + 2, textTreatmentNotes.Bottom + 1);
         }
         if (panelImages.Visible)
         {
             panelEcw.Height = tabControlImages.Top - panelEcw.Top + 1 - (panelImages.Height + 2);
         }
         else
         {
             panelEcw.Height = tabControlImages.Top - panelEcw.Top + 1;
         }
         return;
     }
     if (Programs.UsingOrion)             //full width
     {
         gridProg.Width = ClientSize.Width - gridProg.Location.X - 1;
     }
     else if (gridProg.Columns != null && gridProg.Columns.Count > 0)
     {
         int gridW = 0;
         for (int i = 0; i < gridProg.Columns.Count; i++)
         {
             gridW += gridProg.Columns[i].ColWidth;
         }
         if (gridProg.Location.X + gridW + 20 < ClientSize.Width)             //if space is big enough to allow full width
         {
             gridProg.Width = gridW + 20;
         }
         else
         {
             if (ClientSize.Width > gridProg.Location.X)                   //prevents an error
             {
                 gridProg.Width = ClientSize.Width - gridProg.Location.X - 1;
             }
         }
     }
     if (Programs.UsingOrion)
     {
         //gridPtInfo is up in the tabs and does not need to be resized.
     }
     else
     {
         gridPtInfo.Height = tabControlImages.Top - gridPtInfo.Top;
     }
 }
Example #3
0
 public Facade()
 {
     progA = new ProgramA();
     progB = new ProgramB();
     progC = new ProgramC();
 }