Example #1
0
 public void addAtributeToXmlTest()
 {
     mainForm target = new mainForm(); // TODO: Initialize to an appropriate value
     XmlTextWriter t = null; // TODO: Initialize to an appropriate value
     string name = string.Empty; // TODO: Initialize to an appropriate value
     string text = string.Empty; // TODO: Initialize to an appropriate value
     target.addAtributeToXml(t, name, text);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Example #2
0
 public EditControl()
 {
     InitializeComponent();
     FileStream f = new FileStream("properties.xml", FileMode.OpenOrCreate);
     mf = this.ParentForm as mainForm;
     XmlTextReader settings = new XmlTextReader(f);
     while (settings.Read())
     {
         if (settings.NodeType == XmlNodeType.Element)
         {
             if (settings.Name.Equals("server"))
             {
                 server = settings.GetAttribute("servername");
                 dbname = settings.GetAttribute("dbname");
                 dbuser = settings.GetAttribute("dbuser");
                 dbpass = settings.GetAttribute("dbpass");
                 dbPort = settings.GetAttribute("dbport");
             }
         }
     }
     f.Close();
 }
Example #3
0
 public void mainFormConstructorTest()
 {
     mainForm target = new mainForm();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Example #4
0
 public void fillCardTest()
 {
     mainForm target = new mainForm(); // TODO: Initialize to an appropriate value
     string id = string.Empty; // TODO: Initialize to an appropriate value
     target.fillCard(id);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Example #5
0
 public void AddSlashesTest()
 {
     mainForm target = new mainForm(); // TODO: Initialize to an appropriate value
     string InputTxt = string.Empty; // TODO: Initialize to an appropriate value
     string expected = string.Empty; // TODO: Initialize to an appropriate value
     string actual;
     actual = target.AddSlashes(InputTxt);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string CommandText = "select accessLevel, idusers from ads_paper.users where `userName` ='" + login.Text + "' and `password` = '" + pass.Text + "'";
                string Connect = "Data Source=" + server + ";User Id=" + dbuser + ";Password="******";Port=" + dbPort;

                //Переменная Connect - это строка подключения в которой:
                //БАЗА - Имя базы в MySQL
                //ХОСТ - Имя или IP-адрес сервера (если локально то можно и localhost)
                //ПОЛЬЗОВАТЕЛЬ - Имя пользователя MySQL
                //ПАРОЛЬ - говорит само за себя - пароль пользователя БД MySQL

                MySqlConnection myConnection = new MySqlConnection(Connect);
                MySqlCommand myCommand = new MySqlCommand(CommandText, myConnection);
                myConnection.Open(); //Устанавливаем соединение с базой данных.
                MySqlDataReader MyDataReader;

                MyDataReader = myCommand.ExecuteReader();

                if (MyDataReader.Read())
                {
                    if (!MyDataReader.IsDBNull(0))
                    {
                        level = MyDataReader.GetInt32(0); //Получаем строку
                        userID = MyDataReader.GetInt32(1);
                    }
                    else
                    {
                        level = -1;
                    }
                }
                MyDataReader.Close();
                myConnection.Close(); //Обязательно закрываем соединение!

                if (level != -1)
                {
                    this.Hide();
                    mainForm f = new mainForm();
                    f.level = level;
                    f.Show();
                }
                else
                {
                    MessageBox.Show("Неверное введены имя пользователя или пароль");
                    Application.Exit();
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.ErrorCode.ToString() + "  " + ex.Message);
                this.Hide();
                mainForm f = new mainForm();
                f.level = 0;
                f.userID = userID;
                f.Show();
            }
        }