private void Search_Log(object sender, RoutedEventArgs e)
        {
            if (!(String.IsNullOrEmpty(SearchBox.Text)))
            {
                string connectionString = ConfigurationManager.ConnectionStrings["MainPage.Properties.Settings.LocalDBConnectionString"].ConnectionString;

                CaseDAO caseDb  = new CaseDAO();
                int     case_id = caseDb.getCaseId(C_Name);

                string query = "SELECT Log_Name, Log_Desc FROM Network_Log WHERE Case_Id = @cId AND Log_Name = @logName";

                using (SqlConnection myConnection = new SqlConnection(connectionString))
                    using (SqlCommand cmd = new SqlCommand(query, myConnection))
                        using (SqlDataAdapter adapt = new SqlDataAdapter(cmd))
                        {
                            cmd.Parameters.AddWithValue("@cId", case_id);
                            cmd.Parameters.AddWithValue("@logName", SearchBox.Text);

                            DataTable table = new DataTable("Network_Log");
                            adapt.Fill(table);
                            LogTable.ItemsSource = table.DefaultView;
                        }
            }
            else
            {
                FillDataGrid();
            }
        }
        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");
            }
        }
コード例 #3
0
        private void Verify_Next(object sender, RoutedEventArgs e)
        {
            //Validation
            if (!(String.IsNullOrEmpty(case_name.Text)))
            {
                if (!(String.IsNullOrEmpty(case_desc.Text)))
                {
                    if (!(investList.Items.Count == 0))
                    {
                        CaseDAO db = new CaseDAO();


                        //Push to next page and ask for network file
                        String CName = case_name.Text;
                        String CDesc = case_desc.Text;
                        if (db.checkIfCaseName(CName))
                        {
                            ArrayList aList = new ArrayList();
                            for (int i = 0; i < investList.Items.Count; i++)
                            {
                                ListBoxItem item = (ListBoxItem)(investList.ItemContainerGenerator.ContainerFromIndex(i));
                                aList.Add(item.Content.ToString());
                            }

                            SY_NetworkLogUpload wnd = new SY_NetworkLogUpload(CName, CDesc, aList);
                            wnd.Show();
                            Close();
                        }
                        else
                        {
                            MessageBox.Show("Case Name Has Already Existed!");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Null or Empty");
                    }
                }
                else
                {
                    Console.WriteLine("Null or Empty");
                }
            }
            else
            {
                Console.WriteLine("Null or Empty");
            }
        }
コード例 #4
0
        private void LoadData()
        {
            CaseDAO casedb = new CaseDAO();
            Case    data   = casedb.getCaseFromTable(cName);

            case_name.Text = data.C_Name;
            case_desc.Text = data.C_Desc;
            List <String> items = data.C_Authors.ToList();

            foreach (var item in items)
            {
                investList.Items.Add(item);
            }

            OldCase = case_name.Text;
            path    = data.pathAuthors;
        }
        private void FillDataGrid()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["MainPage.Properties.Settings.LocalDBConnectionString"].ConnectionString;

            CaseDAO caseDb  = new CaseDAO();
            int     case_id = caseDb.getCaseId(C_Name);

            string query = "SELECT Log_Name, Log_Desc FROM Network_Log WHERE Case_Id = @cId";

            using (SqlConnection myConnection = new SqlConnection(connectionString))
                using (SqlCommand cmd = new SqlCommand(query, myConnection))
                    using (SqlDataAdapter adapt = new SqlDataAdapter(cmd))
                    {
                        cmd.Parameters.AddWithValue("@cId", case_id);

                        DataTable table = new DataTable("Network_Log");
                        adapt.Fill(table);
                        LogTable.ItemsSource = table.DefaultView;
                    }
        }
        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");
            }
        }
コード例 #8
0
        private void Verify_Next(object sender, RoutedEventArgs e)
        {
            //Validation
            if (!(String.IsNullOrEmpty(case_name.Text)))
            {
                if (!(String.IsNullOrEmpty(case_desc.Text)))
                {
                    if (!(investList.Items.Count == 0))
                    {
                        CaseDAO db = new CaseDAO();


                        //Push to next page and ask for network file
                        String CName = case_name.Text;
                        String CDesc = case_desc.Text;
                        if ((CName.Equals(OldCase)) || (db.checkIfCaseName(CName)))
                        {
                            List <String> aList = new List <String>();
                            for (int i = 0; i < investList.Items.Count; i++)
                            {
                                ListBoxItem item = (ListBoxItem)(investList.ItemContainerGenerator.ContainerFromIndex(i));
                                aList.Add(item.Content.ToString());
                            }

                            Case newCase = new Case(CName, CDesc, path);

                            CaseDAO casedb  = new CaseDAO();
                            Boolean checker = casedb.updateToTable(newCase, OldCase);
                            if (checker)
                            {
                                string json = JsonConvert.SerializeObject(aList.ToArray());
                                System.IO.File.WriteAllText(path, json);
                            }
                            else
                            {
                                System.Console.WriteLine("GAY SHIT");
                            }

                            SY_ViewCases wnd = new SY_ViewCases();
                            wnd.Show();
                            Close();
                        }
                        else
                        {
                            MessageBox.Show("Case Name Has Already Existed!");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Null or Empty");
                    }
                }
                else
                {
                    Console.WriteLine("Null or Empty");
                }
            }
            else
            {
                Console.WriteLine("Null or Empty");
            }
        }