Esempio n. 1
0
        private void SaveProjectBut_Click(object sender, RoutedEventArgs e)
        {
            string Datapath = $"Data Source= " + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\PawloCore\" + _identity + @"_user_data" + @"\DynamicsData\dynamics.sqlite";


            if (string.IsNullOrWhiteSpace(ProjectNametxt.Text) || StartTimeDP.SelectedDate == null || FinishTimeDP.SelectedDate == null)
            {
                correctnessbq.Visibility     = Visibility.Visible;
                FieldsErrorLbl.Visibility    = Visibility.Visible;
                DateRangeErrorLbl.Visibility = Visibility.Hidden;
            }
            else
            {
                DateTime StartDate  = Convert.ToDateTime(StartTimeDP.Text);
                DateTime FinishDate = Convert.ToDateTime(FinishTimeDP.Text);

                Console.WriteLine(StartDate.ToShortDateString());
                result = DateTime.Compare(StartDate, FinishDate);

                if (result > 0)
                {
                    correctnessbq.Visibility     = Visibility.Visible;
                    DateRangeErrorLbl.Visibility = Visibility.Visible;
                    FieldsErrorLbl.Visibility    = Visibility.Hidden;
                }
                else
                {
                    try
                    {
                        correctnessbq.Visibility     = Visibility.Hidden;
                        DateRangeErrorLbl.Visibility = Visibility.Hidden;
                        FieldsErrorLbl.Visibility    = Visibility.Hidden;

                        string query = $"INSERT INTO PROJECTS (PROJECT_NAME, DATE_START, DATE_FINISH, DESCRIPTION) VALUES('{ProjectNametxt.Text}', '{StartDate.ToShortDateString()}', '{FinishDate.ToShortDateString()}', '{Descriptiontxt.Text}')";
                        EX_OR(query, Datapath);
                        query = $"SELECT * FROM PROJECTS ORDER BY ID DESC LIMIT 1";
                        PList = GetID(query, Datapath);

                        _IPHelper.AddEvent(PList);

                        MessageBox.Show("Utworzono projekt");
                        Projects.Project_page Page2 = new Projects.Project_page(_identity, _IPHelper);
                        NavigationService.Navigate(Page2);
                    }
                    catch
                    {}
                }
            }
        }
Esempio n. 2
0
 private void ReturnParentBut_Click(object sender, RoutedEventArgs e)
 {
     Projects.Project_page Page2 = new Projects.Project_page(_identity, _IPHelper);
     NavigationService.Navigate(Page2);
 }
Esempio n. 3
0
 private void ChangeDescriptionBut_Click(object sender, RoutedEventArgs e)
 {
     Projects.Project_page ProjectsSite = new Projects.Project_page(_identity, _IPHelper);
     NavigationService.Navigate(ProjectsSite);
 }