예제 #1
0
        public void BindChkListEqpGroup(CheckedListBoxItemCollection control, string targetShopID)
        {
            control.Clear();

            SortedSet <string> list = new SortedSet <string>();

            var eqpDt = this.EqpMgr.Table;

            string eqpGrpColName = EqpGanttChartData.Eqp.Schema.EQP_GROUP_ID;

            DataRow[] filteredRows = eqpDt.Select("", eqpGrpColName);

            foreach (DataRow srow in eqpDt.Rows)
            {
                string eqpGroup = srow.GetString(eqpGrpColName);
                if (string.IsNullOrEmpty(eqpGroup))
                {
                    continue;
                }

                string shopID = srow.GetString(EqpGanttChartData.Eqp.Schema.SHOP_ID);
                if (targetShopID != Consts.ALL)
                {
                    bool isAdd = false;

                    //ARRRAY의 경우 CF PHOTO 설비는 포함 처리.
                    if (StringHelper.Equals(targetShopID, "ARRAY"))
                    {
                        string eqpGroupUpper = StringHelper.ToSafeUpper(eqpGroup);
                        if (eqpGroupUpper.Contains("PHL") || eqpGroupUpper.Contains("PHOTO"))
                        {
                            isAdd = true;
                        }
                    }

                    if (isAdd == false)
                    {
                        isAdd = shopID == targetShopID;
                    }

                    if (isAdd == false)
                    {
                        continue;
                    }
                }

                if (list.Contains(eqpGroup) == false)
                {
                    list.Add(eqpGroup);
                }
            }

            foreach (var eqpGroup in list)
            {
                control.Add(eqpGroup);
            }
        }
예제 #2
0
        public void Setup(ColumnInfo colInfo)
        {
            bool   check;
            string s;

            InSetup = true;
            ColInfo = colInfo;             // save ref to colInfo
            QueryColumn qc = colInfo.Qc;

            ParsedSingleCriteria psc = MqlUtil.ParseSingleCriteria(ColInfo.Qc.SecondaryCriteria);             // parse criteria

            Dictionary <string, object> listDict = new Dictionary <string, object>();

            if (psc != null && psc.OpEnum != CompareOp.In)
            {
                psc = null;                 // switching from other criteria type
            }
            if (psc != null && Lex.Contains(qc.SecondaryCriteria, "(All)"))
            {
                psc = null;              // rebuild if "all" items
            }
            if (psc != null)             // list of previously selected items
            {
                foreach (string vs in psc.ValueList)
                {
                    if (qc.MetaColumn.DataType == MetaColumnType.CompoundId)
                    {
                        s = CompoundId.Format(vs);
                    }
                    else if (qc.MetaColumn.DataType == MetaColumnType.Date)
                    {
                        s = DateTimeMx.Format(vs);
                    }
                    else
                    {
                        s = vs;
                    }
                    listDict[s.ToUpper()] = null;
                }
            }

            else             // setup default criteria
            {
                qc.SecondaryCriteria        = qc.MetaColumn.Name + " in ('(All)')";
                qc.SecondaryCriteriaDisplay = qc.ActiveLabel + " in list (All)";
            }

            ColumnStatistics             stats = colInfo.Rfld.GetStats();
            CheckedListBoxItemCollection items = ItemList.Items;

            items.Clear();
            check = (psc == null || listDict.ContainsKey("(All)".ToUpper()) || listDict.ContainsKey("All".ToUpper()));
            AddItem("(All)", check);

            if (stats.NullsExist || Math.Abs(1) == 1)
            {             // always include blank/nonblank since there may be null rows because other tables have more rows for key
                check     = (psc == null || listDict.ContainsKey("(Blanks)".ToUpper()) || listDict.ContainsKey("Blanks".ToUpper()));
                BlanksPos = items.Count;
                AddItem("(Blanks)", check);

                check        = (psc == null || listDict.ContainsKey("(Non blanks)".ToUpper()) || listDict.ContainsKey("Nonblanks".ToUpper()));
                NonBlanksPos = items.Count;
                AddItem("(Non blanks)", check);
            }

            else
            {
                BlanksPos = NonBlanksPos = -1;
            }

            foreach (MobiusDataType mdt in stats.DistinctValueList)
            {
                s     = mdt.FormattedText;
                check = (psc == null || listDict.ContainsKey(s.ToUpper()));
                AddItem(s, check);
                if (items.Count >= 100)
                {
                    AddItem("...", check);
                    break;
                }
            }

            int itemHeight = 18;                                                   // height of single item (really 17 but add a bit extra)
            int fullHeight = ItemList.Top + 6 + ItemList.Items.Count * itemHeight; // full height of control

            if (fullHeight < this.Height)
            {
                this.Height = fullHeight;
            }

            InSetup = false;
            return;
        }