Beispiel #1
0
        public static void InitCMB_StaticValue(ComboBox cmb, MES_StaticValue_Type StaticValueType,bool hasEmpty)
        {
            #region UsedBy
            cmb.Items.Clear();
            cmb.DisplayMember = "DisplayField";
            cmb.ValueMember = "ValueField";
            string res = string.Empty;

            if (hasEmpty)
            {
                cmb.Items.Add(new ValueInfo()
                {
                    DisplayField = "",
                    ValueField = ""
                });
            }

            foreach (tsysstaticvalue item in baseForm.GetStaticValue(StaticValueType))
            {
                res = item.svresourceid == null ? string.Empty : item.svresourceid;
                cmb.Items.Add(new ValueInfo()
                {
                    DisplayField = res == string.Empty ? item.svtext : UtilCulture.GetString(res),
                    ValueField = item.svvalue
                });
            }
            #endregion
        }
Beispiel #2
0
        public static ValueListItem[] GetValueList_StaticValue(MES_StaticValue_Type staticValueType)
        {
            List<ValueListItem> lstStaticValue = new List<ValueListItem>();

            string res = string.Empty;

            foreach (tsysstaticvalue item in baseForm.GetStaticValue(staticValueType))
            {
                res = item.svresourceid == null ? string.Empty : item.svresourceid;
                ValueListItem list = new ValueListItem()
                {
                    DisplayText = res == string.Empty ? item.svtext : UtilCulture.GetString(res),
                    DataValue = item.svvalue
                };
                lstStaticValue.Add(list);
            }

            return lstStaticValue.ToArray<ValueListItem>();
        }