Пример #1
0
        public Boolean insertUser(User user, Type type, String errorMethod)
        {
            int evaluetionMethod;
            EvaluetionMethodInfo emInfo = user.getEvaluetionMethodInfo();
            if(user.getEvaluetionMethodInfo().getEvaluetionMethod().Equals(EvaluetionMethod.Grade))
                evaluetionMethod = 0;
            else
                evaluetionMethod = 1;

            String insertUserString = "INSERT INTO USER (login, password, name, evaluetionMethod, " +
                                                         "higherLimit, lowerLimit, step) " +
                                                         "VALUES ('" +
                                                         user.getLogin() + "', '" +
                                                         user.getPassword() + "', '" +
                                                         user.getName() + "', " +
                                                         evaluetionMethod + ", " +
                                                         emInfo.getHigherLimit() + ", " +
                                                         emInfo.getLowerLimit() + ", '" +
                                                         emInfo.getStep().ToString() + "')";

            return executeNonQuery(insertUserString, type, errorMethod, "Insert user into databese failed.");
        }
Пример #2
0
 public void getNameTest()
 {
     string login = string.Empty; // TODO: Initialize to an appropriate value
     string password = string.Empty; // TODO: Initialize to an appropriate value
     string name = string.Empty; // TODO: Initialize to an appropriate value
     User target = new User(login, password, name); // TODO: Initialize to an appropriate value
     string expected = string.Empty; // TODO: Initialize to an appropriate value
     string actual;
     actual = target.getName();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Пример #3
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            LoginForm lf = new LoginForm();
            this.AddOwnedForm(lf);
            lf.ShowDialog(this);
            user = lf.getUser();
            if (user == null)
                Application.Exit();
            else
            {
                ssMain.Items.Add("Usuário: " + user.getName());

                DaoSession daoSession = new DaoSession();
                daoSession.openConnection(this.GetType(), "sqlErrorHandler");
                daoSession.createTable(this.GetType(), "sqlErrorHandler");
                daoSession.closeConnection();

                fillDataGridView();
            }
        }