예제 #1
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=DefC.Short[(int)DefCat.BlockoutTypes][listType.SelectedIndex].DefNum;
			SchedCur.Ops=new List<long>();
			for(int i=0;i<listOp.SelectedIndices.Count;i++){
				SchedCur.Ops.Add(OperatoryC.ListShort[listOp.SelectedIndices[i]].OperatoryNum);
			}
			try{
				if(IsNew) {
					Schedules.Insert(SchedCur,true);
				}
				else {
					Schedules.Update(SchedCur);
				}
			}
			catch(Exception ex){
				MessageBox.Show(ex.Message);
				return;
			}
			DialogResult=DialogResult.OK;		  
    }
예제 #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;
        }
예제 #3
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);
     }
     if (Schedules.Overlaps(_schedCur))
     {
         MsgBox.Show(this, "Blockouts not allowed to overlap.");
         return;
     }
     try{
         if (IsNew)
         {
             Schedules.Insert(_schedCur, true);
             SecurityLogs.MakeLogEntry(Permissions.Blockouts, 0, "Blockout add.");
         }
         else
         {
             Schedules.Update(_schedCur);
             SecurityLogs.MakeLogEntry(Permissions.Blockouts, 0, "Blockout edit.");
         }
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }