Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            button1.Visible = false;
            if(button1.Text.Equals(GetLabel(DictionaryFileName,"StopButton")))
            {
                // Clean panel
                Close_panel();

                // Back
                comboBox1.Enabled = true;
                comboBox2.Enabled = true;
                maskedTextBox1.Enabled = true;
                radioButton1.Enabled = true;
                radioButton2.Enabled = true;
                panel4.Visible = true;
                radioButton3.Enabled = true;
                radioButton4.Enabled = true;
                button1.Text = GetLabel(DictionaryFileName, "RunButton");
            }
            else if (button1.Text.Equals(GetLabel(DictionaryFileName,"RunButton")))
            {
                List<bool> validation = new List<bool>();
                validation.Add(ValidateAsSelectedfromCombobox(comboBox2, label3));

                if (radioButton1.Checked == false && radioButton2.Checked == false && radioButton3.Checked == false && radioButton4.Checked == false)
                {
                    validation.Add(false);
                    ShowError(989, label2.Text.Split(':')[0]);
                }
                else
                {
                    validation.Add(true);
                }

                validation.Add(ValidateAsSelectedfromCombobox(comboBox1, label1));

                if (CompleteValidation(validation) == true)
                {
                    bool noerror = false;
                    // Testar conexão
                    DatabaseAccess.Query databaseAccess = new DatabaseAccess.Query();
                    List<string[]> matrix = new List<string[]>();
                    bool errorShown = false;
                    try
                    {
                       matrix = databaseAccess.query(GetLabel("config.ini", "Host"), GetLabel("config.ini", "UserID"), GetLabel("config.ini", "DatabaseName"), maskedTextBox1.Text, "SELECT * FROM `case`");
                       if (matrix[0][0].ToLower().Contains("*error*") && matrix[0][0].ToLower().Contains("access denied for user"))
                       {
                           ShowError(997, label4.Text.Split(':')[0]);
                           errorShown = true;
                       }
                       else if (matrix[0][0].ToLower().Contains("*error*"))
                       {
                           ShowError(984, GetLabel(DictionaryFileName,"InternetConnection"));
                           errorShown = true;
                       }
                       else
                       {
                           noerror = true;
                       }
                    }
                    catch
                    {
                        if (matrix.Count == 0)
                        {
                            // Means that read ok but there  isn't anything on the database
                            noerror = true;
                        }
                    }
                    if (noerror == false)
                    {
                        if ( errorShown == false)
                        {
                            ShowError(997, label4.Text.Split(':')[0]);
                        }
                    }
                    else
                    {
                        comboBox1.Enabled = false;
                        comboBox2.Enabled = false;
                        label5.Text = GetLabel(DictionaryFileName, "NoError.OK");
                        maskedTextBox1.Enabled = false;
                        radioButton1.Enabled = false;
                        int operationSelectedValue = -1;
                        if (radioButton1.Checked == true)
                        {
                            operationSelectedValue = 0;
                        }
                        radioButton2.Enabled = false;
                        if (radioButton2.Checked == true)
                        {
                            operationSelectedValue = 1;
                        }
                        radioButton3.Enabled = false;
                        if (radioButton3.Checked == true)
                        {
                            operationSelectedValue = 2;
                        }
                        radioButton4.Enabled = false;
                        if (radioButton4.Checked == true)
                        {
                            operationSelectedValue = 3;
                        }

                        GenerateNewForm(maskedTextBox1.Text, comboBox1.SelectedIndex, comboBox2.SelectedIndex, operationSelectedValue);
                        button1.Text = GetLabel(DictionaryFileName, "StopButton");
                    }
                }
                else
                {

                }
            }
            else
            {
                ShowError(992, "dictionary.dat");
            }
            button1.Visible = true;
        }
Ejemplo n.º 2
0
 private List<string[]> GetTransmissionMatrix()
 {
     DatabaseAccess.Query databaseAccess = new DatabaseAccess.Query();
     List<string[]> matrix = new List<string[]>();
     matrix = databaseAccess.query(GetLabel("config.ini", "Host"), GetLabel("config.ini", "UserID"), GetLabel("config.ini", "DatabaseName"), maskedTextBox1.Text,"SELECT * FROM  `case`");
     matrix = CaseTransmissionFiltering(matrix);
     return matrix;
 }
Ejemplo n.º 3
0
 private List<string[]> Query(string msgQuery)
 {
     List<string[]> matrix = new List<string[]>();
     DatabaseAccess.Query databaseAccess = new DatabaseAccess.Query();
     matrix = databaseAccess.query(GetLabel("config.ini", "Host"), GetLabel("config.ini", "UserID"), GetLabel("config.ini", "DatabaseName"), maskedTextBox1.Text, msgQuery);
     return matrix;
 }
Ejemplo n.º 4
0
        private int GetAreaID(int selectedIndex)
        {
            if (selectedIndex >= 0)
            {
                List<string[]> matrix = new List<string[]>();
                DatabaseAccess.Query databaseAccess = new DatabaseAccess.Query();
                matrix = databaseAccess.query(GetLabel("config.ini", "Host"), GetLabel("config.ini", "UserID"), GetLabel("config.ini", "DatabaseName"), maskedTextBox1.Text, "SELECT * FROM  `area`");
                try
                {
                    return Convert.ToInt32(matrix[selectedIndex][0]);
                }
                catch
                {
                    return -1;
                }

            }
            else
            {
                return -1;
            }
        }