Beispiel #1
0
        public static void InitCMB_ReasonCategory_All(ComboBox cmd)
        {
            cmd.Items.Clear();
            cmd.DisplayMember = "DisplayField";
            cmd.ValueMember = "ValueField";

            wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient();

            try
            {
                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>();
                List<tmdlreasoncategory> lstReasonCategory = client.GetReasonCategoryList((new BaseForm()).CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>()).ToList<tmdlreasoncategory>();
                var q = from p in lstReasonCategory orderby p.reasoncategory ascending select p;
                for (int i = 0; i < q.Count(); i++)
                {
                    cmd.Items.Add(new ValueInfo()
                    {
                        DisplayField = q.ElementAt(i).reasoncategory,
                        ValueField = q.ElementAt(i).reasoncategory
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                baseForm.CloseWCF(client);
            }
        }