Esempio n. 1
0
        private void gridConfStatuses_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Def         defConfirmation = (Def)gridConfStatuses.ListGridRows[e.Row].Tag;
            FormDefEdit FormDE          = new FormDefEdit(defConfirmation, _listDefsApptStatus, new DefCatOptions(DefCat.ApptConfirmed, enableColor: true, enableValue: true));

            FormDE.ShowDialog();
            if (FormDE.DialogResult == DialogResult.OK)
            {
                Defs.RefreshCache();
                _listDefsApptStatus = Defs.GetDefsForCategory(DefCat.ApptConfirmed, true);
                FillConfStatusesGrid();
            }
        }
Esempio n. 2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textName.Text == "")
            {
                MsgBox.Show(this, "Name required.");
                return;
            }
            switch ((DefCat)DefCur.Category)
            {
            case DefCat.AdjTypes:
                if (textValue.Text != "+" && textValue.Text != "-")
                {
                    MessageBox.Show(Lan.g(this, "Valid values are + or -."));
                    return;
                }
                break;

            case DefCat.ApptProcsQuickAdd:
                string[] procs = textValue.Text.Split(',');
                for (int i = 0; i < procs.Length; i++)
                {
                    if (ProcedureCodes.GetProcCode(procs[i]).ProcCode == null)
                    {
                        MessageBox.Show(Lan.g(this, "Invalid procedure code or formatting. Valid format example: D1234,D2345,D3456"));
                        return;
                    }
                }
                //test for not require tooth number if time
                break;

            case DefCat.BillingTypes:
                if (textValue.Text != "" && textValue.Text != "E")
                {
                    MsgBox.Show(this, "Valid values are blank or E.");
                    return;
                }
                if (checkHidden.Checked && Patients.IsBillingTypeInUse(DefCur.DefNum))
                {
                    if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Warning: Billing type is currently in use by patients."))
                    {
                        return;
                    }
                }
                break;

            case DefCat.CommLogTypes:
                if (textValue.Text != "" && textValue.Text != "MISC" && textValue.Text != "APPT" &&
                    textValue.Text != "FIN" && textValue.Text != "RECALL")
                {
                    MessageBox.Show(Lan.g(this, "Valid values are blank,APPT,FIN,RECALL,or MISC."));
                    return;
                }
                break;

            case DefCat.RecallUnschedStatus:
                if (textValue.Text.Length > 7)
                {
                    MessageBox.Show(Lan.g(this, "Maximum length is 7."));
                    return;
                }
                break;

            case DefCat.DiscountTypes:
                int discVal;
                if (textValue.Text == "")
                {
                    break;
                }
                try{
                    discVal = System.Convert.ToInt32(textValue.Text);
                }
                catch {
                    MessageBox.Show(Lan.g(this, "Not a valid number"));
                    return;
                }
                if (discVal < 0 || discVal > 100)
                {
                    MessageBox.Show(Lan.g(this, "Valid values are between 0 and 100"));
                    return;
                }
                textValue.Text = discVal.ToString();
                break;

            case DefCat.OperatoriesOld:
                if (textValue.Text.Length > 5)
                {
                    MessageBox.Show(Lan.g(this, "Maximum length of abbreviation is 5."));
                    return;
                }
                break;

            case DefCat.TxPriorities:
                if (textValue.Text.Length > 7)
                {
                    MessageBox.Show(Lan.g(this, "Maximum length of abbreviation is 7."));
                    return;
                }
                break;

            case DefCat.ImageCats:
                textValue.Text = textValue.Text.ToUpper().Replace(",", "");
                if (!Regex.IsMatch(textValue.Text, @"^[XPS]*$"))
                {
                    textValue.Text = "";
                }
                break;

            case DefCat.ProcCodeCats:
                if (checkHidden.Checked)
                {
                    Defs.RefreshCache();
                    Def[] enabledDefs = DefC.Short[(int)DefCat.ProcCodeCats];
                    //if no enabled defs or this is the only enabled def, don't allow disabling
                    if (enabledDefs.Length == 0 || (enabledDefs.Length == 1 && enabledDefs[0].DefNum == DefCur.DefNum))
                    {
                        MsgBox.Show(this, "At least one procedure code category must be enabled.");
                        return;
                    }
                }
                break;

                /*case DefCat.FeeSchedNames:
                 *      if(textValue.Text=="C" || textValue.Text=="c") {
                 *              textValue.Text="C";
                 *      }
                 *      else if(textValue.Text=="A" || textValue.Text=="a") {
                 *              textValue.Text="A";
                 *      }
                 *      else textValue.Text="";
                 *      break;*/
            }            //end switch
            DefCur.ItemName = textName.Text;
            if (EnableValue)
            {
                DefCur.ItemValue = textValue.Text;
            }
            if (EnableColor)
            {
                DefCur.ItemColor = butColor.BackColor;
            }
            DefCur.IsHidden = checkHidden.Checked;
            if (IsNew)
            {
                Defs.Insert(DefCur);
            }
            else
            {
                Defs.Update(DefCur);
            }
            DialogResult = DialogResult.OK;
        }
Esempio n. 3
0
 private void RefreshDefs()
 {
     Defs.RefreshCache();
     _listDefsAll = Defs.GetDeepCopy().SelectMany(x => x.Value).ToList();
 }