Esempio n. 1
0
        public UpdateFamily(int idFamily, int idCurrentUser, int _IdSynchro, Stock_admin _FStockAdmin)
        {
            InitializeComponent();

            ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
            ServiceSynchro.User[]   Allusers        = ssc.GetUsers(false);
            ServiceSynchro.Family[] Allfamilies     = ssc.GetFamilies(false);
            foreach (ServiceSynchro.Family family in Allfamilies)
            {
                if (family.Id == idFamily)
                {
                    _f = family;
                }
            }

            foreach (ServiceSynchro.User user in Allusers)
            {
                if (user.Id == idCurrentUser)
                {
                    CurrentUser = user;
                }
            }


            IdSynchro = _IdSynchro;

            FStockAdmin = _FStockAdmin;

            lbl_titre.Text += " " + _f.Name;
        }
Esempio n. 2
0
        ServiceSynchro.Article[] Articles = new ServiceSynchro.Article[] { }; //tous les articles (actifs)
        public Stock_user(int idUser)
        {
            //chargement du CurrentUser
            ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
            ServiceSynchro.User[] Allusers          = ssc.GetUsers(true);
            foreach (ServiceSynchro.User user in Allusers)
            {
                if (user.Id == idUser)
                {
                    CurrentUser = user;
                }
            }

            //téléchargement des données de la bdd au lancement
            Families = Synchro.DownloadFamilies();
            Articles = Synchro.DownloadArticles();

            InitializeComponent();

            //chargement des familles dans la combo
            foreach (ServiceSynchro.Family family in Families)
            {
                input_family.Items.Add(family);
            }
            input_family.DisplayMember = "name";
        }
Esempio n. 3
0
 private void btn_AddUser_Click(object sender, EventArgs e)
 {
     if (txtBox_Password_1.Text == txtBox_Password_2.Text)
     {
         //txtBox_Name , txtBox_Password , cb_admin , btn_Add
         string uLogin = txtBox_Name.Text;
         string uPassw = txtBox_Password_1.Text;
         bool   uAdmin = cb_admin.Checked;
         ServiceSynchro.User newUser = new ServiceSynchro.User();
         newUser.Login    = uLogin;
         newUser.Password = md5.CalculateMD5Hash(uPassw).ToLower();
         newUser.Admin    = uAdmin;
         newUser.State    = true;
         newUser.Id       = -1;
         ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
         if (ssc.SetUser(-1, newUser, IdSynchro) == 1)
         {
             MessageBox.Show("L'utilisateur a bien été ajouté");
             FUsersManagement.dtgv_usersList.DataSource = ssc.GetUsers(true);
         }
         else
         {
             MessageBox.Show("Une erreur est survenue");
         }
         this.Close();
     }
     else
     {
         MessageBox.Show("Les deux mdp ne correspondent pas");
     }
     txtBox_Password_1.Text = txtBox_Password_2.Text = txtBox_Name.Text = string.Empty;
     cb_admin.Checked       = false;
 }
Esempio n. 4
0
 public MenuAdmin(int IdCurrentUser, int _IdSynchro)
 {
     InitializeComponent();
     ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
     ServiceSynchro.User[] allUser           = ssc.GetUsers(false);
     foreach (ServiceSynchro.User user in allUser)
     {
         if (user.Id == IdCurrentUser)
         {
             CurrentUser = user;
         }
     }
     IdSynchro = _IdSynchro;
 }
Esempio n. 5
0
 public AddFamily(int idCurrentUser, int _IdSynchro, Stock_admin _FStockAdmin)
 {
     InitializeComponent();
     ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
     ServiceSynchro.User[] Allusers          = ssc.GetUsers(false);
     foreach (ServiceSynchro.User user in Allusers)
     {
         if (user.Id == idCurrentUser)
         {
             CurrentUser = user;
         }
     }
     IdSynchro   = _IdSynchro;
     FStockAdmin = _FStockAdmin;
 }
 public UsersManagement(int IdCurrentUser, int _IdSynchro)
 {
     InitializeComponent();
     ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
     dtgv_usersList.DataSource = ssc.GetUsers(true);
     ServiceSynchro.User[] allUser = ssc.GetUsers(false);
     foreach (ServiceSynchro.User user in allUser)
     {
         if (user.Id == IdCurrentUser)
         {
             CurrentUser = user;
         }
     }
     IdSynchro = _IdSynchro;
 }
Esempio n. 7
0
        public UpdateArticle(int idArticle, int idCurrentUser, int _IdSynchro, int idFamily, Stock_admin _fStockAdmin)
        {
            InitializeComponent();
            ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
            ServiceSynchro.User[]    Allusers       = ssc.GetUsers(false);
            ServiceSynchro.Article[] Allarticles    = ssc.GetArticles(idFamily, false);
            foreach (ServiceSynchro.Article article in Allarticles)
            {
                if (article.Id == idArticle)
                {
                    _a = article;
                }
            }
            foreach (ServiceSynchro.User user in Allusers)
            {
                if (user.Id == idCurrentUser)
                {
                    CurrentUser = user;
                }
            }
            IdSynchro          = _IdSynchro;
            lbl_titre.Text    += " " + _a.Name;
            txtb_name.Text     = _a.Name;
            txtb_location.Text = _a.LocationCode;
            nud_quantity.Value = _a.Quantity;

            StockAdmin = _fStockAdmin;


            ServiceSynchro.Family[] Families = ssc.GetFamilies(true);

            //chargement des familles dans la combo
            int n             = 0;
            int indexToSelect = 0;

            foreach (ServiceSynchro.Family family in Families)
            {
                comboBox_family.Items.Add(family);
                if (family.Id == idFamily)
                {
                    indexToSelect = n;
                }
                n = n + 1;
            }
            comboBox_family.DisplayMember = "name";

            comboBox_family.SelectedItem = comboBox_family.Items[indexToSelect];
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="idUser"></param>
        /// <param name="idCurrentUser"></param>
        /// <param name="_IdSynchro"></param>
        /// <param name="_FUsersManagement">Récupère l'instance de la fenêtre 'gestion utilisateur' pour mettre à jour la dataGridView</param>
        public UpdateUser(int idUser, int idCurrentUser, int _IdSynchro, Gestinv.UsersManagement _FUsersManagement)
        {
            InitializeComponent();
            ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
            ServiceSynchro.User[] Allusers          = ssc.GetUsers(false);
            foreach (ServiceSynchro.User user in Allusers)
            {
                if (user.Id == idUser)
                {
                    _u = user;
                }
                if (user.Id == idCurrentUser)
                {
                    CurrentUser = user;
                }
            }
            IdSynchro        = _IdSynchro;
            FUsersManagement = _FUsersManagement;

            lbl_titre.Text += " " + _u.Login;
        }
Esempio n. 9
0
        public Stock_admin(int idCurrentUser, int _IdSynchro)
        {
            InitializeComponent();
            ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
            ServiceSynchro.User[] allUser           = ssc.GetUsers(false);
            foreach (ServiceSynchro.User user in allUser)
            {
                if (user.Id == idCurrentUser)
                {
                    CurrentUser = user;
                }
            }
            IdSynchro = _IdSynchro;
            ServiceSynchro.Family[] Families = ssc.GetFamilies(true);

            //chargement des familles dans la combo
            foreach (ServiceSynchro.Family family in Families)
            {
                combobox_families.Items.Add(family);
            }
            combobox_families.DisplayMember = "name";
        }
Esempio n. 10
0
        public AddArticle(int idCurrentUser, int _IdSynchro, Stock_admin _FStockAdmin)
        {
            InitializeComponent();
            ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
            ServiceSynchro.User[]   Allusers        = ssc.GetUsers(false);
            ServiceSynchro.Family[] Families        = ssc.GetFamilies(true);
            foreach (ServiceSynchro.User user in Allusers)
            {
                if (user.Id == idCurrentUser)
                {
                    CurrentUser = user;
                }
            }
            IdSynchro   = _IdSynchro;
            FStockAdmin = _FStockAdmin;

            //chargement des familles dans la combo
            foreach (ServiceSynchro.Family family in Families)
            {
                comboBox_family_name.Items.Add(family);
            }
            comboBox_family_name.DisplayMember = "name";
        }