Exemplo n.º 1
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];
        }
Exemplo n.º 2
0
        private void input_quantity_TextChanged(object sender, EventArgs e)
        {
            if (input_article.SelectedItem == null)
            {
                input_quantity.Text = "";
                return;
            }
            int quantity = int.Parse("0" + input_quantity.Text.Replace(" ", string.Empty));

            ServiceSynchro.Article articleencours = (ServiceSynchro.Article)input_article.SelectedItem;

            //met à jour la quantité dans la bdd embarquée (variable)
            foreach (ServiceSynchro.Article article in Articles)
            {
                if (article.Id == articleencours.Id)
                {
                    article.Quantity = quantity;
                }
            }
        }
Exemplo n.º 3
0
 private void input_article_SelectedIndexChanged(object sender, EventArgs e)
 {
     ServiceSynchro.Article article = (ServiceSynchro.Article)input_article.SelectedItem;
     //chargement de la quantité actuelle dans le champs de saisie
     input_quantity.Text = article.Quantity.ToString();
 }