Exemplo n.º 1
0
        private void btn_Validate_Click(object sender, EventArgs e)
        {
            InitializeLabelColors();
            Actor act = new Actor();
            act.setLogin(txtBx_Login.Text);
            act.setPassword(txtBx_Password.Text);

            bool ret = true;
            if (txtBx_Login.Text == "")
            {
                lbl_Login.ForeColor = emptyFieldColor;
                ret = false;
            }

            if (txtBx_Password.Text == "")
            {
                lbl_Password.ForeColor = emptyFieldColor;
                ret = false;
            }

            if (!ret)
            {
                MessageBox.Show(this, "Veuillez remplir tous les champs", "Message d'erreur", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                return;
            }

            ret = true;

            if (!act.HasValidLogin())
            {
                lbl_Login.ForeColor=invalidFieldColor;
                ret = false;
            }

            if (!act.HasValidPassword())
            {
                lbl_Password.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!ret)
            {
                MessageBox.Show(this, "Le login ou bien le mot de passe est invalide", "Message d'erreur", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                return;
            }

            if (CorrectLogin())
            {
                this.Tag = true;
                //this.ShowInTaskbar = false;
                //this.Hide();
                //(new AdministratorApp()).ShowDialog();
                Close();
            }
            else
                MessageBox.Show(this, "Le login ou bien le mot de passe est erroné", "Message d'erreur", MessageBoxButtons.OK,
                                   MessageBoxIcon.Error);
        }
Exemplo n.º 2
0
        public bool Check_Expert(Actor expert)
        {
            bool ret = true;
            InitializeLabelColors();

            if (!expert.HasValidFirstName())
            {
                lbl_FirstName.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!expert.HasValidLastName())
            {
                lbl_LastName.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!expert.HasValidEmail())
            {
                lbl_Email.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!expert.HasValidPhoneNumber())
            {
                lbl_Phone.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!expert.HasValidAddress())
            {
                lbl_Address.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!expert.HasValidSpecialty())
            {
                lbl_Specialty.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!expert.HasValidLogin())
            {
                lbl_Login.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!expert.HasValidPassword())
            {
                lbl_Password.ForeColor = invalidFieldColor;
                ret = false;
            }
            return ret;
        }
Exemplo n.º 3
0
        public frm_ModifyActor(string strActor,Actor actor)
        {
            InitializeComponent();
            lbl_Actor.Text = strActor;
            _Actor = actor;
            #region Load the form text fields to Fields list.
            Fields.Add(txtBx_LastName);
            Fields.Add(txtBx_FirstName);
            Fields.Add(txtBx_Email);
            Fields.Add(txtBx_Phone);
            Fields.Add(txtBx_Address);
            Fields.Add(txtBx_Role);
            Fields.Add(txtBx_Specialty);
            Fields.Add(txtBx_Login);
            Fields.Add(txtBx_Password);
            Fields.Add(txtBx_ConfirmPassword);
            #endregion

            #region Load the form labels to FieldLabels list.
            FieldLabels.Add(lbl_LastName);
            FieldLabels.Add(lbl_FirstName);
            FieldLabels.Add(lbl_Email);
            FieldLabels.Add(lbl_Phone);
            FieldLabels.Add(lbl_Address);
            FieldLabels.Add(lbl_Role);
            FieldLabels.Add(lbl_Specialty);
            FieldLabels.Add(lbl_Login);
            FieldLabels.Add(lbl_Password);
            FieldLabels.Add(lbl_ConfirmPassword);
            #endregion

            #region Fill the form's text fields
            txtBx_FirstName.Text=_Actor.getFirstName();
            txtBx_LastName.Text = _Actor.getLastName();
            txtBx_Email.Text = _Actor.getEmail();
            txtBx_Phone.Text = _Actor.getPhoneNumber();
            txtBx_Address.Text = _Actor.getAddress();
            txtBx_Role.Text = _Actor.getRole();
            txtBx_Specialty.Text = _Actor.getSpecialty();
            txtBx_Login.Text = _Actor.getLogin();
            txtBx_Password.Text = _Actor.getPassword();
            txtBx_ConfirmPassword.Text = _Actor.getPassword();

            #endregion
        }
Exemplo n.º 4
0
        /// <summary>
        /// Checks for invalid firlds in the form.
        /// </summary>
        /// <param name="tech"></param>
        /// <returns></returns>
        private bool Check_Technician(Actor tech)
        {
            bool ret = true;
            InitializeLabelColors();

            if (!tech.HasValidFirstName())
            {
                lbl_FirstName.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!tech.HasValidLastName())
            {
                lbl_LastName.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!tech.HasValidEmail())
            {
                lbl_Email.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!tech.HasValidPhoneNumber())
            {
                lbl_Phone.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!tech.HasValidAddress())
            {
                lbl_Address.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!tech.HasValidSpecialty())
            {
                lbl_Specialty.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!tech.HasValidLogin())
            {
                lbl_Login.ForeColor = invalidFieldColor;
                ret = false;
            }
            if (!tech.HasValidPassword())
            {
                lbl_Password.ForeColor = invalidFieldColor;
                ret = false;
            }
            return ret;
        }