예제 #1
0
        public InvoiceManagement()
        {
            InitializeComponent();

            Column staffIDCol = DB.Tables.Where(t => t.Name == "Dog").First().Columns[1];

            tbxClientID = (ValidatedTextbox)UIMethods.GenAppropriateElement(staffIDCol, out _);
            tbxClientID.AddTextChangedEvent(TbxClientID_TextChanged);
            tbxClientID.Text   = "0";
            tbxClientID.Margin = new Thickness(110, 5, 0, 0);
            grd.Children.Add(tbxClientID);
        }
예제 #2
0
        public ShiftException(List <string> data, ContentWindows.ShiftManager _container)
        {
            InitializeComponent();
            container = _container;

            columns = DBObjects.DB.Tables.Where(t => t.Name == "Shift Exception").First().Columns;

            Tag = data[0];

            ComboBox cbxExStaff = (ComboBox)UIMethods.GenAppropriateElement(columns[1], out _);

            cbxExStaff.LayoutTransform   = new ScaleTransform(1.5, 1.5);
            cbxExStaff.Margin            = new Thickness(0, 0, 10, 0);
            cbxExStaff.SelectedIndex     = int.Parse(data[1]);
            cbxExStaff.SelectionChanged += CbxExStaff_SelectionChanged;
            stp.Children.Add(cbxExStaff);

            ValidatedDatePicker dtpExStart = new ValidatedDatePicker(columns[2]);

            dtpExStart.ToggleImage();
            dtpExStart.SetWidth(160);
            dtpExStart.Text = data[2];
            dtpExStart.AddTextChangedEvent(TextChangedEvent);
            stp.Children.Add(dtpExStart);

            Label lbl = new Label()
            {
                Content  = " to ",
                FontSize = 20
            };

            stp.Children.Add(lbl);

            ValidatedDatePicker dtpExEnd = new ValidatedDatePicker(columns[3]);

            dtpExEnd.ToggleImage();
            dtpExEnd.SetWidth(160);
            dtpExStart.Height = 40;
            dtpExEnd.Text     = data[3];
            dtpExEnd.AddTextChangedEvent(TextChangedEvent);
            stp.Children.Add(dtpExEnd);

            prevData = GetNewData(out _);
        }
예제 #3
0
        public ShiftManager()
        {
            InitializeComponent();

            shiftColumns    = DBObjects.DB.Tables.Where(t => t.Name == "Shift").First().Columns;
            shiftExcColumns = DBObjects.DB.Tables.Where(t => t.Name == "Shift Exception").First().Columns;

            // Get the colours for filters
            colours = new Color[]
            {
                Color.FromRgb(183, 28, 28),                // Red
                Color.FromRgb(2, 119, 189),                // Blue
                Color.FromRgb(190, 96, 0),                 // Dark orange? Not quite brown
                Color.FromRgb(46, 125, 50),                // Green
                Color.FromRgb(49, 27, 146)                 // Deep Purple
            };

            rctBase.Width  = dayWidth;
            rctBase.Height = hourHeight * 7;
            rctBase.Fill   = Brushes.Orange;

            List <List <string> > staffData   = MetaRequests.GetAllFromTable("Staff");
            List <Panel>          staffPanels = new List <Panel>();

            foreach (List <string> staff in staffData)
            {
                staffPanels.Add(GenForStaff(staff.ToArray()));
            }

            List <List <string> > shiftData = MetaRequests.GetAllFromTable("Shift");

            foreach (List <string> shift in shiftData)
            {
                Panel shiftPanel = GenShiftWithData(shift.ToArray());
                staffPanels[Convert.ToInt32(shift[1])].Children.Add(shiftPanel);
            }

            UpdateShiftExcs();

            FrameworkElement elemNewExStaff = UIMethods.GenAppropriateElement(shiftExcColumns[1], out _, false, true);

            elemNewExStaff.LayoutTransform = new ScaleTransform(1.5, 1.5);
            elemNewExStaff.Margin          = new Thickness(0, 0, 10, 0);
            stpNewExc.Children.Add(elemNewExStaff);

            ValidatedDatePicker dtpNewExStart = new ValidatedDatePicker(shiftExcColumns[2]);

            dtpNewExStart.ToggleImage();
            dtpNewExStart.SetWidth(160);
            dtpNewExStart.SelectedDate = DateTime.Now.Date;
            stpNewExc.Children.Add(dtpNewExStart);

            Label lbl = new Label()
            {
                Content  = " to ",
                FontSize = 20
            };

            stpNewExc.Children.Add(lbl);

            ValidatedDatePicker dtpNewExEnd = new ValidatedDatePicker(shiftExcColumns[3]);

            dtpNewExEnd.ToggleImage();
            dtpNewExEnd.SetWidth(160);
            dtpNewExEnd.SelectedDate = DateTime.Now.Date.AddDays(7);
            stpNewExc.Children.Add(dtpNewExEnd);

            Button btnConfirmNewEx = new Button()
            {
                Content             = " Submit ",
                FontSize            = 20,
                HorizontalAlignment = HorizontalAlignment.Right
            };

            btnConfirmNewEx.Click += BtnConfirmNewEx_Click;
            grdNewExc.Children.Add(btnConfirmNewEx);

            Thread loopThread = new Thread(Loop)
            {
                IsBackground = true
            };

            loopThread.Start();
        }
        /// <summary>
        /// Generate the items used for entering data
        /// </summary>
        private void GenDataEntry(int count)
        {
            List <StackPanel> panels       = new List <StackPanel>();
            StackPanel        currentPanel = new StackPanel()
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top
            };

            panels.Add(currentPanel);

            for (int i = 0; i < count; i++)
            {
                // Split the items into multiple columns if needed
                if (currentPanel.Children.Count > 10)
                {
                    currentPanel = new StackPanel()
                    {
                        Orientation         = Orientation.Vertical,
                        HorizontalAlignment = HorizontalAlignment.Left,
                        VerticalAlignment   = VerticalAlignment.Top,
                        Margin = new Thickness(-200, 0, 0, 0)
                    };
                    panels.Add(currentPanel);
                }

                // Generate the label used for displaying the column name
                Label lbl = new Label()
                {
                    Margin = new Thickness(0, 20, 0, 0)
                };

                FrameworkElement elem = UIMethods.GenAppropriateElement(columns[i], out string title);
                lbl.Content = title;
                if (elem is ValidatedItem v)
                {
                    v.AddTextChangedEvent(UpdateErrorEvent);
                }

                if (elem is ValidatedTextbox tbx && tableName == "Appointment" && columns[i].Name == "Dog ID")
                {
                    tbx.AddTextChangedEvent(TbxDogId_TextChanged);
                }

                displayElements[i] = elem;
                currentPanel.Children.Add(lbl);
                currentPanel.Children.Add(elem);
            }

            StackPanel panel = new StackPanel()
            {
                Orientation         = Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top
            };

            foreach (StackPanel p in panels)
            {
                panel.Children.Add(p);
            }
            stp.Children.Add(panel);
        }