示例#1
0
        public static void InitCMB_WorkGroup(ComboBox cmb)
        {
            cmb.Items.Clear();
            cmb.DisplayMember = "DisplayField";
            cmb.ValueMember = "ValueField";

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

            try
            {
                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>();
                List<tmdlworkgroup> lstShift = client.GetWorkGroupList((new BaseForm()).CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>()).ToList<tmdlworkgroup>();

                var q = from p in lstShift orderby p.workgroupdesc ascending select p;
                foreach (tmdlworkgroup workgroup in q)
                {
                    cmb.Items.Add(new ValueInfo()
                    {
                        DisplayField = workgroup.workgroupdesc,
                        ValueField = workgroup.workgroup
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                baseForm.CloseWCF(client);
            }
        }