private void Remove_Item(object sender, RoutedEventArgs e)
        {
            var button = sender as DependencyObject;

            while ((button != null) && !(button is DataGridRow))
            {
                button = VisualTreeHelper.GetParent(button);
            }

            if (button is DataGridRow)
            {
                Console.WriteLine("YESH");
                DataGridRow cell    = button as DataGridRow;
                TextBlock   potatoe = LogTable.Columns[0].GetCellContent(cell) as TextBlock;
                LogsDAO     logsdb  = new LogsDAO();
                Boolean     checker = logsdb.deleteLogFromTable(potatoe.Text);

                if (checker)
                {
                    SY_TagDAO tagdb = new SY_TagDAO();
                    tagdb.deleteTagFile(potatoe.Text);

                    Console.WriteLine("It works!");
                    FillDataGrid();
                }
                else
                {
                    Console.WriteLine("It does not work");
                }
            }
        }
コード例 #2
0
        private void validation_button(object sender, RoutedEventArgs e)
        {
            LogsDAO logdb = new LogsDAO();

            //Validation
            if ((Log_Name.Text.Equals(oldName)) || (logdb.checkIfLogs(Log_Name.Text)) || !(String.IsNullOrEmpty(Log_Name.Text)))
            {
                if (!(String.IsNullOrEmpty(Log_Desc.Text)))
                {
                    Boolean checker = logdb.UpdateToTable(Log_Name.Text, Log_Desc.Text, oldName);
                    if (checker)
                    {
                        SY_TagDAO tagdb = new SY_TagDAO();

                        tagdb.UpdateLogName(Log_Name.Text, oldName);

                        Console.WriteLine("WE DID IT!");
                        SY_ViewSpecificCase wnd = new SY_ViewSpecificCase(caseName);
                        wnd.Show();
                        Close();
                    }
                }
                else
                {
                    MessageBox.Show("Please fill up the Log Description");
                }
            }
            else
            {
                MessageBox.Show("Please fill up in the Log Name");
            }
        }
        private void validation_button(object sender, RoutedEventArgs e)
        {
            LogsDAO logdb = new LogsDAO();

            //Validation
            if (!(String.IsNullOrEmpty(Log_Name.Text)) && (logdb.checkIfLogs(Log_Name.Text)))
            {
                if (!(String.IsNullOrEmpty(Log_Desc.Text)))
                {
                    if (!(String.IsNullOrEmpty(filePath)))
                    {
                        if (formatBox.SelectedIndex > -1 && formatBox.SelectedIndex == 0)
                        {
                            CaseDAO casedb = new CaseDAO();
                            int     caseId = casedb.getCaseId(c_name);


                            Boolean checker = logdb.addLogToTable(Log_Name.Text, Log_Desc.Text, caseId, filePath, formatBox.Text);



                            if (checker)
                            {
                                int logId = logdb.getLogId(Log_Name.Text);

                                SY_TagDAO tagdb = new SY_TagDAO();
                                tagdb.addTagToTable(Log_Name.Text, logId);

                                Console.WriteLine("WE DID IT!");
                                SY_ViewSpecificCase wnd = new SY_ViewSpecificCase(c_name);
                                wnd.Show();
                                Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please select a file format");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please upload a path to load into");
                    }
                }
                else
                {
                    MessageBox.Show("Please fill up the Log Description");
                }
            }
            else
            {
                MessageBox.Show("Please fill up in the Log Name");
            }
        }
        private void Remove_Row(object sender, RoutedEventArgs e)
        {
            var button = sender as DependencyObject;

            while ((button != null) && !(button is DataGridRow))
            {
                button = VisualTreeHelper.GetParent(button);
            }

            if (button is DataGridRow)
            {
                Console.WriteLine("YOSH");
                DataGridRow cell     = button as DataGridRow;
                TextBlock   potatoe  = CaseTable.Columns[0].GetCellContent(cell) as TextBlock;
                CaseDAO     Case     = new CaseDAO();
                int         caseId   = Case.getCaseId(potatoe.Text);
                LogsDAO     logs     = new LogsDAO();
                SY_TagDAO   tagdb    = new SY_TagDAO();
                String      logName  = logs.getLogName(caseId);
                Boolean     checker3 = tagdb.deleteTagFile(logName);
                Boolean     checker  = logs.deleteThroughIdFromTable(caseId);
                Boolean     checker2 = Case.deleteCaseFromTable(potatoe.Text);



                if (checker && checker2 && checker3)
                {
                    Console.WriteLine("WORKS");
                    FillDataGrid();
                }
            }
            else
            {
                Console.WriteLine("No Works");
            }
        }
        private void validation_button(object sender, RoutedEventArgs e)
        {
            //Validation
            if (!(String.IsNullOrEmpty(Log_Name.Text)))
            {
                if (!(String.IsNullOrEmpty(Log_Desc.Text)))
                {
                    if (!(String.IsNullOrEmpty(filePath)))
                    {
                        if (formatBox.SelectedIndex > -1)
                        {
                            LogsDAO logDb = new LogsDAO();

                            if (logDb.checkIfLogs(Log_Name.Text))
                            {
                                CaseDAO db = new CaseDAO();

                                SY_TagDAO tagdb = new SY_TagDAO();

                                Boolean checker = db.addCaseToTable(c_name, c_desc, investList);

                                Boolean checker2 = false;

                                Boolean checker3 = false;



                                if (checker)
                                {
                                    int caseId = db.getCaseId(c_name);
                                    checker2 = logDb.addLogToTable(Log_Name.Text, Log_Desc.Text, caseId, filePath, formatBox.Text);
                                }



                                if (checker2)
                                {
                                    int logId = logDb.getLogId(Log_Name.Text);
                                    checker3 = tagdb.addTagToTable(Log_Name.Text, logId);

                                    Console.WriteLine("WE DID IT!");


                                    SY_CreatedSuccessCase wnd = new SY_CreatedSuccessCase();
                                    wnd.Show();
                                    Close();
                                }
                                else
                                {
                                    Console.WriteLine("Its not there");
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Please select a file format");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please upload a path to load into");
                    }
                }
                else
                {
                    MessageBox.Show("Please fill up the Log Description");
                }
            }
            else
            {
                MessageBox.Show("Please fill up in the Log Name");
            }
        }