/// <summary>
 /// Set the checkedness of the i'th item
 /// </summary>
 /// <param name="i"></param>
 /// <param name="checkState"></param>
 public void SetItemState(int i, CheckState checkState)
 {
     if (i >= 0 && i < Items.Count)
     {
         CheckedListBoxControl.SetItemCheckState(i, checkState);
     }
 }
Exemple #2
0
        private void clbc_workflow_SelectedIndexChanged(object sender, EventArgs e)
        {
            //设置点击一下即打钩
            CheckedListBoxControl clb = sender as CheckedListBoxControl;
            int si = clb.SelectedIndex;

            if (si == -1)
            {
                si = 0;
            }
            clb.SetItemCheckState(si, CheckState.Checked);
        }
 /// <summary>
 /// Add an item with the given state to the control
 /// </summary>
 /// <param name="item"></param>
 /// <param name="state"></param>
 public void AddItem(object item, CheckState state)
 {
     Items.Add(item);
     CheckedListBoxControl.SetItemCheckState(Items.Count - 1, state);
 }
Exemple #4
0
        public PopupContainerEdit CreateMultipleLookUpEdit(IObject obj, string lookupName, object currentValue)
        {
            var control = new PopupContainerEdit();

            control.Properties.PopupControl = new PopupContainerControl();
            var checkedListBoxControl = new CheckedListBoxControl {
                Dock = DockStyle.Fill, CheckOnClick = true
            };

            checkedListBoxControl.ItemCheck += (sender, args) =>
            {
                if (m_ListUpdated)
                {
                    return;
                }
                m_ListUpdated = true;
                try
                {
                    var items = checkedListBoxControl.DataSource as IList;
                    if (items != null && items.Count > 0)
                    {
                        if (args.Index == 0 && (0L.Equals(((IObject)items[args.Index]).Key)))
                        {
                            if (args.State == CheckState.Checked)
                            {
                                checkedListBoxControl.CheckAll();
                            }
                            else if (args.State == CheckState.Unchecked)
                            {
                                checkedListBoxControl.UnCheckAll();
                            }
                        }
                        else if (0L.Equals(((IObject)items[0]).Key))
                        {
                            checkedListBoxControl.SetItemCheckState(0, CheckState.Indeterminate);
                        }
                    }
                }
                finally
                {
                    m_ListUpdated = false;
                }
            };
            control.Properties.PopupControl.Controls.Add(checkedListBoxControl);
            control.Closed += (sender, args) => SearchPanelHelper.DisplayMultipleText(sender as PopupContainerEdit);
            bool bManualChange = false;
            bool bPopup        = false;

            control.QueryPopUp += (sender, args) =>
            {
                if (!bManualChange)
                {
                    bPopup = true;
                    control.Properties.PopupControl.Width = control.Width - 4;
                    bPopup = false;
                }
            };
            control.Properties.PopupControl.SizeChanged += (sender, args) =>
            {
                if (!bPopup)
                {
                    bManualChange = true;
                }
            };

            //if (items != null)
            //{
            //    list.DataSource = items.items;
            //    list.DisplayMember = items.dataTextField ?? "name";
            //    list.ValueMember = items.dataValueField;
            //}
            PropertyInfo pi = obj.GetType().GetProperty(lookupName);

            if (pi != null)
            {
                object ds      = pi.GetValue(obj, null);
                var    keyName = "idfsBaseReference";
                var    list1   = ds as IList;
                if (list1 != null && list1.Count == 0)
                {
                    control.Enabled = false;
                }
                else
                {
                    keyName = ((ds as IList)[0] as IObject).KeyName;
                }

                checkedListBoxControl.DataSource    = ds;
                checkedListBoxControl.DisplayMember = "ToStringProp";
                checkedListBoxControl.ValueMember   = keyName;
            }


            SearchPanelHelper.DisplayMultipleText(control);
            AddClearButton(control, true);

            return(control);
        }
Exemple #5
0
        private void CreateTabPageLine(string CusID = "", string CategoryID = "", string StyleID = "")
        {
            //gcCapacity.DataSource = null;
            tabBranch.TabPages.Clear();

            if (CusID != "" && CategoryID != "")
            {
                StringBuilder sbSQL = new StringBuilder();
                sbSQL.Append("SELECT DISTINCT B.Branch, B.OIDBranch AS ID ");
                sbSQL.Append("FROM ProductionLine AS PL INNER JOIN ");
                sbSQL.Append("     Branch AS B ON PL.Branch = B.OIDBranch ");
                sbSQL.Append("WHERE (PL.OIDCUST = '" + CusID + "') AND(PL.OIDCATEGORY = '" + CategoryID + "') ");
                sbSQL.Append("ORDER BY B.OIDBranch ");
                DataTable dtBranch = new DBQuery(sbSQL).getDataTable();
                int       BCount   = new DBQuery(sbSQL).getCount();

                foreach (DataRow drRow in dtBranch.Rows)
                {
                    DevExpress.XtraTab.XtraTabPage tabPage = new DevExpress.XtraTab.XtraTabPage();
                    tabPage.Name = "B" + drRow["ID"].ToString();
                    tabPage.Text = drRow["Branch"].ToString();

                    CheckedListBoxControl clbLine = new CheckedListBoxControl();
                    clbLine.Name = "LN" + drRow["ID"].ToString();


                    tabPage.Controls.Add(clbLine);
                    clbLine.Dock = DockStyle.Fill;

                    StringBuilder sbLINE = new StringBuilder();
                    sbLINE.Append("SELECT LN.LINENAME AS LineName, LN.OIDLINE AS LineID, LN.Branch AS BranchID  ");
                    sbLINE.Append("FROM   ProductionLine AS PL INNER JOIN ");
                    sbLINE.Append("        LineNumber AS LN ON PL.OIDLine = LN.OIDLINE ");
                    sbLINE.Append("WHERE (PL.OIDCUST = '" + CusID + "') AND(PL.OIDCATEGORY = '" + CategoryID + "') AND(PL.Branch = '" + drRow["ID"].ToString() + "') ");
                    sbLINE.Append("ORDER By LN.LINENAME ");
                    DataTable dtLINE = new DBQuery(sbLINE).getDataTable();

                    clbLine.ValueMember   = "LineName";
                    clbLine.DisplayMember = "LineName";
                    clbLine.DataSource    = dtLINE;

                    StringBuilder sbCapacity = new StringBuilder();
                    sbCapacity.Append("SELECT DISTINCT LINEID AS LineName ");
                    sbCapacity.Append("FROM   ProductionCapacityLine ");
                    sbCapacity.Append("WHERE(OIDCAP IN ");
                    sbCapacity.Append("             (SELECT OIDPCAP ");
                    sbCapacity.Append("              FROM   ProductionCapacity ");
                    sbCapacity.Append("              WHERE (OIDCUST = '" + CusID + "') AND (OIDGCATEGORY = '" + CategoryID + "'))) AND (OIDBranch = '" + drRow["ID"].ToString() + "') ");
                    DataTable dtQC = new DBQuery(sbCapacity).getDataTable();
                    foreach (DataRow row in dtQC.Rows)
                    {
                        for (int i = 0; i < clbLine.ItemCount; i++)
                        {
                            if (row["LineName"].ToString() == clbLine.GetItemValue(i).ToString())
                            {
                                clbLine.SetItemCheckState(i, CheckState.Checked);
                                break;
                            }
                        }
                    }

                    tabBranch.TabPages.Add(tabPage);
                    tabBranch.ResumeLayout(false);
                    tabBranch.LayoutChanged();
                }

                sbSQL.Clear();
                sbSQL.Append("SELECT PC.OIDPCAP AS CapacityID, PC.OIDCUST AS CustomerID, CUS.ShortName AS CustomerName, PC.OIDGCATEGORY AS CategoryID, GC.CategoryName, PC.OIDSTYLE AS StyleID, PS.StyleName, PC.QTYPerHour, PC.QTYPerDay, ");
                sbSQL.Append("       PC.QTYPerOT, FORMAT(PC.STDTimeCUT, '###0.####') AS StandardTimeCutting, FORMAT(PC.STDTimePAD, '###0.####') AS StandardTimePadPrint, FORMAT(PC.STDTimeSEW, '###0.####') AS StandardTimeSewing, FORMAT(PC.STDTimePACK, '###0.####') AS StandardTimePacking, FORMAT(PC.STDTime, '###0.####') AS StandardTime, ");
                sbSQL.Append("       PC.ProductionStartDate, PC.CreatedBy, PC.CreatedDate ");
                sbSQL.Append("FROM   ProductionCapacity AS PC INNER JOIN ");
                sbSQL.Append("       Customer AS CUS ON PC.OIDCUST = CUS.OIDCUST INNER JOIN ");
                sbSQL.Append("       ProductStyle AS PS ON PC.OIDSTYLE = PS.OIDSTYLE INNER JOIN ");
                sbSQL.Append("       GarmentCategory AS GC ON PC.OIDGCATEGORY = GC.OIDGCATEGORY ");
                sbSQL.Append("WHERE  (PC.OIDCUST = '" + CusID + "') ");
                if (CusID != "")
                {
                    sbSQL.Append("AND (PC.OIDGCATEGORY = '" + CategoryID + "') ");
                }
                if (StyleID != "")
                {
                    sbSQL.Append("AND (PC.OIDSTYLE = '" + StyleID + "') ");
                }
                sbSQL.Append("ORDER BY CapacityID ");
                new ObjDevEx.setGridControl(gcCapacity, gvCapacity, sbSQL).getData(false, false, false, true);
            }
        }