Example #1
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!PrefC.GetBool(PrefName.ShowFeatureEhr))
            {
                MsgBox.Show(this, "You must go to Setup, Show Features, and activate EHR before entering keys.");
                return;
            }
            if (textYear.Text == "")
            {
                MessageBox.Show("Please enter a year.");
                return;
            }
            if (textQuarter.Text == "")
            {
                MessageBox.Show("Please enter a quarter.");
                return;
            }
            if (textYear.errorProvider1.GetError(textYear) != "" ||
                textQuarter.errorProvider1.GetError(textQuarter) != "")
            {
                MessageBox.Show("Please fix errors first.");
                return;
            }
            bool quarterlyKeyIsValid = false;

                        #if EHRTEST
            quarterlyKeyIsValid = ((EHR.FormEHR)FormOpenDental.FormEHR).QuarterlyKeyIsValid(textYear.Text, textQuarter.Text, PrefC.GetString(PrefName.PracticeTitle), textKey.Text);
                        #else
            Type     type = FormOpenDental.AssemblyEHR.GetType("EHR.FormEHR");              //namespace.class
            object[] args = new object[] { textYear.Text, textQuarter.Text, PrefC.GetString(PrefName.PracticeTitle), textKey.Text };
            quarterlyKeyIsValid = (bool)type.InvokeMember("QuarterlyKeyIsValid", System.Reflection.BindingFlags.InvokeMethod, null, FormOpenDental.FormEHR, args);
                        #endif
            if (!quarterlyKeyIsValid)
            {
                MsgBox.Show(this, "Invalid quarterly key");
                return;
            }
            KeyCur.YearValue    = PIn.Int(textYear.Text);
            KeyCur.QuarterValue = PIn.Int(textQuarter.Text);
            KeyCur.KeyValue     = textKey.Text;
            if (KeyCur.IsNew)
            {
                EhrQuarterlyKeys.Insert(KeyCur);
            }
            else
            {
                EhrQuarterlyKeys.Update(KeyCur);
            }
            DialogResult = DialogResult.OK;
        }
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!PrefC.GetBool(PrefName.ShowFeatureEhr))
     {
         MsgBox.Show(this, "You must go to Setup, Show Features, and activate EHR before entering keys.");
         return;
     }
     if (textYear.Text == "")
     {
         MessageBox.Show("Please enter a year.");
         return;
     }
     if (textQuarter.Text == "")
     {
         MessageBox.Show("Please enter a quarter.");
         return;
     }
     if (textYear.errorProvider1.GetError(textYear) != "" ||
         textQuarter.errorProvider1.GetError(textQuarter) != "")
     {
         MessageBox.Show("Please fix errors first.");
         return;
     }
     if (!FormEHR.QuarterlyKeyIsValid(textYear.Text, textQuarter.Text, PrefC.GetString(PrefName.PracticeTitle), textKey.Text))
     {
         MsgBox.Show(this, "Invalid quarterly key");
         return;
     }
     KeyCur.YearValue    = PIn.Int(textYear.Text);
     KeyCur.QuarterValue = PIn.Int(textQuarter.Text);
     KeyCur.KeyValue     = textKey.Text;
     KeyCur.PracticeName = PrefC.GetString(PrefName.PracticeTitle);
     if (KeyCur.IsNew)
     {
         EhrQuarterlyKeys.Insert(KeyCur);
     }
     else
     {
         EhrQuarterlyKeys.Update(KeyCur);
     }
     DialogResult = DialogResult.OK;
 }
Example #3
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textYear.Text == "")
            {
                MessageBox.Show("Please enter a year.");
                return;
            }
            if (textQuarter.Text == "")
            {
                MessageBox.Show("Please enter a quarter.");
                return;
            }
            if (textPracticeTitle.Text == "")
            {
                MessageBox.Show("Please enter a practice title.");
                return;
            }
            if (textYear.errorProvider1.GetError(textYear) != "" ||
                textQuarter.errorProvider1.GetError(textQuarter) != "")
            {
                MessageBox.Show("Please fix errors first.");
                return;
            }
            int quarterValue   = PIn.Int(textQuarter.Text);
            int yearValue      = PIn.Int(textYear.Text);
            int monthOfQuarter = 1;

            if (quarterValue == 2)
            {
                monthOfQuarter = 4;
            }
            if (quarterValue == 3)
            {
                monthOfQuarter = 7;
            }
            if (quarterValue == 4)
            {
                monthOfQuarter = 10;
            }
            DateTime firstDayOfQuarter   = new DateTime(2000 + yearValue, monthOfQuarter, 1);
            DateTime earliestReleaseDate = firstDayOfQuarter.AddMonths(-1);

            if (DateTime.Today < earliestReleaseDate)
            {
                MessageBox.Show("Quarterly keys cannot be released more than one month in advance.");
                return;
            }
            bool quarterlyKeyIsValid = false;

                        #if EHRTEST
            quarterlyKeyIsValid = ((EHR.FormEHR)FormOpenDental.FormEHR).QuarterlyKeyIsValid(textYear.Text, textQuarter.Text, textPracticeTitle.Text, textEhrKey.Text);
                        #else
            Type     type = FormOpenDental.AssemblyEHR.GetType("EHR.FormEHR");              //namespace.class
            object[] args = new object[] { textYear.Text, textQuarter.Text, textPracticeTitle.Text, textEhrKey.Text };
            quarterlyKeyIsValid = (bool)type.InvokeMember("QuarterlyKeyIsValid", System.Reflection.BindingFlags.InvokeMethod, null, FormOpenDental.FormEHR, args);
                        #endif
            if (!quarterlyKeyIsValid)
            {
                MsgBox.Show(this, "Invalid quarterly key");
                return;
            }
            KeyCur.YearValue    = PIn.Int(textYear.Text);
            KeyCur.QuarterValue = PIn.Int(textQuarter.Text);
            KeyCur.PracticeName = textPracticeTitle.Text;
            KeyCur.KeyValue     = textEhrKey.Text;
            if (KeyCur.IsNew)
            {
                EhrQuarterlyKeys.Insert(KeyCur);
            }
            else
            {
                EhrQuarterlyKeys.Update(KeyCur);
            }
            DialogResult = DialogResult.OK;
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textYear.Text == "")
            {
                MessageBox.Show("Please enter a year.");
                return;
            }
            if (textQuarter.Text == "")
            {
                MessageBox.Show("Please enter a quarter.");
                return;
            }
            if (textPracticeTitle.Text == "")
            {
                MessageBox.Show("Please enter a practice title.");
                return;
            }
            if (textYear.errorProvider1.GetError(textYear) != "" ||
                textQuarter.errorProvider1.GetError(textQuarter) != "")
            {
                MessageBox.Show("Please fix errors first.");
                return;
            }
            int quarterValue   = PIn.Int(textQuarter.Text);
            int yearValue      = PIn.Int(textYear.Text);
            int monthOfQuarter = 1;

            if (quarterValue == 2)
            {
                monthOfQuarter = 4;
            }
            if (quarterValue == 3)
            {
                monthOfQuarter = 7;
            }
            if (quarterValue == 4)
            {
                monthOfQuarter = 10;
            }
            DateTime firstDayOfQuarter   = new DateTime(2000 + yearValue, monthOfQuarter, 1);
            DateTime earliestReleaseDate = firstDayOfQuarter.AddMonths(-1);

            if (DateTime.Today < earliestReleaseDate)
            {
                MessageBox.Show("Quarterly keys cannot be released more than one month in advance.");
                return;
            }
            if (!FormEHR.QuarterlyKeyIsValid(textYear.Text, textQuarter.Text, textPracticeTitle.Text, textEhrKey.Text))
            {
                MsgBox.Show(this, "Invalid quarterly key");
                return;
            }
            KeyCur.YearValue    = PIn.Int(textYear.Text);
            KeyCur.QuarterValue = PIn.Int(textQuarter.Text);
            KeyCur.PracticeName = textPracticeTitle.Text;
            KeyCur.KeyValue     = textEhrKey.Text;
            KeyCur.Notes        = textNotes.Text;
            if (KeyCur.IsNew)
            {
                EhrQuarterlyKeys.Insert(KeyCur);
            }
            else
            {
                EhrQuarterlyKeys.Update(KeyCur);
            }
            DialogResult = DialogResult.OK;
        }