Ejemplo n.º 1
0
        private void initRows()
        {
            int daysInMonth = DateTime.DaysInMonth(year, month);

            //Debug.WriteLine("ACTUAL DATE: " + periods[periods.Count - 1]);
            for (int n = 0; n < daysInMonth; ++n)
            {
                DateTime day = new DateTime(year, month, n + 1);

                //Check if work period exists already
                //  Init row with period if it exists already, or create a new period
                int periodIndex = workPeriodData.BinarySearch(new work_period(day), work_period.CompareByDate());

                if (periodIndex >= 0)
                {
                    work_period p = workPeriodData[periodIndex];
                    //periods.Add(p);
                    row_interface ri = new row_interface(p);
                    ri.ApplySettings(ref settings);
                    rowList.Add(ri);
                }
                else if (workPeriodData.Count > 0)
                {
                    int         indexComplement = ~periodIndex - 1;
                    work_period p = new work_period(day);
                    p.CumulativeMins = workPeriodData[indexComplement].CumulativeMins;
                    workPeriodData.Add(p);
                    row_interface ri = new row_interface(workPeriodData[workPeriodData.Count - 1]);
                    ri.ApplySettings(ref settings);
                    rowList.Add(ri);
                }
                else
                {
                    work_period p = new work_period(day);
                    workPeriodData.Add(p);
                    row_interface ri = new row_interface(workPeriodData[workPeriodData.Count - 1]);
                    ri.ApplySettings(ref settings);
                    rowList.Add(ri);
                }
                workPeriodData.Sort(work_period.CompareByDate());
                //Set row properties and events
                //rowList[n].KeyDownEvent += row_interface_group_KeyDown;
                rowList[n].Location           = new Point(0, n * row_interface.rowHeight);
                rowList[n].VerticalArrowDown += ControlVerticalArrowPressed;
                rowList[n].InputRowSelected  += inputRowSelected;
                rowList[n].LeaveTimeBoxEvent += onLeaveTimeBox;
                panel1.Controls.Add(rowList[n]);
            }
        }
Ejemplo n.º 2
0
        private void autoCreateHeaders()
        {
            row_interface dummy = new row_interface(new work_period(DateTime.Now));

            dummy.ApplySettings(ref settings);

            foreach (Control c in dummy.Controls)
            {
                Label l = new Label();
                l.Location = new Point(c.Location.X, 0);
                l.Font     = new Font("Arial", 12);
                l.Text     = (string)c.Tag;
                int height = l.Height;
                l.AutoSize  = false;
                l.Size      = new Size(c.Size.Width, height);
                l.TextAlign = ContentAlignment.MiddleCenter;
                this.Controls.Add(l);
                checkHeaderHeight(l);
            }
        }
Ejemplo n.º 3
0
        private void createHeaders()
        {
            row_interface dummy = new row_interface(new work_period(DateTime.Now));

            dummy.ApplySettings(ref settings);
            maxHeaderHeight = 0;

            int    maxHeaderWidth = 80;
            int    fontSize       = 10;
            string font           = "Arial";
            int    yoffset        = 0;
            int    xoffset        = 0;

            Label lh_dayOfMonth = new Label();

            lh_dayOfMonth.AutoSize    = true;
            lh_dayOfMonth.MaximumSize = new Size(maxHeaderWidth, 3000);
            lh_dayOfMonth.Text        = "Day of Month";
            lh_dayOfMonth.Font        = new Font(font, fontSize, FontStyle.Regular);
            lh_dayOfMonth.Location    = new Point(dummy.Location_DayOfMonth + xoffset, yoffset);
            Controls.Add(lh_dayOfMonth);
            checkHeaderHeight(lh_dayOfMonth);

            Label lh_WeekNumber = new Label();

            lh_WeekNumber.AutoSize    = true;
            lh_WeekNumber.MaximumSize = new Size(maxHeaderWidth, 3000);
            lh_WeekNumber.Text        = "Week Number";
            lh_WeekNumber.Font        = new Font(font, fontSize, FontStyle.Regular);
            lh_WeekNumber.Location    = new Point(dummy.Location_WeekNum + xoffset, yoffset);
            Controls.Add(lh_WeekNumber);
            checkHeaderHeight(lh_WeekNumber);

            Label lh_StartTime = new Label();

            lh_StartTime.AutoSize    = true;
            lh_StartTime.MaximumSize = new Size(maxHeaderWidth, 3000);
            lh_StartTime.Text        = "Start Time";
            lh_StartTime.Font        = new Font(font, fontSize, FontStyle.Regular);
            lh_StartTime.Location    = new Point(dummy.Location_StartTime + xoffset, yoffset);
            Controls.Add(lh_StartTime);
            checkHeaderHeight(lh_StartTime);

            Label lh_EndTime = new Label();

            lh_EndTime.AutoSize    = true;
            lh_EndTime.MaximumSize = new Size(maxHeaderWidth, 3000);
            lh_EndTime.Text        = "End Time";
            lh_EndTime.Font        = new Font(font, fontSize, FontStyle.Regular);
            lh_EndTime.Location    = new Point(dummy.Location_EndTime + xoffset, yoffset);
            Controls.Add(lh_EndTime);
            checkHeaderHeight(lh_EndTime);

            Label lh_Overtime = new Label();

            lh_Overtime.AutoSize    = true;
            lh_Overtime.MaximumSize = new Size(maxHeaderWidth, 3000);
            lh_Overtime.Text        = "Overtime";
            lh_Overtime.Font        = new Font(font, fontSize, FontStyle.Regular);
            lh_Overtime.Location    = new Point(dummy.Location_Overtime + xoffset, yoffset);
            Controls.Add(lh_Overtime);
            checkHeaderHeight(lh_Overtime);

            Label lh_ShiftPremium = new Label();

            lh_ShiftPremium.AutoSize    = true;
            lh_ShiftPremium.MaximumSize = new Size(maxHeaderWidth, 3000);
            lh_ShiftPremium.Text        = "Shift Premiums";
            lh_ShiftPremium.Font        = new Font(font, fontSize, FontStyle.Regular);
            lh_ShiftPremium.Location    = new Point(dummy.Location_ShiftPremium + xoffset, yoffset);
            Controls.Add(lh_ShiftPremium);
            checkHeaderHeight(lh_ShiftPremium);

            Label lh_Washup = new Label();

            lh_Washup.AutoSize    = true;
            lh_Washup.MaximumSize = new Size(maxHeaderWidth, 3000);
            lh_Washup.Text        = "Washup Time";
            lh_Washup.Font        = new Font(font, fontSize, FontStyle.Regular);
            lh_Washup.Location    = new Point(dummy.Location_WashupTime + xoffset - 10, yoffset);
            Controls.Add(lh_Washup);
            checkHeaderHeight(lh_Washup);
        }