/// <summary>
        /// 自定义控件,必须有SetValueChanged ,基类才会自动调用 ,给自定义控件赋值
        /// 控件名MMDefPK ,和实体里的MMDefPK属性名一致
        /// 加载时会将实体的MMDefPK属性(int类型),在参数e中传递过来
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void DefPK_SetValueChanged(object sender, SSITControls.Common.ValueEventArgs e)
        {
            var checkItems = DefinitionCheckItemCombine.GetCheckItemsby((int)e.Value, MMTypEnum.QM);// .GetFirstItem("defpk = " + (int)e.Value);

            LoadCheckItems(checkItems);
        }
Example #2
0
        public void LoadInfo()
        {
            rpvCheckCategory.Pages.Clear();
            Dictionary <string, EncodeCollection <CheckItem> > dic = new Dictionary <string, EncodeCollection <CheckItem> >();
            EncodeCollection <CheckItem> ecCheckItems = null;

            if (_sampleOrder.GetPlanCheckItemCount <= 0)
            {
                ecCheckItems = DefinitionCheckItemCombine.GetCheckItemsby(_sampleOrder.DefPK, MMTypEnum.QM);
            }
            else
            {
                EncodeCollection <CheckItem> ec = new EncodeCollection <CheckItem>();
                foreach (short id in _sampleOrder.PlanCheckItems)
                {
                    CheckItem checkitem = CheckItem.Instance.Itemof(id);
                    if (checkitem != null)
                    {
                        ec.Add(checkitem);
                    }
                }
                ecCheckItems = ec;
            }
            if (ecCheckItems != null)
            {
                foreach (CheckItem item in ecCheckItems)
                {
                    string CheckCategoryName = item.GetCheckCategory();
                    if (!string.IsNullOrEmpty(CheckCategoryName))
                    {
                        if (!dic.ContainsKey(CheckCategoryName))
                        {
                            dic.Add(CheckCategoryName, new EncodeCollection <CheckItem>());
                        }
                        dic[CheckCategoryName].Add(item);
                    }
                }
            }
            EncodeCollection <CheckData> datas = CheckData.LoadDatasbySampleID(_sampleOrder.SampleID);
            int maxIndex = 0;

            if (datas.Count > 0)
            {
                foreach (var item in datas)
                {
                    maxIndex = Math.Max(item.SampleIndex, maxIndex);
                }
            }
            if (maxIndex >= _sampleOrder.CheckQuantity)
            {
                _sampleOrder.CheckQuantity = maxIndex;
            }
            SetOrderState();
            foreach (string key in dic.Keys)
            {
                Telerik.WinControls.UI.RadPageViewPage page = new Telerik.WinControls.UI.RadPageViewPage(key);
                InputGridBase grid = new InputGridBase {
                    Dock = DockStyle.Fill
                };
                page.Controls.Add(grid);
                if (_sampleOrder != null)
                {
                    grid.SampleCount = _sampleOrder.CheckQuantity;
                }
                page.Tag = grid;
                rpvCheckCategory.Pages.Add(page);
                grid.Order  = _sampleOrder;
                grid.Fields = CheckItemsToInputFields(dic[key]);
                grid.Init();
                grid.LoadDatas(datas);
                //grid.Columns.AutoSize(true);
            }

            if (datas.Count > 0)
            {
                DataStat();
            }
        }