/// <summary>
        /// Calls Allocate but first checks for existance of prefences and an indication that The tool has run.
        /// The reason for the overlaid method is becuase the tool when it runs
        /// <href = "AllocatorCollection.CallAll_Allocators>  See the AllocatorCollection.CallAll_Allocators </href
        /// </summary>
        /// <param name="iGuarantor"></param>
        /// <returns></returns>
        public static bool AllocateWithToolCheck(long iGuarantor)
        {
            bool AllocatedNomally = false;

            try {
                bool toolRan = false;
                bool isUsing = false;
                if (PrefC.ContainsKey(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun))
                {
                    toolRan = PrefC.GetRaw(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun) == "1";
                }
                if (PrefC.ContainsKey(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use))
                {
                    isUsing = PrefC.GetRaw(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use) == "1";
                }
                if (toolRan & isUsing)
                {
                    _AllocateExecute(iGuarantor);
                    AllocatedNomally = true;
                }
            }
            catch {
                AllocatedNomally = false;
            }
            return(AllocatedNomally);
        }
Ejemplo n.º 2
0
        ///<summary>This ONLY runs when first opening the program.  Gets run early in the sequence. Returns false if the program should exit.</summary>
        public static bool CheckMySqlVersion()
        {
            if (DataConnection.DBtype != DatabaseType.MySql)
            {
                return(true);
            }
            string thisVersion  = MiscData.GetMySqlVersion();
            float  floatVersion = PIn.Float(thisVersion.Substring(0, 3));

            if (floatVersion < 5.0f)
            {
                //We will force users to upgrade to 5.0, but not yet to 5.5
                MessageBox.Show(Lan.g("Prefs", "Your version of MySQL won't work with this program") + ": " + thisVersion
                                + ".  " + Lan.g("Prefs", "You should upgrade to MySQL 5.0 using the installer on our website."));
                Application.Exit();
                return(false);
            }
            if (!PrefC.ContainsKey("MySqlVersion"))             //db has not yet been updated to store this pref
            //We're going to skip this.  We will recommend that people first upgrade OD, then MySQL, so this won't be an issue.
            {
            }
            else if (Prefs.UpdateString(PrefName.MySqlVersion, floatVersion.ToString("f1")))
            {
                if (!MsgBox.Show("Prefs", MsgBoxButtons.OKCancel, "Tables will now be optimized.  This will take a minute or two."))
                {
                    Application.Exit();
                    return(false);
                }
                DatabaseMaintenance.RepairAndOptimize();
            }
            if (PrefC.ContainsKey("DatabaseConvertedForMySql41"))
            {
                return(true);               //already converted
            }
            if (!MsgBox.Show("Prefs", true, "Your database will now be converted for use with MySQL 4.1."))
            {
                Application.Exit();
                return(false);
            }
            //ClassConvertDatabase CCD=new ClassConvertDatabase();
            try {
                MiscData.MakeABackup();
            }
            catch (Exception e) {
                if (e.Message != "")
                {
                    MessageBox.Show(e.Message);
                }
                MsgBox.Show("Prefs", "Backup failed. Your database has not been altered.");
                Application.Exit();
                return(false);               //but this should never happen
            }
            MessageBox.Show("Backup performed");
            Prefs.ConvertToMySqlVersion41();
            MessageBox.Show("converted");
            //Refresh();
            return(true);
        }
Ejemplo n.º 3
0
        private void RefreshForm()
        {
            Cache.Refresh(InvalidType.Prefs);
            bool toolRan = PrefC.ContainsKey(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun);
            bool isUsing = PrefC.ContainsKey(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use);

            this.lblAllocatorStatus.Text = "Current Tool Status: "
                                           + (toolRan ? "Tool has been run and " + (isUsing ? "\nsettings indicate that allocation is occuring." : "\nsettings indicate that allocation is not occuring.")
                                                : "Tool has not been run yet.");

            this.butGuarnDetailReport.Enabled    = toolRan & isUsing;
            this.butProviderIncomeReport.Enabled = toolRan & isUsing;
            this.butUneardedIncomeReport.Enabled = toolRan & isUsing;
        }
Ejemplo n.º 4
0
        private void butRunAllocatorTool_Click(object sender, EventArgs e)
        {
            if (!rbutIHaveRead.Checked)
            {
                PU.MB = Lan.g(this, "You must indicate that you have read the text in the box!");
                return;
            }

            if (MessageBox.Show("Do you want to run the batch allocation?", "Please Respond", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                FormWarnToCloseComputers fwc = new FormWarnToCloseComputers();
                if (fwc.ShowDialog() == DialogResult.Yes)
                {
                    Reporting.Allocators.MyAllocator1_ProviderPayment allocator1 = new OpenDental.Reporting.Allocators.MyAllocator1_ProviderPayment();
                    SecurityLogs.MakeLogEntry(OpenDentBusiness.Permissions.Setup, 0, "Started Batch Allocation For Provider Allocation Tool");
                    allocator1.StartBatchAllocation();
                    SecurityLogs.MakeLogEntry(OpenDentBusiness.Permissions.Setup, 0, "Finished Batch Allocation For Provider Allocation Tool");

                    List <string> commands = new List <string>();
                    if (!PrefC.ContainsKey(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun))
                    {
                        commands.Add("INSERT INTO preference VALUES ('"
                                     + MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun + "','0')");
                    }
                    if (!PrefC.ContainsKey(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use))
                    {
                        commands.Add("INSERT INTO preference VALUES ('"
                                     + MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use + "','0')");
                    }
                    if (commands.Count != 0)
                    {
                        Db.NonQOld(commands.ToArray());
                        Cache.Refresh(InvalidType.Prefs);
                    }
                    Prefs.UpdateRaw(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun, "1");
                    Prefs.UpdateRaw(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use, "1");
                }
            }
            RefreshForm();
        }