Пример #1
0
        private Boolean createTheUser()
        {
            EvaluetionMethod em;
            float lowerLimit, higherLimit, step;

            user = new User(tbLogin.Text, password, tbUserName.Text);

            if (!(float.TryParse(cbbLowerLimit.Text, out lowerLimit) &&
                  float.TryParse(cbbHigherLimit.Text, out higherLimit) &&
                  float.TryParse(cbbSteps.Text, out step)))
            {
                MessageBox.Show("Preencha todos os campos relativos a como avaliar os vídeos");
                return false;
            }

            if (higherLimit < step)
            {
                MessageBox.Show("Assim a avaliação não vai funcionar. " +
                                "Diminua os passos ou aumente o limite superior");
                return false;
            }

            if (rbtnGrade.Checked)
                em = EvaluetionMethod.Grade;
            else
                em = EvaluetionMethod.Stars;

            user.setEvaluetionMethodInfo(em, lowerLimit, higherLimit, step);
            return true;
        }
Пример #2
0
 public void getLoginTest()
 {
     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.getLogin();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Пример #3
0
 public AddScreeningForm(User user, Session session)
     : this(user)
 {
     if (session != null)
     {
         this.session = session;
         this.video = session.getVideo();
         updating = true;
         rtbComment.Text = session.getComment();
         fillVideoInfo(video);
         btnSaveScreening.Text = "Alterar";
         btnSaveScreening.TextAlign = ContentAlignment.MiddleCenter;
     }
 }
Пример #4
0
        private User createUserFromDataReader(MySqlDataReader dataReader)
        {
            if (!dataReader.HasRows) return null;

            dataReader.Read();
            User user = new User(dataReader["login"].ToString(), dataReader["password"].ToString(),
                        dataReader["name"].ToString());

            EvaluetionMethod em;
            int evaluetionMethod = dataReader.GetInt16("evaluetionMethod");

            if(evaluetionMethod == 0)
                em = EvaluetionMethod.Grade;
            else
                em = EvaluetionMethod.Stars;

            user.setEvaluetionMethodInfo(em, (float) dataReader.GetInt16("lowerLimit"),
                                             (float) dataReader.GetInt16("higherLimit"),
                                              float.Parse(dataReader["step"].ToString()));
            return user;
        }
Пример #5
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.");
        }
Пример #6
0
 public Boolean insertUser(User user)
 {
     return insertUser(user, null, null);
 }
Пример #7
0
 public ConsultForm(User user)
     : this()
 {
     if (user != null)
         this.user = user;
 }
Пример #8
0
 public void setEvaluetionMethodInfoTest()
 {
     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
     EvaluetionMethod evaluetionMethod = new EvaluetionMethod(); // TODO: Initialize to an appropriate value
     float lowerLimit = 0F; // TODO: Initialize to an appropriate value
     float higherLimit = 0F; // TODO: Initialize to an appropriate value
     float step = 0F; // TODO: Initialize to an appropriate value
     target.setEvaluetionMethodInfo(evaluetionMethod, lowerLimit, higherLimit, step);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Пример #9
0
 public void UserConstructorTest()
 {
     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);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Пример #10
0
        private void tryToLogIn()
        {
            if (tbLogIn.Text.Length != 0 && tbPassword.Text.Length != 0)
            {
                DaoUser daoUser = new DaoUser();
                daoUser.openConnection(this.GetType(), "sqlErrorHandler");
                user = daoUser.getUserByLogin(tbLogIn.Text, this.GetType(), "sqlErrorHandler");
                daoUser.closeConnection();

                if (user != null && user.getPassword().Equals(tbPassword.Text))
                {
                    valid = true;
                }

                if (valid)
                    this.Close();
                else
                {
                    MessageBox.Show("Usuário ou senha não encontrados. " +
                                    "Tente novamente ou cadastre-se");
                    tbLogIn.Focus();
                }
            }
            else
                emptyFieldsWarning();
        }
Пример #11
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();
            }
        }
Пример #12
0
 public AddScreeningForm(User user)
     : this()
 {
     if(user != null ) this.user = user;
 }