Exemplo n.º 1
0
        private void createGraphic(object sender, RoutedEventArgs e)
        {
            if (listViewProjects.SelectedItem == null)
            {
                myMessageQueue.Enqueue(rm.GetString("selectRowToTakeAction"), rm.GetString("ok"), () => HandleOKMethod());
                return;
            }
            VarsProjectsAll varsProjectsAll = (VarsProjectsAll)listViewProjects.SelectedItem;

            ReportsGraphic reportsGraphic = new ReportsGraphic(varsProjectsAll.id);

            reportsGraphic.Show();
        }
Exemplo n.º 2
0
        private void createReport(object sender, RoutedEventArgs e)
        {
            if (listViewProjects.SelectedItem == null)
            {
                myMessageQueue.Enqueue(rm.GetString("selectRowToTakeAction"), rm.GetString("ok"), () => HandleOKMethod());
                return;
            }

            int             counter2        = countCheckBoxForReport2();
            VarsProjectsAll varsProjectsAll = (VarsProjectsAll)listViewProjects.SelectedItem;

            if (localDbConnectionUnity.State == ConnectionState.Closed)
            {
                localDbConnectionUnity.Open();
            }

            try
            {
                SqlCommand reportCommand = new SqlCommand("INSERT INTO Reports VALUES (@date)", localDbConnectionUnity);
                reportCommand.Parameters.AddWithValue("@date", Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")));
                reportCommand.ExecuteNonQuery();

                SqlCommand commandProjectReport = new SqlCommand("SELECT dbo.countReports()", localDbConnectionUnity);
                reportDone.Content = (int)commandProjectReport.ExecuteScalar();
            }
            catch { }

            localDbConnectionUnity.Close();

            if (localDbConnection.State == ConnectionState.Closed)
            {
                localDbConnection.Open();
            }

            SqlCommand command = new SqlCommand("SELECT dbo.getProjectDeviceType(@id)", localDbConnection);

            command.Parameters.AddWithValue("@id", varsProjectsAll.id);
            int type = int.Parse(command.ExecuteScalar().ToString());

            localDbConnection.Close();

            if (type == 1)
            {
                switch (countCheckBoxForReport1())
                {
                case 0:
                    myMessageQueue.Enqueue(rm.GetString("selectDataToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 1:
                    Report1 report1_1 = new Report1(varsProjectsAll.id, idList);
                    report1_1.Show();
                    break;

                case 2:
                    Report2 report1_2 = new Report2(varsProjectsAll.id, idList);
                    report1_2.Show();
                    break;

                case 3:
                    Report3 report1_3 = new Report3(varsProjectsAll.id, idList);
                    report1_3.Show();
                    break;

                case 4:
                    Report4 report1_4 = new Report4(varsProjectsAll.id, idList);
                    report1_4.Show();
                    break;

                case 5:
                    Report5 report1_5 = new Report5(varsProjectsAll.id, idList);
                    report1_5.Show();
                    break;

                case 6:
                    Report6 report1_6 = new Report6(varsProjectsAll.id, idList);
                    report1_6.Show();
                    break;

                case 7:
                    Report7 report1_7 = new Report7(varsProjectsAll.id, idList);
                    report1_7.Show();
                    break;

                case 8:
                    Report8 report1_8 = new Report8(varsProjectsAll.id, idList);
                    report1_8.Show();
                    break;

                case 9:
                    Report9 report1_9 = new Report9(varsProjectsAll.id, idList);
                    report1_9.Show();
                    break;

                case 10:
                    Report10 report1_10 = new Report10(varsProjectsAll.id, idList);
                    report1_10.Show();
                    break;

                case 11:
                    Report11 report1_11 = new Report11(varsProjectsAll.id, idList);
                    report1_11.Show();
                    break;
                }
            }
            else
            {
                switch (countCheckBoxForReport2())
                {
                case 0:
                    myMessageQueue.Enqueue(rm.GetString("selectDataToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 1:
                    Report1 report1_1 = new Report1(varsProjectsAll.id, idList);
                    report1_1.Show();
                    break;

                case 2:
                    Report2 report1_2 = new Report2(varsProjectsAll.id, idList);
                    report1_2.Show();
                    break;

                case 3:
                    Report3 report1_3 = new Report3(varsProjectsAll.id, idList);
                    report1_3.Show();
                    break;

                case 4:
                    Report4 report1_4 = new Report4(varsProjectsAll.id, idList);
                    report1_4.Show();
                    break;

                case 5:
                    Report5 report1_5 = new Report5(varsProjectsAll.id, idList);
                    report1_5.Show();
                    break;

                case 6:
                    Report6 report1_6 = new Report6(varsProjectsAll.id, idList);
                    report1_6.Show();
                    break;

                case 7:
                    Report7 report1_7 = new Report7(varsProjectsAll.id, idList);
                    report1_7.Show();
                    break;

                case 8:
                    Report8 report1_8 = new Report8(varsProjectsAll.id, idList);
                    report1_8.Show();
                    break;

                case 9:
                    Report9 report1_9 = new Report9(varsProjectsAll.id, idList);
                    report1_9.Show();
                    break;

                case 10:
                    Report10 report1_10 = new Report10(varsProjectsAll.id, idList);
                    report1_10.Show();
                    break;

                case 11:
                    Report11 report1_11 = new Report11(varsProjectsAll.id, idList);
                    report1_11.Show();
                    break;

                case 12:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 13:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 14:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 15:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;

                case 16:
                    myMessageQueue.Enqueue(rm.GetString("maxRowToReport"), rm.GetString("ok"), () => HandleOKMethod());
                    break;
                }
            }
        }