Example #1
0
        private void reportsButton_Click(object sender, EventArgs e)
        {
            sideBarPanel.Height = reportsButton.Height;
            sideBarPanel.Top    = reportsButton.Top;

            ReportUserControl reportUserControl = new ReportUserControl();

            ShowControl(reportUserControl);
        }
        public MainWindow()
        {
            InitializeComponent();

            #region Variables Initialization
            loggedIn              = false;
            CurrentVM             = new FallVM();
            userVM                = new UserVM();
            currentLang           = "Resources/ukFlagIcon.png";
            CurrentUser           = new user();
            CurrentUser.firstname = "Guest";
            main   = new MainUserControl();
            login  = new LoginUserControl(this);
            report = new ReportUserControl(this);
            #endregion

            #region Preparing the Source of the Falls Listbox
            userControlGrid.Children.Add(main);
            foreach (var fall in CurrentVM.Falls)
            {
                Pushpin pushpin = new Pushpin();
                pushpin.Name       = "pushpin" + fall.id.ToString();
                pushpin.Location   = new Location(fall.x, fall.y);
                pushpin.Background = System.Windows.Media.Brushes.Orange;
                main.fallsView.Children.Add(pushpin);
            }
            main.fallsListBox.ItemsSource = CurrentVM.Falls.OrderByDescending(fall => fall.date);
            #endregion

            #region Handling the previous "Recent" Reports
            // We want to make sure that, if recentFalls still reports from a previous day(s),
            // it will be cleared before we start storing reports on it today.
            XElement prevFallsRoot = XElement.Load("recentFalls.xml");
            if (prevFallsRoot.HasElements)
            {
                IEnumerable <XElement> prevFallsList = prevFallsRoot.Elements("Fall").ToList();
                DateTime lastReport = new DateTime(0);
                foreach (XElement fallRep in prevFallsList)
                {
                    DateTime leDate = DateTime.Now;
                    DateTime.TryParse(fallRep.Element("Date").Value, out leDate);
                    if (leDate.CompareTo(lastReport) > 0)
                    {
                        lastReport = leDate;
                    }
                }
                if (lastReport.Day != DateTime.Now.Day || lastReport.Month != DateTime.Now.Month || lastReport.Year != DateTime.Now.Year)
                {
                    // This is where we'd first save the previous days reports on a more permanent
                    // storage on the cloud, if we wanted to do that
                    File.WriteAllText(@"recentFalls.xml", string.Empty);
                }
            }
            #endregion
        }
Example #3
0
        public Home(string Login)
        {
            InitializeComponent();
            GliderDataContext gliderDataContext = GliderDataContext.Instance;
            User   user    = gliderDataContext.Users.FirstOrDefault(u => u.Login == Login);
            string company = user.Company;

            request     = new RequestUserControl(company);
            task        = new TaskUserControl(Login);
            mailUser    = new MailUserControl(Login);
            report      = new ReportUserControl(company);
            supportUser = new SupportUserControl();
        }
 private void ReportButton_Click(object sender, RoutedEventArgs e)
 {
     if (MainWindow.CurrentUser.firstname == "Guest")
     {
         showMustLogIn();
         return;
     }
     else if (MainWindow.CurrentUser.role.Trim() != "callcenter")
     {
         showMustBeCallcenter();
         return;
     }
     reportButton.BorderThickness = new Thickness(0, 0, 0, 2);
     reportButton.FontWeight      = FontWeights.ExtraBold;
     mainButton.BorderThickness   = new Thickness(0, 0, 0, 0);
     mainButton.FontWeight        = FontWeights.Normal;
     loginButton.BorderThickness  = new Thickness(0, 0, 0, 0);
     loginButton.FontWeight       = FontWeights.Normal;
     updateButton.BorderThickness = new Thickness(0, 0, 0, 0);
     updateButton.FontWeight      = FontWeights.Normal;
     userControlGrid.Children.RemoveAt(0);
     report = new ReportUserControl(this);
     userControlGrid.Children.Add(report);
 }
        /// <summary>
        /// Swich to the screen Report.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonReport_Click(object sender, EventArgs e)
        {
            ReportUserControl reportUserControl = new ReportUserControl();

            SwitchView(reportUserControl, ((Button)sender));
        }
Example #6
0
        private void InitializeInterfaceComonents()
        {
            #region Menu Items

            MenuItemUserControl CreateMenuItem(ContentItemEnum itemButtonEnum, Image menuItemImage, string itemButtonText)
            {
                return(new MenuItemUserControl(itemButtonEnum, OnMenuItemButton_Click, menuItemImage, itemButtonText)
                {
                    Size = new Size(240, 50)
                });
            }

            MenuItemUserControl CreateLogMenuItem(ContentItemEnum itemButtonEnum, Image menuItemImage, string itemButtonText)
            {
                return(new MenuItemUserControl(itemButtonEnum, OnMenuItemButton_Click, menuItemImage, itemButtonText)
                {
                    Size = new Size(240, 50)
                });
            }

            //Image image = global::MyFinance.Views.Properties.Resources.summary_icon;
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Summary, Properties.Resources.summary_icon, "Dashboard"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Passbook, Properties.Resources.Passbook_icon, "Passbook"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.TransactionParty, Properties.Resources.Transaction_party_icon, "Transaction Party"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Transaction, Properties.Resources.Transaction_icon, "Transactions"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Task, Properties.Resources.Tasks_icon, "Tasks"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Reports, Properties.Resources.Reports_Icon, "Reports"));
            menuFlowLayoutPanel.Controls.Add(CreateLogMenuItem(ContentItemEnum.Logs, Properties.Resources.logs, "My Actions"));
            #endregion

            #region Content section

            _summaryUserControl = new DashboardUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _passbookUserControl = new PassbookUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };
            _logsUserControl = new LogsUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };
            _transactionPartyUserControl = new TransactionPartyUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _transactionUserControl = new TransactionUserControl(OnMenuItemButton_Click)
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _taskUserControl = new TaskUserControl(OnMenuItemButton_Click)
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };
            _reportUserControl = new ReportUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };


            _selectedContentItemEnum = ContentItemEnum.Summary;
            mainContentPanel.Controls.Add(_summaryUserControl);
            #endregion
        }