Beispiel #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;		  
    }
 private void FormScheduleDay_Load(object sender, System.EventArgs e)
 {
     labelDate.Text = SchedCurDate.ToString("dddd") + " " + SchedCurDate.ToShortDateString();
     SchedList      = Schedules.RefreshDayEdit(SchedCurDate);     //only does this on startup
     //listProv
     for (int i = 0; i < ProviderC.ListShort.Count; i++)
     {
         listProv.Items.Add(ProviderC.ListShort[i].Abbr);
         //listProv.SetSelected(i,true);
     }
     for (int i = 0; i < Employees.ListShort.Length; i++)
     {
         listEmp.Items.Add(Employees.ListShort[i].FName);
         //listEmp.SetSelected(i,true);
     }
     FillGrid();
     for (int i = 0; i < ProviderC.ListShort.Count; i++)
     {
         comboProv.Items.Add(ProviderC.ListShort[i].Abbr);
         if (ProviderC.ListShort[i].ProvNum == PrefC.GetLong(PrefName.ScheduleProvUnassigned))
         {
             comboProv.SelectedIndex = i;
         }
     }
 }
Beispiel #3
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 #4
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textStart.Visible)
     {
         try{
             SchedCur.StartTime = DateTime.Parse(textStart.Text);
             SchedCur.StopTime  = DateTime.Parse(textStop.Text);
         }
         catch {
             MessageBox.Show(Lan.g(this, "Incorrect time format"));
             return;
         }
     }
     SchedCur.Note = textNote.Text;
     if (SchedCur.SchedType == ScheduleType.Blockout)
     {
         SchedCur.BlockoutType = DefB.Short[(int)DefCat.BlockoutTypes][listType.SelectedIndex].DefNum;
         if (listOp.SelectedIndex == 0)
         {
             SchedCur.Op = 0;
         }
         else
         {
             SchedCur.Op = Operatories.ListShort[listOp.SelectedIndex - 1].OperatoryNum;
         }
     }
     try{
         Schedules.InsertOrUpdate(SchedCur, IsNew);
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
 private void butClearDay_Click(object sender, EventArgs e)
 {
     if (!MsgBox.Show(this, true, "Clear all blockouts for day?"))
     {
         return;
     }
     Schedules.ClearBlockoutsForDay(DateSelected);            //works for daily or weekly
     Close();
 }
 private void butClearDay_Click(object sender, EventArgs e)
 {
     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
     Close();
 }
Beispiel #7
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 #8
0
 private void butOK_Click(object sender, EventArgs e)
 {
     Schedules.SetForDay(SchedList, SchedCurDate);
     if (comboProv.SelectedIndex != -1 &&
         Prefs.UpdateInt("ScheduleProvUnassigned", Providers.List[comboProv.SelectedIndex].ProvNum))
     {
         DataValid.SetInvalid(InvalidTypes.Prefs);
     }
     DialogResult = DialogResult.OK;
 }
        private void butDelete_Click(object sender, EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != "")
            {
                MsgBox.Show(this, "Please fix errors first.");
                return;
            }
            if (gridMain.SelectedCell.X == -1)
            {
                MsgBox.Show(this, "Please select a date first.");
                return;
            }
            if (ProvsChanged)
            {
                MsgBox.Show(this, "Provider or Employee selection has been changed.  Please refresh first.");
                return;
            }
            if (!MsgBox.Show(this, true, "Delete all displayed entries for the entire selected week?"))
            {
                return;
            }
            int startI = 1;

            if (checkWeekend.Checked)
            {
                startI = 0;
            }
            DateTime dateSelectedStart = Schedules.GetDateCal(PIn.PDate(textDateFrom.Text), gridMain.SelectedCell.Y, startI);
            DateTime dateSelectedEnd;

            if (checkWeekend.Checked)
            {
                dateSelectedEnd = dateSelectedStart.AddDays(6);
            }
            else
            {
                dateSelectedEnd = dateSelectedStart.AddDays(4);
            }
            List <int> provNums = new List <int>();

            for (int i = 0; i < listProv.SelectedIndices.Count; i++)
            {
                provNums.Add(Providers.List[listProv.SelectedIndices[i]].ProvNum);
            }
            List <int> empNums = new List <int>();

            for (int i = 0; i < listEmp.SelectedIndices.Count; i++)
            {
                empNums.Add(Employees.ListShort[listEmp.SelectedIndices[i]].EmployeeNum);
            }
            Schedules.Clear(dateSelectedStart, dateSelectedEnd, provNums.ToArray(), empNums.ToArray(), checkPractice.Checked);
            FillGrid();
            changed = true;
        }
Beispiel #10
0
        private void CopyOverBlockouts(int numRepeat)
        {
            if (DateCopyStart.Year < 1880)
            {
                MsgBox.Show(this, "Please copy a selection to the clipboard first.");
                return;
            }
            if (_isWeekend && !checkWeekend.Checked)             //user is trying to 'paste' onto a weekend date
            {
                MsgBox.Show(this, "You must check 'Include Weekends' if you would like to paste into weekends.");
                return;
            }
            //calculate which day or week is currently selected.
            DateTime dateSelectedStart;
            DateTime dateSelectedEnd;
            bool     isWeek = DateCopyStart != DateCopyEnd;

            if (isWeek)
            {
                //Always start week on Monday
                if (DateSelected.DayOfWeek == DayOfWeek.Sunday)               //if selecting Sunday, go back to the previous Monday.
                {
                    dateSelectedStart = DateSelected.AddDays(-6);
                }
                else                                                                           //Any other day. eg Wed.AddDays(1-3)=Wed.AddDays(-2)=Monday
                {
                    dateSelectedStart = DateSelected.AddDays(1 - (int)DateSelected.DayOfWeek); //eg Wed.AddDays(1-3)=Wed.AddDays(-2)=Monday
                }
                //DateCopyEnd is greater than DateCopyStart and is either 4 days greater or 6 days greater, so clear/paste the same number of days
                dateSelectedEnd = dateSelectedStart.AddDays((DateCopyEnd - DateCopyStart).Days);
            }
            else
            {
                dateSelectedStart = DateSelected;
                dateSelectedEnd   = DateSelected;
            }
            //When pasting, it's not allowed to paste back over the same day or week.
            if (dateSelectedStart == DateCopyStart && numRepeat == 1)
            {
                MsgBox.Show(this, "Not allowed to paste back onto the same date as is on the clipboard.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            string errors = Schedules.CopyBlockouts(ApptViewNumCur, isWeek, checkWeekend.Checked, checkReplace.Checked, DateCopyStart, DateCopyEnd,
                                                    dateSelectedStart, dateSelectedEnd, numRepeat);

            Cursor = Cursors.Default;
            if (!string.IsNullOrEmpty(errors))
            {
                MessageBox.Show(errors);                //Error was translated inside of the S class method.
                return;
            }
            Close();
        }
Beispiel #11
0
        Delete(Schedule sched)
        {
            string command = "DELETE from schedule WHERE schedulenum = '" + POut.PInt(sched.ScheduleNum) + "'";

            General.NonQ(command);
            //if this was the last blockout for a day, then create a blockout for 'closed'
            if (sched.SchedType == ScheduleType.Blockout)
            {
                Schedules.CheckIfDeletedLastBlockout(sched.SchedDate);
            }
        }
 private void FillLabels()
 {
     labelCount.Text = Schedules.GetDuplicateBlockoutCount().ToString();
     if (labelCount.Text == "0")
     {
         labelInstructions.Text = "";
     }
     else
     {
         labelInstructions.Text = Lan.g(this, "Click the Clear button to fix the duplicates.");
     }
 }
Beispiel #13
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);	
      }
      DialogResult=DialogResult.Cancel;
		}
        ///<summary>The background provider schedule for the timebar on the left</summary>
        private void DrawProvSchedInTimebar(Graphics g)
        {
            Provider provCur;

            SchedDefault[] schedDefs;            //for one type at a time
            Schedule[]     schedForType;
            for (int j = 0; j < ApptViewItems.VisProvs.Length; j++)
            {
                provCur      = Providers.List[ApptViewItems.VisProvs[j]];
                schedForType = Schedules.GetForType(SchedListDay, ScheduleType.Provider, provCur.ProvNum);
                if (schedForType.Length == 0)              //use default sched
                {
                    schedDefs = SchedDefaults.GetForType(ScheduleType.Provider, provCur.ProvNum);
                    for (int i = 0; i < schedDefs.Length; i++)
                    {
                        if (schedDefs[i].DayOfWeek == (int)Appointments.DateSelected.DayOfWeek)
                        {
                            g.FillRectangle(openBrush
                                            , TimeWidth + ProvWidth * j
                                            , schedDefs[i].StartTime.Hour * Lh * RowsPerHr
                                            + schedDefs[i].StartTime.Minute * Lh / MinPerRow
                                            , ProvWidth
                                            , (schedDefs[i].StopTime
                                               - schedDefs[i].StartTime).Hours * Lh * RowsPerHr
                                            + (schedDefs[i].StopTime
                                               - schedDefs[i].StartTime).Minutes * Lh / MinPerRow);
                        }
                    }
                }
                else                 //use schedForType
                {
                    for (int i = 0; i < schedForType.Length; i++)
                    {
                        if (schedForType[i].Status == SchedStatus.Holiday)
                        {
                            g.FillRectangle(holidayBrush, TimeWidth + ProvWidth * j, 0
                                            , ProvWidth, Height);
                        }
                        else
                        {
                            g.FillRectangle(openBrush
                                            , TimeWidth + ProvWidth * j
                                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                                   //6
                                            + (int)schedForType[i].StartTime.Minute * Lh / MinPerRow                            //10
                                            , ProvWidth
                                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr     //6
                                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow); //10
                        }
                    }
                }
            }
        }
 private void butOK_Click(object sender, EventArgs e)
 {
     try {
         Schedules.SetForDay(SchedList, SchedCurDate);
     }
     catch (Exception ex) {
         MsgBox.Show(this, ex.Message);
         return;
     }
     if (comboProv.SelectedIndex != -1 &&
         Prefs.UpdateLong(PrefName.ScheduleProvUnassigned, ProviderC.ListShort[comboProv.SelectedIndex].ProvNum))
     {
         DataValid.SetInvalid(InvalidType.Prefs);
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #16
0
        private void butAddTime_Click(object sender, System.EventArgs e)
        {
            Schedules.ConvertFromDefault(SchedCurDate, SchedType, ProvNum);
            Schedule SchedCur = new Schedule();

            SchedCur.SchedDate = SchedCurDate;
            SchedCur.Status    = SchedStatus.Open;
            SchedCur.SchedType = SchedType;
            SchedCur.ProvNum   = ProvNum;
            FormScheduleBlockEdit FormSB = new FormScheduleBlockEdit(SchedCur);

            FormSB.IsNew = true;
            FormSB.ShowDialog();
            labelDefault.Visible = false;
            FillList();
        }
Beispiel #17
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);
         SecurityLogs.MakeLogEntry(Permissions.Blockouts, 0, "Blockout delete.");
     }
     DialogResult = DialogResult.Cancel;
 }
 private void butOK_Click(object sender, EventArgs e)
 {
     if (labelCount.Text == "0")
     {
         MsgBox.Show(this, "There are no duplicates to clear.");
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Clear all duplicates?"))
     {
         return;
     }
     Cursor = Cursors.WaitCursor;
     Schedules.ClearDuplicates();
     Cursor = Cursors.Default;
     MsgBox.Show(this, "Done.");
     FillLabels();
 }
Beispiel #19
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.Schedules, DateTime.MinValue))
            {
                return;
            }
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != "")
            {
                MsgBox.Show(this, "Please fix errors first.");
                return;
            }
            int clickedCol = e.Col;

            if (!checkWeekend.Checked)
            {
                clickedCol++;
            }
            //the "clickedCell" is in terms of the entire 7 col layout.
            Point    clickedCell  = new Point(clickedCol, e.Row);
            DateTime selectedDate = Schedules.GetDateCal(PIn.Date(textDateFrom.Text), e.Row, clickedCol);

            if (selectedDate < PIn.Date(textDateFrom.Text) || selectedDate > PIn.Date(textDateTo.Text))
            {
                return;
            }
            //MessageBox.Show(selectedDate.ToShortDateString());
            FormScheduleDayEdit FormS = new FormScheduleDayEdit(selectedDate);

            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrid();
            if (checkWeekend.Checked)
            {
                gridMain.SetSelected(clickedCell);
            }
            else
            {
                gridMain.SetSelected(new Point(clickedCell.X - 1, clickedCell.Y));
            }
            changed = true;
        }
Beispiel #20
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;
 }
Beispiel #21
0
        private void listTimeBlocks_DoubleClick(object sender, System.EventArgs e)
        {
            if (listTimeBlocks.SelectedIndex == -1)
            {
                return;
            }
            int clickedIndex = listTimeBlocks.SelectedIndex;

            if (Schedules.ConvertFromDefault(SchedCurDate, SchedType, ProvNum))
            {
                FillList();
            }
            Schedule SchedCur            = SchedListDay[clickedIndex];
            FormScheduleBlockEdit FormSB = new FormScheduleBlockEdit(SchedCur);

            FormSB.ShowDialog();
            FillList();
        }
Beispiel #22
0
 private void FillList()
 {
     Schedule[] SchedListAll = Schedules.RefreshDay(SchedCurDate);
     SchedListDay = Schedules.GetForType(SchedListAll, SchedType, ProvNum);
     SchedDefaults.Refresh();
     SchedDefault[] schedDefForType = SchedDefaults.GetForType(SchedType, ProvNum);
     listTimeBlocks.Items.Clear();
     ALdefaults           = new ArrayList();
     labelDefault.Visible = false;
     if (SchedListDay.Length == 0)
     {
         //show defaults instead of user-entered list
         for (int i = 0; i < schedDefForType.Length; i++)
         {
             if ((int)SchedCurDate.DayOfWeek == schedDefForType[i].DayOfWeek)
             {
                 ALdefaults.Add(schedDefForType[i]);
                 listTimeBlocks.Items.Add(schedDefForType[i].StartTime.ToShortTimeString() + " - "
                                          + schedDefForType[i].StopTime.ToShortTimeString());
             }
         }
         labelDefault.Visible = true;
     }
     else//show the list of user-entered schedule items
     {
         if (SchedListDay.Length == 1 && SchedListDay[0].Status == SchedStatus.Closed)
         {
             listTimeBlocks.Items.Add("Office Closed " + SchedListDay[0].Note);
         }
         else if (SchedListDay.Length == 1 && SchedListDay[0].Status == SchedStatus.Holiday)
         {
             listTimeBlocks.Items.Add("Holiday: " + SchedListDay[0].Note);
         }
         else
         {
             for (int i = 0; i < SchedListDay.Length; i++)
             {
                 listTimeBlocks.Items.Add(SchedListDay[i].StartTime.ToShortTimeString() + " - "
                                          + SchedListDay[i].StopTime.ToShortTimeString());
             }
         }
     }
 }
Beispiel #23
0
        ///<summary>Calculates the due date by adding the number of business days listed.  Adds an additional day for each office holiday.</summary>
        public static DateTime ComputeDueDate(DateTime startDate, int days)
        {
            DateTime date    = startDate;
            int      counter = 0;

            while (counter < days)
            {
                date = date.AddDays(1);
                if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday)
                {
                    continue;
                }
                if (Schedules.DateIsHoliday(date))
                {
                    continue;
                }
                counter++;
            }
            return(date + TimeSpan.FromHours(17));         //always due at 5pm on day specified.
        }
 private void panel1_MouseMove(object sender, MouseEventArgs e)
 {
     //there is 1 region per bucket (synced in paint event), loop through the regions and see if we are hovering over one of them
     for (int i = 0; i < ListRegions.Count; i++)
     {
         if (!ListRegions[i].IsVisible(new Point(e.X, e.Y)))                //we are hovering over this bucket
         {
             continue;
         }
         if (i == CurrentHoverRegionIdx)               //only activate this bucket once (prevents flicker)
         {
             return;
         }
         //build the display string for this hover bucket
         List <Employee> listEmps = null;
         TimeSpan        tsStart  = new TimeSpan(5, (i * 15), 0);
         toolTip.ToolTipTitle = tsStart.ToShortTimeString() + " - " + tsStart.Add(TimeSpan.FromMinutes(15)).ToShortTimeString();
         string employees = "";
         if (DictEmployeesPerBucket.TryGetValue(i, out listEmps))
         {
             toolTip.ToolTipTitle = toolTip.ToolTipTitle + " (" + listEmps.Count.ToString() + " Techs)";
             listEmps.Sort(new Employees.EmployeeComparer(Employees.EmployeeComparer.SortBy.firstName));
             for (int p = 0; p < listEmps.Count; p++)
             {
                 List <Schedule> sch = Schedules.GetForEmployee(ListScheds, listEmps[p].EmployeeNum);
                 employees += listEmps[p].FName;
                 employees += Schedules.GetCommaDelimStringForScheds(sch);
                 employees += "\r\n";
             }
         }
         //activate and show this bucket's tooltip
         toolTip.Active = true;
         toolTip.SetToolTip(this, employees);
         //save this region as current so we only activate it once
         CurrentHoverRegionIdx = i;
         return;
     }
     //not hovering over a bucket so kill the tooltip
     toolTip.Active        = false;
     CurrentHoverRegionIdx = -1;
 }
Beispiel #25
0
        private void butHoliday_Click(object sender, System.EventArgs e)
        {
            if (SchedListDay.Length == 1 &&
                SchedListDay[0].Status == SchedStatus.Holiday)
            {
                MessageBox.Show(Lan.g(this, "Day is already a Holiday."));
                return;
            }
            Schedules.SetAllDefault(SchedCurDate, SchedType, ProvNum);
            FillList();
            Schedule SchedCur = new Schedule();

            SchedCur.SchedDate = SchedCurDate;
            SchedCur.Status    = SchedStatus.Holiday;
            SchedCur.SchedType = SchedType;
            SchedCur.ProvNum   = ProvNum;
            FormScheduleBlockEdit FormSB = new FormScheduleBlockEdit(SchedCur);

            FormSB.IsNew = true;
            FormSB.ShowDialog();
            FillList();
        }
Beispiel #26
0
 ///<summary></summary>
 private static bool Overlaps(Schedule sched)
 {
     Schedule[] SchedListDay = Schedules.RefreshPeriod(sched.SchedDate, sched.SchedDate);
     Schedule[] ListForType  = Schedules.GetForType(SchedListDay, sched.SchedType, sched.ProvNum);
     for (int i = 0; i < ListForType.Length; i++)
     {
         if (ListForType[i].SchedType == ScheduleType.Blockout)
         {
             //skip if blockout, and ops don't interfere
             if (sched.Op != 0 && ListForType[i].Op != 0)                //neither op can be zero, or they will interfere
             {
                 if (sched.Op != ListForType[i].Op)
                 {
                     continue;
                 }
             }
         }
         if (sched.ScheduleNum != ListForType[i].ScheduleNum &&
             sched.StartTime.TimeOfDay >= ListForType[i].StartTime.TimeOfDay &&
             sched.StartTime.TimeOfDay < ListForType[i].StopTime.TimeOfDay)
         {
             return(true);
         }
         if (sched.ScheduleNum != ListForType[i].ScheduleNum &&
             sched.StopTime.TimeOfDay > ListForType[i].StartTime.TimeOfDay &&
             sched.StopTime.TimeOfDay <= ListForType[i].StopTime.TimeOfDay)
         {
             return(true);
         }
         if (sched.ScheduleNum != ListForType[i].ScheduleNum &&
             sched.StartTime.TimeOfDay <= ListForType[i].StartTime.TimeOfDay &&
             sched.StopTime.TimeOfDay >= ListForType[i].StopTime.TimeOfDay)
         {
             return(true);
         }
     }
     return(false);
 }
        private void butCopyDay_Click(object sender, EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != "")
            {
                MsgBox.Show(this, "Please fix errors first.");
                return;
            }
            if (gridMain.SelectedCell.X == -1)
            {
                MsgBox.Show(this, "Please select a date first.");
                return;
            }
            int selectedCol = gridMain.SelectedCell.X;

            if (!checkWeekend.Checked)
            {
                selectedCol++;
            }
            DateCopyStart      = Schedules.GetDateCal(PIn.PDate(textDateFrom.Text), gridMain.SelectedCell.Y, selectedCol);
            DateCopyEnd        = DateCopyStart;
            textClipboard.Text = DateCopyStart.ToShortDateString();
        }
        ///<summary>Draws all the blockouts for the entire period.</summary>
        private void DrawBlockouts(Graphics g)
        {
            Schedule[] schedForType;
            schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Blockout, 0);
            SolidBrush blockBrush;
            Pen        blockOutlinePen = new Pen(Color.Black, 1);
            Pen        penOutline;
            Font       blockFont = new Font("Arial", 8);
            string     blockText;
            RectangleF rect;

            //g.TextRenderingHint=TextRenderingHint.SingleBitPerPixelGridFit;//to make printing clearer
            for (int i = 0; i < schedForType.Length; i++)
            {
                blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType));
                penOutline = new Pen(DefB.GetColor(DefCat.BlockoutTypes, schedForType[i].BlockoutType), 2);
                blockText  = DefB.GetName(DefCat.BlockoutTypes, schedForType[i].BlockoutType) + "\r\n" + schedForType[i].Note;
                if (IsWeeklyView)
                {
                    if (schedForType[i].Op == 0)                   //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + 1 + ((int)schedForType[i].SchedDate.DayOfWeek - 1) * ColDayWidth
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColDayWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                      //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + 1 + ((int)schedForType[i].SchedDate.DayOfWeek - 1) * ColDayWidth
                            + ColAptWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColAptWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                }
                else
                {
                    if (schedForType[i].Op == 0)                  //all ops
                    {
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr                       //6
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow                     //10
                            , ColWidth * ColCount - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                    else                     //just one op
                    {
                        if (ApptViewItems.GetIndexOp(schedForType[i].Op) == -1)
                        {
                            continue;                            //don't display if op not visible
                        }
                        rect = new RectangleF(
                            TimeWidth + ProvWidth * ProvCount
                            + ColWidth * ApptViewItems.GetIndexOp(schedForType[i].Op) + 1
                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr
                            + schedForType[i].StartTime.Minute * Lh / MinPerRow
                            , ColWidth - 1
                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr
                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);
                    }
                }
                //paint either solid block or outline
                if (PrefB.GetBool("SolidBlockouts"))
                {
                    g.FillRectangle(blockBrush, rect);
                    g.DrawLine(blockOutlinePen, rect.X, rect.Y + 1, rect.Right - 1, rect.Y + 1);
                }
                else
                {
                    g.DrawRectangle(penOutline, rect.X + 1, rect.Y + 2, rect.Width - 2, rect.Height - 3);
                }
                g.DrawString(blockText, blockFont, new SolidBrush(DefB.Short[(int)DefCat.AppointmentColors][5].ItemColor), rect);
            }
        }
        ///<summary>Including the practice schedule</summary>
        private void DrawMainBackground(Graphics g)
        {
            //SchedDefault[] schedDefs;//for one type at a time
            Schedule[] schedForType;
            //one giant rectangle for everything closed
            g.FillRectangle(closedBrush, TimeWidth, 0, ColWidth * ColCount + ProvWidth * ProvCount, Height);
            //then, loop through each day and operatory
            Operatory curOp;
            bool      isHoliday;

            if (IsWeeklyView)
            {
                for (int d = 0; d < NumOfWeekDaysToDisplay; d++)
                {
                    isHoliday = false;
                    for (int i = 0; i < SchedListPeriod.Length; i++)
                    {
                        if (SchedListPeriod[i].SchedType != ScheduleType.Practice)
                        {
                            continue;
                        }
                        if (SchedListPeriod[i].Status != SchedStatus.Holiday)
                        {
                            continue;
                        }
                        if ((int)SchedListPeriod[i].SchedDate.DayOfWeek != d + 1)
                        {
                            continue;
                        }
                        isHoliday = true;
                        break;
                    }
                    if (isHoliday)
                    {
                        g.FillRectangle(holidayBrush, TimeWidth + 1 + d * ColDayWidth, 0, ColDayWidth, Height);
                    }
                    for (int j = 0; j < ColCount; j++)
                    {
                        curOp = Operatories.ListShort[ApptViewItems.VisOps[j]];
                        if (curOp.ProvDentist != 0 && !curOp.IsHygiene)                       //dentist
                        {
                            schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Provider, curOp.ProvDentist);
                        }
                        else if (curOp.ProvHygienist != 0 && curOp.IsHygiene)                       //hygienist
                        {
                            schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Provider, curOp.ProvHygienist);
                        }
                        else                          //no provider set
                        {
                            schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Provider, PrefB.GetInt("ScheduleProvUnassigned"));
                        }
                        for (int i = 0; i < schedForType.Length; i++)
                        {
                            if ((int)schedForType[i].SchedDate.DayOfWeek != d + 1)
                            {
                                continue;
                            }
                            g.FillRectangle(openBrush
                                            , TimeWidth + 1 + d * ColDayWidth + (float)j * ColAptWidth
                                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr + (int)schedForType[i].StartTime.Minute * Lh / MinPerRow //6RowsPerHr 10MinPerRow
                                            , ColAptWidth
                                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr                            //6
                                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);                        //10
                        }
                    }
                }
            }
            else             //only one day showing
            {
                isHoliday = false;
                for (int i = 0; i < SchedListPeriod.Length; i++)
                {
                    if (SchedListPeriod[i].SchedType != ScheduleType.Practice)
                    {
                        continue;
                    }
                    if (SchedListPeriod[i].Status != SchedStatus.Holiday)
                    {
                        continue;
                    }
                    isHoliday = true;
                    break;
                }
                for (int j = 0; j < ColCount; j++)
                {
                    curOp = Operatories.ListShort[ApptViewItems.VisOps[j]];
                    if (curOp.ProvDentist != 0 && !curOp.IsHygiene)                   //dentist
                    {
                        schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Provider, curOp.ProvDentist);
                    }
                    else if (curOp.ProvHygienist != 0 && curOp.IsHygiene)                   //hygienist
                    {
                        schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Provider, curOp.ProvHygienist);
                    }
                    else                      //no provider set
                    {
                        schedForType = Schedules.GetForType(SchedListPeriod, ScheduleType.Provider, PrefB.GetInt("ScheduleProvUnassigned"));
                    }
                    if (isHoliday)
                    {
                        g.FillRectangle(holidayBrush, TimeWidth + ProvWidth * ProvCount + j * ColWidth, 0, ColWidth, Height);
                    }
                    else
                    {
                        for (int i = 0; i < schedForType.Length; i++)
                        {
                            g.FillRectangle(openBrush
                                            , TimeWidth + ProvWidth * ProvCount + j * ColWidth
                                            , schedForType[i].StartTime.Hour * Lh * RowsPerHr + (int)schedForType[i].StartTime.Minute * Lh / MinPerRow //6RowsPerHr 10MinPerRow
                                            , ColWidth
                                            , (schedForType[i].StopTime - schedForType[i].StartTime).Hours * Lh * RowsPerHr                            //6
                                            + (schedForType[i].StopTime - schedForType[i].StartTime).Minutes * Lh / MinPerRow);                        //10
                        }
                    }
                }
            }
        }