예제 #1
0
        private void schedulerControl1_Paint(object sender, PaintEventArgs e)
        {
            Rectangle rect = Rectangle.Empty;

            if (schedulerControl1.ActiveView is DayView)
            {
                foreach (DayViewColumn column in ((DayViewInfo)schedulerControl1.ActiveView.ViewInfo).Columns)
                {
                    for (int i = 0; i < column.Cells.Count; i++)
                    {
                        TimeCell tc = column.Cells[i] as TimeCell;
                        if (tc.Interval.Start.Hour >= 12 && tc.Interval.Start.Hour <= 13)
                        {
                            if (rect == Rectangle.Empty)
                            {
                                rect = tc.Bounds;
                            }
                            else
                            {
                                rect = Rectangle.Union(rect, tc.Bounds);
                            }
                        }
                    }
                }
                if (rect != Rectangle.Empty)
                {
                    using (Font f = new Font("Arial", rect.Height - 4, GraphicsUnit.Pixel))
                        e.Graphics.DrawString("Horario de Almuerzo", f, msb, new PointF(rect.X + rect.Width / 2 - f.Size * 3, rect.Y + rect.Height / 2 - f.Size / 2));
                }
            }
        }
예제 #2
0
        private void schedulerControl1_Paint(object sender, PaintEventArgs e)
        {
            Rectangle rect = Rectangle.Empty;

            if (schedulerControl1.ActiveView is DayView)
            {
                foreach (DayViewColumn column in ((DayViewInfo)schedulerControl1.ActiveView.ViewInfo).Columns)
                {
                    for (int i = 0; i < column.Cells.Count; i++)
                    {
                        TimeCell tc = column.Cells[i] as TimeCell;
                        if (tc.Interval.Start.Hour >= Convert.ToInt32(tc.Resource.CustomFields["LunchStart"]) && tc.Interval.Start.Hour < Convert.ToInt32(tc.Resource.CustomFields["LunchEnd"]))
                        {
                            if (rect == Rectangle.Empty)
                            {
                                rect = tc.Bounds;
                            }
                            else
                            {
                                rect = Rectangle.Union(rect, tc.Bounds);
                            }
                        }
                    }

                    if (rect != Rectangle.Empty)
                    {
                        using (Font f = new Font("Arial", rect.Height / 3, GraphicsUnit.Pixel))
                            e.Graphics.DrawString("Lunch Time", f, msb, new PointF(rect.X + rect.Width / 2 - f.Size * 3, rect.Y + rect.Height / 2 - f.Size / 2));
                    }
                    rect = Rectangle.Empty;
                }
            }
        }
예제 #3
0
        private void dayViewTimeCells1_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e)
        {
            TimeCell  cell = (TimeCell)e.ObjectInfo;
            Rectangle rect = e.Bounds;

            rect.Height = 1;
            rect.Offset(0, rect.Height - 1);
            e.Cache.DrawRectangle(Pens.Gray, rect);
            if (cell is ExtendedCell)
            {
                SchedulerColorSchema schema = this.GetResourceColorSchema(cell.Resource);
                cell.Appearance.BackColor  = Color.White;
                cell.Appearance.BackColor2 = schema.CellLight;
                e.DrawDefault();
            }
            else
            {
                using (StringFormat sf = new StringFormat())
                {
                    sf.Alignment = StringAlignment.Far;
                    rect         = cell.Bounds;
                    rect.Inflate(-10, 0);
                    e.Cache.DrawString(cell.Interval.Start.ToShortTimeString(),
                                       e.Cache.GetFont(cell.Appearance.Font, FontStyle.Regular),
                                       e.Cache.GetSolidBrush(Color.Gray), rect, sf);
                }
            }
            e.Handled = true;
        }
예제 #4
0
        public static string GetCurrentTime(int groupId, string startDate, string endDate)
        {
            ScheduleBLL scheduleBLL = new ScheduleBLL();

            scheduleBLL.readGroupSchedule(groupId, Util.StringToDate(startDate), Util.StringToDate(endDate));
            List <Schedule> dss      = scheduleBLL.scheduleList;
            List <string>   allcells = new List <string>();
            List <TimeCell> tmCells  = new List <TimeCell>();

            foreach (Schedule s in dss)
            {
                List <String> cells = convertTimeLinetoTimeCell(s.freeSlotTimeFrom, s.freeSlotTimeTo);
                foreach (String c in cells)
                {
                    TimeCell tc = new TimeCell();
                    tc.cell      = c;
                    tc.colorCode = s.colorCode;
                    tc.userId    = s.userId;
                    tc.userName  = s.user.firstName + " " + s.user.lastName;
                    addTimeCell(tmCells, tc);
                }

                //   allcells.AddRange(cells);
            }

            String json = tmCells.ToJSON();


            return(json);
        }
예제 #5
0
 private void schedulerControl1_CustomDrawTimeCell(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e)
 {
     if (e.ObjectInfo is TimeCell)
     {
         TimeCell tc = e.ObjectInfo as TimeCell;
         if (tc.Interval.Start.Hour >= 12 && tc.Interval.Start.Hour < 14)
         {
             tc.Appearance.BackColor = Color.LightBlue;
         }
     }
 }
예제 #6
0
 private void schedulerControl1_CustomDrawTimeCell(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e)
 {
     if (e.ObjectInfo is TimeCell)
     {
         TimeCell tc = e.ObjectInfo as TimeCell;
         if (tc.Interval.Start.Hour >= Convert.ToInt32(tc.Resource.CustomFields["LunchStart"]) && tc.Interval.Start.Hour < Convert.ToInt32(tc.Resource.CustomFields["LunchEnd"]))
         {
             tc.Appearance.BackColor = Color.LightBlue;
         }
     }
 }
예제 #7
0
        private static void addTimeCell(List <TimeCell> tcList, TimeCell tc)
        {
            if (tcList.Contains(tc))
            {
                //list.Find(x => x.GetId() == "xy");
                List <TimeCell> rel = tcList.FindAll(x => x.cell == tc.cell);
                foreach (TimeCell t in rel)
                {
                    t.lapNumber++;
                    t.lapNames.Add(tc.userName);
                }
            }

            tcList.Add(tc);
        }
예제 #8
0
        private async void TimeCellTapRecognizer_Tapped(object sender, EventArgs e)
        {
            // get the cell that was tapped
            selectedElement = (TimeCell)sender;
            selectedIndex   = ViewStack.Children.IndexOf(selectedElement);

            // set the binding context to the panel
            // so that it can be inherited by the FakeCell and
            // any other controls required on the popup.
            FrontSide.BindingContext = selectedElement.BindingContext;

            // position the drop downs
            PositionDropDown(selectedElement, FrontSide);
            PositionDropDown(selectedElement, BackSide);

            // fade in the overlay
            FadeBackground.Opacity   = 0;
            FadeBackground.IsVisible = true;
            _ = FadeBackground.FadeTo(1, animationSpeed);

            // position the close button
            var padding         = 40;
            var xPos            = (this.Width / 2) - (CloseButton.Width / 2);
            var yPos            = selectedElement.Bounds.Y + FrontSide.Bounds.Height + padding;
            var closeButtonRect = new Rectangle(xPos, yPos, CloseButton.Width, CloseButton.Height);

            AbsoluteLayout.SetLayoutBounds(CloseButton, closeButtonRect);

            // hide the dropdowns
            FrontSide.IsVisible      = true;
            DeleteDropDown.IsVisible = false;
            EditDropDown.IsVisible   = false;
            InfoDropDown.IsVisible   = false;
            BackSide.IsVisible       = false;
            CloseButton.Opacity      = 0;

            await OpenDropDown(DeleteDropDown);
            await OpenDropDown(EditDropDown);
            await OpenDropDown(InfoDropDown);

            AnimateCloseButton(CloseButton, entering: true);
        }
예제 #9
0
    protected void DayPilotScheduler1_OnTimeRangeSelected(object sender, TimeRangeSelectedEventArgs e)
    {
        int slotDuration = 60;

        int doctorId = Convert.ToInt32(e.Resource);

        for (int i = 0; i < DayPilotScheduler1.Timeline.Count; i++)
        {
            TimeCell cell = DayPilotScheduler1.Timeline[i];

            if (e.Start <= cell.Start && cell.End <= e.End)
            {
                for (DateTime start = cell.Start; start < cell.End; start = start.AddMinutes(slotDuration))
                {
                    CreateShift(start, start.AddMinutes(slotDuration), doctorId);
                }
            }
        }

        LoadTimeline();
        LoadAppointments();
    }
        void ReleaseDesignerOutlets()
        {
            if (CommentCell != null)
            {
                CommentCell.Dispose();
                CommentCell = null;
            }

            if (IconCell != null)
            {
                IconCell.Dispose();
                IconCell = null;
            }

            if (PeriodCell != null)
            {
                PeriodCell.Dispose();
                PeriodCell = null;
            }

            if (PeriodIconCell != null)
            {
                PeriodIconCell.Dispose();
                PeriodIconCell = null;
            }

            if (TimeCell != null)
            {
                TimeCell.Dispose();
                TimeCell = null;
            }

            if (UserCell != null)
            {
                UserCell.Dispose();
                UserCell = null;
            }
        }
예제 #11
0
        public ManageTipsPage(Coach coach)
        {
            this.coach = coach;
            Title      = "Tips instellen";
            NavigationPage.SetBackButtonTitle(this, "Terug");

            selectTipsPage = new SelectTipsPage(coach);

            selectTips = createNewTextCells("Tips instellen");

            var times = coach.Scheduler.GetTimes();

            var timeSection = new TableSection("Tijden: ");

            Action renderTimeSection = () =>
            {
                timeSection.Clear();

                /* timeSection.Replace(
                 *  new TextCell {
                 *      Text = "Tijden waarop u een tip ontvangt:",
                 *      TextColor = Color.Yellow,
                 *      IsEnabled = false,
                 *      Detail = "bla",
                 *      DetailColor = Color.Green
                 *  }
                 * ); */
                foreach (TimeSpan time in times)
                {
                    var newTimeCell = new TimeCell(coach.Scheduler, time);
#if __ANDROID__
                    newTimeCell.TextColor = Color.Black;
#endif
                    timeSection.Add(newTimeCell);
                }
                timeSection.Add((new TextCell
                {
                    Text = "Tijd toevoegen",
#if __ANDROID__
                    TextColor = Color.Black,
#endif
                    Command = new Command(async() =>
                    {
                        await ShowSelectTimeAlert(coach.Scheduler);
                    }),
                    StyleId = "disclosure"
                }));
            };

            times.AsObservable().CollectionChanged += (sender, e) => renderTimeSection();
            renderTimeSection();

            Content = new TableView
            {
                Root = new TableRoot {
                    new TableSection {
                        selectTips
                    },
                    timeSection
                },
                Intent = TableIntent.Settings
            };
        }
예제 #12
0
파일: fLichSX.cs 프로젝트: trancongvy/CBAPV
        private void Schedu_CustomDrawTimeCell(object sender, CustomDrawObjectEventArgs e)
        {
            Color workColor;
            //if (!chkShowWork.Checked) return;

            TimeCell Cellinfo = e.ObjectInfo as TimeCell;

            DateTime bLunch = DateTime.Parse(Cellinfo.Interval.Start.ToShortDateString() + " " + Config.GetValue("TimeStartLunch").ToString() + ":00");
            DateTime eLunch = DateTime.Parse(Cellinfo.Interval.Start.ToShortDateString() + " " + Config.GetValue("TimeEndLunch").ToString() + ":00");
            DateTime bWork  = DateTime.Parse(Cellinfo.Interval.Start.ToShortDateString() + " " + Config.GetValue("TimeStart").ToString() + ":00");

            DateTime eWork = DateTime.Parse(Cellinfo.Interval.Start.ToShortDateString() + " " + Config.GetValue("TimeEnd").ToString() + ":00");

            if (Cellinfo.Interval.Start.DayOfWeek == DayOfWeek.Saturday)
            {
                if (Config.GetValue("SatudayWork").ToString() == "0")
                {
                    bLunch = bWork; eLunch = bWork; eWork = bWork;
                }
                else if (Config.GetValue("SatudayWork").ToString() == "1")
                {
                    eLunch = bLunch; eWork = bLunch;
                }
            }
            if (bWork.DayOfWeek == DayOfWeek.Sunday)// Chủ nhật
            {
                bLunch = bWork; eLunch = bWork; eWork = bWork;
            }
            string MayinCondition;

            if (Cellinfo.Resource.Id.GetType() == typeof(DevExpress.XtraScheduler.Native.EmptyResource))
            {
                MayinCondition = " MaMIn is null";
            }
            else
            {
                MayinCondition = " MaMIn='" + Cellinfo.Resource.Id.ToString() + "'";
            }
            DataRow[] dr = ctTangCa.Select("isLunch =1 and ngay='" + Cellinfo.Interval.Start.ToShortDateString() + "' and " + MayinCondition);
            if (dr.Length > 0)
            {
                bLunch = bLunch.AddHours(double.Parse(dr[0]["Sogio"].ToString()));
            }
            dr = ctTangCa.Select("isNight=1 and ngay='" + Cellinfo.Interval.Start.ToShortDateString() + "' and " + MayinCondition);
            if (dr.Length > 0)
            {
                double sogio = double.Parse(dr[0]["Sogio"].ToString());
                if (sogio < (DateTime.Parse(eWork.ToShortDateString()).AddDays(1) - eWork).TotalHours)
                {
                    eWork = eWork.AddHours(sogio);
                }
                else
                {
                    eWork = DateTime.Parse(eWork.ToShortDateString()).AddDays(1);
                }
            }
            //if (Cellinfo != null && Cellinfo.Interval.Duration.Hours == 1 && Cellinfo.IsWorkTime)
            //{//
            //    lightColor = Color.White;//Cellinfo.Appearance.BackColor;//
            //}
            //else if (Cellinfo != null && Cellinfo.Interval.Duration.Hours == 1 && !Cellinfo.IsWorkTime)
            //{
            //    grayColor = Color.Gray;// ellinfo.Appearance.BackColor;
            //}

            //     Color.White;//

            res = Cellinfo.Resource;
            DateTime start = Cellinfo.Interval.Start;

            if (schedu.Storage == null)
            {
                return;
            }
            int idx = schedu.Storage.Resources.Items.IndexOf(Cellinfo.Resource);

            if (idx == -1)
            {
                return;
            }
            if (Cellinfo.Interval.Duration.Hours >= 1)
            {
                if ((start >= bWork && start < bLunch) || (start >= eLunch && start < eWork))
                {
                    Cellinfo.Appearance.BackColor = schedu.ResourceColorSchemas[idx].CellLight;
                }
                else
                {
                    Cellinfo.Appearance.BackColor = schedu.ResourceColorSchemas[idx].Cell;
                }
            }
            else if (Cellinfo.Interval.Duration.Days == 1)
            {
                if (bWork < eWork)
                {
                    Cellinfo.Appearance.BackColor = schedu.ResourceColorSchemas[idx].CellLight;
                }
                else
                {
                    Cellinfo.Appearance.BackColor = schedu.ResourceColorSchemas[idx].Cell;
                }
            }
            if (Cellinfo.Interval.Duration.Minutes >= 15)
            {
                if ((start >= bWork && start < bLunch) || (start >= eLunch && start < eWork))
                {
                    Cellinfo.Appearance.BackColor = schedu.ResourceColorSchemas[idx].CellLight;
                }
                else
                {
                    Cellinfo.Appearance.BackColor = schedu.ResourceColorSchemas[idx].Cell;
                }
            }
        }
예제 #13
0
 public void RemoveCell(TimeCell cell)
 {
     Destroy(cell.gameObject);
     cells.Remove(cell);
 }