Beispiel #1
0
 private void butClearDay_Click(object sender, EventArgs e)
 {
     if (PrefC.HasClinicsEnabled)
     {
         string clincAbbr = (Clinics.ClinicNum == 0?Lan.g(this, "Headquarters"):Clinics.GetAbbr(Clinics.ClinicNum));
         if (MessageBox.Show(Lan.g(this, "Clear all blockouts for day for clinic: ") + clincAbbr + Lan.g(this, "?") + "\r\n"
                             + Lan.g(this, "(This may include blockouts not shown in the current appointment view)")
                             , Lan.g(this, "Clear Blockouts"), MessageBoxButtons.OKCancel) != DialogResult.OK)
         {
             return;
         }
         Schedules.ClearBlockoutsForClinic(Clinics.ClinicNum, DateSelected);               //currently selected clinic only, works for daily or weekly
         Schedules.BlockoutLogHelper(BlockoutAction.Clear, dateTime: DateSelected, clinicNum: Clinics.ClinicNum);
     }
     else
     {
         if (!MsgBox.Show(this, true, "Clear all blockouts for day? (This may include blockouts not shown in the current appointment view)"))
         {
             return;
         }
         Schedules.ClearBlockoutsForDay(DateSelected);                //works for daily or weekly
         Schedules.BlockoutLogHelper(BlockoutAction.Clear, dateTime: DateSelected);
     }
     Close();
 }
Beispiel #2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (listOp.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "Please select at least one operatory first.");
                return;
            }
            try{
                _schedCur.StartTime = DateTime.Parse(comboStart.Text).TimeOfDay;
                _schedCur.StopTime  = DateTime.Parse(comboStop.Text).TimeOfDay;
            }
            catch {
                MsgBox.Show(this, "Incorrect time format");
                return;
            }
            _schedCur.Note         = textNote.Text;
            _schedCur.BlockoutType = _listBlockoutCatDefs[listType.SelectedIndex].DefNum;
            _schedCur.Ops          = new List <long>();
            for (int i = 0; i < listOp.SelectedIndices.Count; i++)
            {
                _schedCur.Ops.Add(_listOps[listOp.SelectedIndices[i]].OperatoryNum);
            }
            List <Schedule> listOverlapSchedules;

            if (Schedules.Overlaps(_schedCur, out listOverlapSchedules))
            {
                if (!PrefC.GetBool(PrefName.ReplaceExistingBlockout) || !Schedules.IsAppointmentBlocking(_schedCur.BlockoutType))
                {
                    MsgBox.Show(this, "Blockouts not allowed to overlap.");
                    return;
                }
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Creating this blockout will cause blockouts to overlap. Continuing will delete the existing "
                                 + "blockout(s). Continue?"))
                {
                    return;
                }
                Schedules.DeleteMany(listOverlapSchedules.Select(x => x.ScheduleNum).ToList());
            }
            try{
                if (IsNew)
                {
                    Schedules.Insert(_schedCur, true);
                    Schedules.BlockoutLogHelper(BlockoutAction.Create, _schedCur);
                }
                else
                {
                    Schedules.Update(_schedCur);
                    Schedules.BlockoutLogHelper(BlockoutAction.Edit, _schedCur);
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            DialogResult = DialogResult.OK;
        }
Beispiel #3
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (MessageBox.Show(Lan.g(this, "Delete Blockout?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK)
     {
         return;
     }
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
     }
     else
     {
         Schedules.Delete(_schedCur, true);
         Schedules.BlockoutLogHelper(BlockoutAction.Delete, _schedCur);
     }
     DialogResult = DialogResult.Cancel;
 }