/*
  * Initialisation de la Form frmFactoryManage
  */
 public frmFactoryManage(frmVillage frmVillage, UserBO user, FactoryBO factory)
 {
     InitializeComponent();
     this.frmVillage = frmVillage;
     this.user = user;
     this.factory = factory;
 }
 /*
  * Initialisation de la Form FactoryAdd
  */
 public frmFactoryAdd(frmVillage frmVillage, int id_user, int id_village, int position)
 {
     InitializeComponent();
     this.frmVillage = frmVillage;
     this.id_user = id_user;
     this.id_village = id_village;
     this.position = position;
 }
Beispiel #3
0
        /*
         * Initialisation de la Form frmFactory avec Factory en paramètre
         */
        public frmFactory(frmVillage frmVillage, UserBO user, FactoryBO factory)
        {
            InitializeComponent();
            this.frmVillage = frmVillage;
            this.user = user;
            this.factory = factory;

            btnAdd.Visible = false;

            pictureBox.Image = Resource.Factory;
            pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
        }
        /*
         * Permet au User de se Connecter
         */
        private void btnConnexion_Click(object sender, EventArgs e)
        {
            try
            {
                /*
                 * Vérification si les champs sont remplis
                 * Si oui:                 -> ok: Affiche "Welcome back #username !"
                 *                         -> erreur: Affiche "Errur: #erreur"
                 * Sinon: Affiche "Veuillez remplir les champs."
                 */
                if (!string.IsNullOrWhiteSpace(tbxUsername.Text) && !string.IsNullOrWhiteSpace(tbxPassword.Text))
                {
                    using (UserIFACClient proxy = new UserIFACClient())
                    {
                        user = new UserBO();
                        user.username = tbxUsername.Text;
                        user.password = tbxPassword.Text;
                        String message = proxy.connexion(user);

                        if (message == "Ok")
                        {
                            UserBO newUser = new UserBO();
                            newUser = proxy.searchUser(user);

                            frmVillage objfrmVillage = new frmVillage(newUser, objfrmWelcome);
                            objfrmVillage.MdiParent = objfrmWelcome;
                            objfrmVillage.Show();

                            this.Dispose();
                            MessageBox.Show("Welcome back " + newUser.username + " !");

                        }
                        else
                        {
                            tbxUsername.Clear();
                            tbxPassword.Clear();
                            MessageBox.Show("Erreur: " + message);
                        }
                    }
                }
                else
                {
                    tbxUsername.Clear();
                    tbxPassword.Clear();
                    MessageBox.Show("Veuillez remplir les champs.");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #5
0
        /*
         * Initialisation de la Form frmFactory avec position en paramètre
         */
        public frmFactory(frmVillage frmVillage, UserBO user, int position)
        {
            InitializeComponent();
            this.frmVillage = frmVillage;
            this.user = user;
            this.position = position;

            btnManage.Visible = false;
            btnDelete.Visible = false;
            lblFactory.Visible = false;

            pictureBox.Image = Resource.ForSale;
            pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
        }