Example #1
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textOpName.Text == "")
     {
         MsgBox.Show(this, "Operatory name cannot be blank.");
         return;
     }
     if (checkIsHidden.Checked == true && Operatories.HasFutureApts(OpCur.OperatoryNum, ApptStatus.UnschedList))
     {
         MsgBox.Show(this, "Can not hide an operatory with future appointments.");
         checkIsHidden.Checked = false;
         return;
     }
     OpCur.OpName                    = textOpName.Text;
     OpCur.Abbrev                    = textAbbrev.Text;
     OpCur.IsHidden                  = checkIsHidden.Checked;
     OpCur.ClinicNum                 = _selectedClinicNum;
     OpCur.ProvDentist               = _selectedProvNum;
     OpCur.ProvHygienist             = _selectedProvHygNum;
     OpCur.IsHygiene                 = checkIsHygiene.Checked;
     OpCur.SetProspective            = checkSetProspective.Checked;
     OpCur.IsWebSched                = checkIsWebSched.Checked;
     OpCur.ListWSNPAOperatoryDefNums = _listWSNPAOperatoryDefs.Select(x => x.DefNum).ToList();
     if (IsNew)
     {
         ListOps.Insert(OpCur.ItemOrder, OpCur);               //Insert into list at appropriate spot
         for (int i = 0; i < ListOps.Count; i++)
         {
             ListOps[i].ItemOrder = i;                  //reset/correct item orders
         }
     }
     DialogResult = DialogResult.OK;
 }