private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            //Validate
            if (string.IsNullOrWhiteSpace(TaskNameField.Text) || string.IsNullOrWhiteSpace(DueDateField.Text))
            {
                MessageBox.Show("Please enter required information.", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                var now     = DateTime.Now;
                var DueDate = DueDateField.SelectedDate.Value.Date.ToString("yyyy-MM-dd");

                if (now > DueDateField.SelectedDate.Value.Date)
                {
                    //Fail
                    MessageBox.Show("Date must be in the future.", "Alert", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    //Upload
                    Database.ExQuery("UPDATE TASKS SET Name = '" + TaskNameField.Text + "', DueDate = '" + DueDate + "', Status = 'incomplete' WHERE ID = '" + ID.Text + "';");
                    if (Properties.Settings.Default.User_AdvancedLogging)
                    {
                        Log.Commit("[TaskSingle] Review with ID " + ID.Text + " Updated.");
                    }
                    string Content = "Tasks";
                    TasksHost.SetContent(Content);
                }
            }
        }
        private void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            //Validate input
            if (string.IsNullOrWhiteSpace(TaskNameField.Text) || string.IsNullOrWhiteSpace(DueDateField.Text))
            {
                MessageBox.Show("Please enter required information.", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                var now     = DateTime.Now;
                var DueDate = DueDateField.SelectedDate.Value.Date.ToString("yyyy-MM-dd");

                if (now > DueDateField.SelectedDate.Value.Date)
                {
                    //Fail
                    MessageBox.Show("Date must be in the future.", "Alert", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    //Upload
                    Database.ExQuery("INSERT INTO TASKS (ID, Name, Status, DueDate) VALUES (DEFAULT, '" + TaskNameField.Text + "', 'incomplete', '" + DueDate + "')");
                    if (Properties.Settings.Default.User_AdvancedLogging)
                    {
                        Log.Commit("[TasksControl:Create] New task added.");
                    }
                    var    result  = MessageBox.Show("Task Added!", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                    string Content = "Tasks";
                    TasksHost.SetContent(Content);
                }
            }
        }
Exemplo n.º 3
0
 public TasksHost()
 {
     InitializeComponent();
     Window = this;
     if (Properties.Settings.Default.User_AdvancedLogging)
     {
         Log.Commit("[TasksHost] Loaded.");
     }
     SetContent("Tasks");
 }
Exemplo n.º 4
0
        /// <summary>
        /// Sets the content of the main content section of the window.
        /// </summary>
        /// <param name="Content">The usercontrol that is to be loaded.</param>
        public static void SetContent(string Content)
        {
            switch (Content)
            {
            case "Reviews":
                //Set the content
                Window.MainContent.Content = new WebsiteHost();
                //Set the toolbar
                Window.ToolbarContent.Content = new WebsiteToolbar();
                //Set the specific content on the host control.
                WebsiteHost.SetContent(Content);
                break;

            case "Costs":
                Window.MainContent.Content    = new FinancesHost();
                Window.ToolbarContent.Content = new FinancesToolbar();
                FinancesHost.SetContent(Content);
                break;

            case "Prices":
                Window.MainContent.Content    = new FinancesHost();
                Window.ToolbarContent.Content = new FinancesToolbar();
                FinancesHost.SetContent(Content);
                break;

            case "Bookings":
                Window.MainContent.Content    = new BookingsHost();
                Window.ToolbarContent.Content = new BookingsToolbar();
                BookingsHost.SetContent(Content);
                break;

            case "ViewCustomers":
                Window.MainContent.Content    = new CustomersHost();
                Window.ToolbarContent.Content = new CustomersToolbar();
                CustomersHost.SetContent(Content);
                break;

            case "Tasks":
                Window.MainContent.Content    = new TasksHost();
                Window.ToolbarContent.Content = new TasksToolbar();
                TasksHost.SetContent(Content);
                break;
            }
        }
Exemplo n.º 5
0
        private void StatusButton_Click(object sender, RoutedEventArgs e)
        {
            if ((string)Status.Content == "complete")
            {
                //Update the selected task.
                Database.ExQuery("UPDATE TASKS SET Status = 'incomplete' WHERE ID = '" + ID.Text + "';");
                if (Properties.Settings.Default.User_AdvancedLogging)
                {
                    Log.Commit("[TaskSingle] Review with ID " + ID.Text + " Updated.");
                }
            }
            else
            {
                Database.ExQuery("UPDATE TASKS SET Status = 'complete' WHERE ID = '" + ID.Text + "';");
                if (Properties.Settings.Default.User_AdvancedLogging)
                {
                    Log.Commit("[TaskSingle] Review with ID " + ID.Text + " Updated.");
                }
            }
            string Content = "Tasks";

            TasksHost.SetContent(Content);
        }
        private void Tasks_Click(object sender, RoutedEventArgs e)
        {
            string Content = "Tasks";

            TasksHost.SetContent(Content);
        }