Esempio n. 1
0
        public GroupManagerEditForm(RPN_API_Web web, string member_username)
        {
            InitializeComponent();
            Icon = Resources.RPN_Sharp;

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

            groupManagerEditMemberFormSkin.FlatColor = Program.UIColor;

            permFlatComboBox.HoverColor = Program.UIColor;

            this.web             = web;
            this.member_username = member_username;


            // User Load
            if (member_username != null)
            {
                usernameFlatTextBox.ReadOnly = true;
                applyFlatButton.Enabled      = false;

                try
                {
                    RPN_API_Json.InternalData internalData = web.GetUser(member_username);

                    if (internalData.Username.Equals(member_username))
                    {
                        usernameFlatTextBox.Text           = member_username;
                        renseignementIdNumericUpDown.Value = int.Parse(internalData.RenseignementID.ToString());
                        if (internalData.Permission.Equals("max"))
                        {
                            permFlatComboBox.Text = "Tous les Droits";
                        }
                        else if (internalData.Permission.Equals("med"))
                        {
                            permFlatComboBox.Text = "Droits Étendus";
                        }
                        else if (internalData.Permission.Equals("min"))
                        {
                            permFlatComboBox.Text = "Droits Limités";
                        }
                        passFlatTextBox.Text = "Bonjour :3 !";
                    }

                    applyFlatButton.Enabled = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Une erreur est survenue lors de la récupérations des informations des membres du groupe !\n" +
                                    "Erreur : " + ex.Message, "Erreur");
                }
            }
        }
        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;
            }
        }