Exemple #1
0
        public HComboBoxSourceList(UserList lista)
        {
            AddEmptyItem();

            foreach (UserInfo item in lista)
            {
                ComboBoxSource combo = new ComboBoxSource();

                combo.Texto    = item.Name;
                combo.Oid      = item.Oid;
                combo.OidAjeno = 0;

                this.Add(combo);
            }
        }
Exemple #2
0
        public ComboBoxList(ResourceManager r_manager, bool empty_value, bool special_values, bool all_value, T[] list)
        {
            ComboBoxSource combo = null;

            string[] values = Enum.GetNames(typeof(T));

            if (empty_value)
            {
                combo       = new ComboBoxSource();
                combo.Oid   = -1;
                combo.Texto = r_manager.GetString("EMPTY_VALUE");
                this.Add(combo);
            }

            if (values != null)
            {
                if (list == null)
                {
                    foreach (string label in values)
                    {
                        combo = new ComboBoxSource();

                        combo.Oid = Convert.ToInt64(Enum.Parse(typeof(T), label));

                        if ((!special_values) && (combo.Oid <= -2))
                        {
                            continue;
                        }
                        if ((!all_value) && (combo.Oid == 0))
                        {
                            continue;
                        }

                        if (combo.Oid != -1)
                        {
                            combo.Texto = r_manager.GetString(typeof(T).Name + "_" + label);
                            if (combo.Texto == null)
                            {
                                throw new iQImplementationException(typeof(T).ToString() + "." + label + " no tiene etiqueta de recurso asociada", string.Empty);
                            }

                            this.Add(combo);
                        }
                    }
                }
                else
                {
                    foreach (string label in values)
                    {
                        foreach (T item in list)
                        {
                            if (label != Enum.GetName(typeof(T), item))
                            {
                                continue;
                            }

                            combo     = new ComboBoxSource();
                            combo.Oid = Convert.ToInt64(Enum.Parse(typeof(T), label));

                            combo.Texto = r_manager.GetString(typeof(T).Name + "_" + label);
                            if (combo.Texto == null)
                            {
                                throw new iQImplementationException(typeof(T).ToString() + "." + label + " no tiene etiqueta de recurso asociada", string.Empty);
                            }

                            this.Add(combo);
                        }
                    }
                }
            }
        }