Example #1
0
        private void PrintTimeCell(object sender, PrintEventArgs e)
        {
            XRTableCell          cell = (XRTableCell)sender;
            EmployeePlanningWeek employeePlanningWeek = GetCurrentEmployeeWeek();
            EmployeeDayView      dayView = DayViewList.GetByEmployeeId(employeePlanningWeek.EmployeeId);

            if (dayView == null)
            {
                return;
            }
            StoreDay storeDay = _planningContext.StoreDays[dayView.ViewDate];

            if (storeDay == null)
            {
                return;
            }

            foreach (XRControl child in cell.Controls)
            {
                XRLabel      shape    = child as XRLabel;
                TimeCellInfo cellInfo = child.Tag as TimeCellInfo;
                if (shape == null || cellInfo == null)
                {
                    continue;
                }

                short currentTime = Convert.ToInt16(cellInfo.DayTime.TotalMinutes);

                Color color = storeDay.IsOpeningTime(currentTime) ? Color.White : Color.LightGray;
                if (!cellInfo.ManualFill)
                {
                    Color workingTimeColor = dayView.GetColor(currentTime / 15);
                    if (workingTimeColor != Color.White)
                    {
                        color = workingTimeColor;
                    }
                }
                ReportPainter.AcceptShape(shape, cell, color);
            }
        }
        private void PrintPlannedCell(object sender, PrintEventArgs e)
        {
            XRTableCell cell = (XRTableCell)sender;

            if (_plannedDayView == null)
            {
                return;
            }
            StoreDay storeDay = _recordingContext.StoreDays[_recordingContext.ViewDate];

            if (storeDay == null)
            {
                return;
            }

            foreach (XRControl child in cell.Controls)
            {
                XRLabel      shape    = child as XRLabel;
                TimeCellInfo cellInfo = child.Tag as TimeCellInfo;
                if (shape == null || cellInfo == null)
                {
                    continue;
                }

                short currentTime = Convert.ToInt16(cellInfo.DayTime.TotalMinutes);

                Color color = storeDay.IsOpeningTime(currentTime) ? Color.White : Color.LightGray;
                if (!cellInfo.ManualFill)
                {
                    Color workingTimeColor = _plannedDayView.GetColorByTime(currentTime);
                    if (workingTimeColor != Color.White)
                    {
                        color = workingTimeColor;
                    }
                }

                ReportPainter.AcceptShape(shape, cell, color);
            }
        }
Example #3
0
        public static void DrawDailyViewCell(RowCellCustomDrawEventArgs e, int index, DailyViewStyle view, StoreDay storeday, EmployeeDayView dayView)
        {
            Rectangle cellBound = Rectangle.Inflate(e.Bounds, 1, 1);

            e.Cache.FillRectangle(Color.White, cellBound);

            Rectangle rect;
            int squareWidth = cellBound.Width;
            Color squareColor = Color.White;
            //int index = infoColumn.FromTime / 15;
            int squareCount = 1;

            if (view == DailyViewStyle.View30)
            {
                cellBound = Rectangle.Inflate(cellBound, -2, 0);
                squareWidth = ((cellBound.Width - 1) / 2);
                squareCount = 2;
            }
            else if (view == DailyViewStyle.View60)
            {
                cellBound = Rectangle.Inflate(cellBound, -2, 0);

                squareWidth = ((cellBound.Width - 3) / 4);
                squareCount = 4;
            }

            int positionX = cellBound.X;
            int currentTime = index * 15;
            Color backColor = Color.White;

            for (int i = 0; i < squareCount; i++)
            {
                currentTime = (index + i) * 15;

                if (!storeday.IsOpeningTime((short)currentTime))
                {
                    backColor = Color.LightGray;
                }
                else backColor = Color.White;

                squareColor = dayView.GetColor(index + i);

                rect = new Rectangle(positionX, cellBound.Y, squareWidth, cellBound.Height);

                if (squareColor == Color.White)
                    squareColor = backColor;

                e.Cache.FillRectangle(squareColor, rect);

                positionX += squareWidth + 1;

            }

            e.Handled = true;
        }
Example #4
0
        public static void DrawDailyViewCell(RowCellCustomDrawEventArgs e, int index, DailyViewStyle view, StoreDay storeday, EmployeeDayView dayView)
        {
            Rectangle cellBound = Rectangle.Inflate(e.Bounds, 1, 1);

            e.Cache.FillRectangle(Color.White, cellBound);

            Rectangle rect;
            int       squareWidth = cellBound.Width;
            Color     squareColor = Color.White;
            //int index = infoColumn.FromTime / 15;
            int squareCount = 1;


            if (view == DailyViewStyle.View30)
            {
                cellBound   = Rectangle.Inflate(cellBound, -2, 0);
                squareWidth = ((cellBound.Width - 1) / 2);
                squareCount = 2;
            }
            else if (view == DailyViewStyle.View60)
            {
                cellBound = Rectangle.Inflate(cellBound, -2, 0);

                squareWidth = ((cellBound.Width - 3) / 4);
                squareCount = 4;
            }

            int   positionX   = cellBound.X;
            int   currentTime = index * 15;
            Color backColor   = Color.White;

            for (int i = 0; i < squareCount; i++)
            {
                currentTime = (index + i) * 15;

                if (!storeday.IsOpeningTime((short)currentTime))
                {
                    backColor = Color.LightGray;
                }
                else
                {
                    backColor = Color.White;
                }

                squareColor = dayView.GetColor(index + i);

                rect = new Rectangle(positionX, cellBound.Y, squareWidth, cellBound.Height);

                if (squareColor == Color.White)
                {
                    squareColor = backColor;
                }


                e.Cache.FillRectangle(squareColor, rect);


                positionX += squareWidth + 1;
            }

            e.Handled = true;
        }