Exemple #1
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            SchedDefault schedDefaultCur = new SchedDefault();

            schedDefaultCur.SchedType = SchedType;
            if (SchedType == ScheduleType.Provider)
            {
                schedDefaultCur.ProvNum = Providers.List[listProv.SelectedIndex].ProvNum;
            }
            FormSchedDefaultBlockEdit FormBE = new FormSchedDefaultBlockEdit(schedDefaultCur);

            FormBE.IsNew = true;
            FormBE.ShowDialog();
            if (FormBE.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            FillGrid();
        }
Exemple #2
0
        private void contrGrid_DoubleClick(object sender, System.EventArgs e)
        {
            int tempDay = (int)Math.Floor((double)(mousePos.X - contrGrid.NumW) / (double)contrGrid.ColW);

            if (tempDay == 7)
            {
                return;
            }
            if (tempDay == -1)
            {
                return;
            }
            int tempOpI
                = (int)Math.Floor((mousePos.X - contrGrid.NumW - (tempDay * contrGrid.ColW)) / contrGrid.opW);
            int      tempMin  = (int)((mousePos.Y - Math.Floor((double)mousePos.Y / (double)contrGrid.RowH / 6) * contrGrid.RowH * 6) / contrGrid.RowH) * 10;
            int      tempHr   = (int)Math.Floor((double)mousePos.Y / (double)contrGrid.RowH / (double)6);
            TimeSpan tempSpan = new TimeSpan(tempHr, tempMin, 0);

            //MessageBox.Show(tempDay.ToString()+","+tempHr.ToString()+":"+tempMin.ToString());
            for (int i = 0; i < SchedDefaults.List.Length; i++)
            {
                if (SchedType == ScheduleType.Practice)              //for practice
                {
                    if (SchedDefaults.List[i].SchedType != ScheduleType.Practice)
                    {
                        continue;                        //only use practice blocks
                    }
                }
                if (SchedType == ScheduleType.Provider)              //for providers
                {
                    if (SchedDefaults.List[i].SchedType != ScheduleType.Provider)
                    {
                        continue;                        //only use prov blocks
                    }
                    if (SchedDefaults.List[i].ProvNum != Providers.List[listProv.SelectedIndex].ProvNum)
                    {
                        continue;                        //only use blocks for this prov
                    }
                }
                if (SchedType == ScheduleType.Blockout)              //for blockouts
                //only use blockout blocks
                {
                    if (SchedDefaults.List[i].SchedType != ScheduleType.Blockout)
                    {
                        continue;
                    }
                    //if op is zero (any), then don't filter
                    if (SchedDefaults.List[i].Op != 0)
                    {
                        if (Operatories.GetOrder(SchedDefaults.List[i].Op) != tempOpI)
                        {
                            continue;
                        }
                    }
                }
                if (tempDay == SchedDefaults.List[i].DayOfWeek &&
                    tempSpan >= SchedDefaults.List[i].StartTime.TimeOfDay &&
                    tempSpan < SchedDefaults.List[i].StopTime.TimeOfDay)
                {
                    FormSchedDefaultBlockEdit FormBE = new FormSchedDefaultBlockEdit(SchedDefaults.List[i]);
                    FormBE.ShowDialog();
                    if (FormBE.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    changed = true;
                    FillGrid();
                    return;
                }
            }
        }