public StorageDataEditForm(RPN_API_Web web, int storage_id, int storage_data_id)
        {
            InitializeComponent();
            Icon = Resources.RPN_Sharp;

            if (Program.IsFullscreen)
            {
                WindowState = FormWindowState.Maximized;
            }

            storageDataFormSkin.FlatColor = Program.UIColor;

            ressourceTypeFlatComboBox.HoverColor = Program.UIColor;
            belongtoFlatComboBox.HoverColor      = Program.UIColor;

            this.web             = web;
            this.storage_id      = storage_id;
            this.storage_data_id = storage_data_id;


            foreach (RPN_API_Json.RessourceTypeData ressourceTypeData in web.GetRessourceType())
            {
                ressourceTypeFlatComboBox.Items.Add(ressourceTypeData.Name);
            }

            foreach (RPN_API_Json.InternalData internalData in web.GetAllUsers())
            {
                belongtoFlatComboBox.Items.Add(internalData.Username);
            }

            if (storage_data_id != -1)
            {
                RPN_API_Json.StorageData       currentStorageData   = web.GetStorageDataFromId(storage_data_id);
                RPN_API_Json.RessourceTypeData currentRessourceType = web.GetRessourceTypeFromId(currentStorageData.RessourceType);
                RPN_API_Json.InternalData      currentBelongTo      = web.GetUser(currentStorageData.BelongTo);

                foreach (RPN_API_Json.RessourceTypeData ressourceTypeData in web.GetRessourceType())
                {
                    if (currentRessourceType.Name.Equals(ressourceTypeData.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        ressourceTypeFlatComboBox.Text = ressourceTypeData.Name;
                    }
                }

                foreach (RPN_API_Json.InternalData internalData in web.GetAllUsers())
                {
                    if (currentBelongTo.Username.Equals(internalData.Username, StringComparison.InvariantCultureIgnoreCase))
                    {
                        belongtoFlatComboBox.Text = internalData.Username;
                    }
                }

                quantityNumericUpDown.Value = currentStorageData.Quantity;
            }
        }
Пример #2
0
        public StorageEditForm(RPN_API_Web web, int storage_id)
        {
            InitializeComponent();
            Icon = Resources.RPN_Sharp;

            if (Program.IsFullscreen)
            {
                WindowState = FormWindowState.Maximized;
            }

            storageFormSkin.FlatColor = Program.UIColor;

            storageTypeFlatComboBox.HoverColor = Program.UIColor;
            ownerFlatComboBox.HoverColor       = Program.UIColor;

            this.web        = web;
            this.storage_id = storage_id;

            try
            {
                foreach (RPN_API_Json.InternalData data in web.GetAllUsers())
                {
                    ownerFlatComboBox.Items.Add(data.Username);
                }
            }
            catch
            {
                MessageBox.Show("Impossible de charger les membres du groupe !");
            }

            try
            {
                foreach (RPN_API_Json.StorageTypeData data in web.GetStorageType())
                {
                    storageTypeFlatComboBox.Items.Add(data.Name);
                }
            }
            catch
            {
                MessageBox.Show("Impossible de charger les types de stockages !");
            }

            if (storage_id != -1)
            {
                RPN_API_Json.Storage storage = web.GetStorageFromId(storage_id);
                nameFlatTextBox.Text         = storage.Name;
                ownerFlatComboBox.Text       = storage.Owner;
                storageTypeFlatComboBox.Text = web.GetStorageTypeFromId(storage.StorageTypeId).Name;
                locationFlatTextBox.Text     = storage.Location;
            }
        }
Пример #3
0
 private void LoadGroup()
 {
     groupListBox.Items.Clear();
     try
     {
         foreach (RPN_API_Json.InternalData internalData in web.GetAllUsers())
         {
             groupListBox.Items.Add(internalData.Username);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Une erreur est survenue lors de la récupérations des membres de groupe !\n" +
                         "Erreur : " + ex.Message, "Erreur");
         Close();
     }
 }
Пример #4
0
        private void ReloadData()
        {
            groupDataGridView.Rows.Clear();
            refreshFlatButton.Enabled = false;

            try
            {
                List <RPN_API_Json.InternalData> users = web.GetAllUsers();

                foreach (RPN_API_Json.InternalData internalData in users)
                {
                    rowNbFlatLabel.Text = users.Count + " Membre(s)";
                    groupDataGridView.Rows.Add(internalData.Username, internalData.RenseignementID, internalData.Permission);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Une erreur est survenue lors de la récupérations des membres de groupe !\n" +
                                "Erreur : " + ex.Message, "Erreur");
            }

            refreshFlatButton.Enabled = true;
        }