Ejemplo n.º 1
0
        private void cmboStyles_CheckStateChanged(object sender, EventArgs e)
        {
            if (sender is ProductionPlanning.CheckComboBoxItem && FormLoaded)
            {
                ProductionPlanning.CheckComboBoxItem item = (ProductionPlanning.CheckComboBoxItem)sender;
                if (item.CheckState)
                {
                    QueryParms.Styles.Add(repo.LoadStyle(item._Pk));
                    using (var context = new TTI2Entities())
                    {
                        cmboColours.Items.Clear();

                        var Colours = context.TLPPS_Replenishment.Where(x => x.TLREP_Style_FK == item._Pk && !x.TLREP_Discontinued).GroupBy(x => x.TLREP_Colour_FK).ToList();
                        foreach (var Col in Colours)
                        {
                            var Clr_Pk = Col.FirstOrDefault().TLREP_Colour_FK;
                            var Clr    = context.TLADM_Colours.Find(Clr_Pk);
                            if (Clr != null)
                            {
                                cmboColours.Items.Add(new  ProductionPlanning.CheckComboBoxItem(Clr.Col_Id, Clr.Col_Display, false));
                            }
                        }
                    }
                }
                else
                {
                    var value = QueryParms.Styles.Find(it => it.Sty_Id == item._Pk);
                    if (value != null)
                    {
                        QueryParms.Styles.Remove(value);
                    }

                    if (QueryParms.Styles.Count == 0)
                    {
                        cmboColours.Items.Clear();
                        using (var context = new TTI2Entities())
                        {
                            var Colours = context.TLADM_Colours.Where(x => !(bool)x.Col_Discontinued).OrderBy(x => x.Col_Display).ToList();
                            foreach (var Colour in Colours)
                            {
                                cmboColours.Items.Add(new ProductionPlanning.CheckComboBoxItem(Colour.Col_Id, Colour.Col_Display, false));
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 //-------------------------------------------------------------------------------------
 // this message handler gets called when the user checks/unchecks an item the combo box
 //----------------------------------------------------------------------------------------
 private void cmboGreige_CheckStateChanged(object sender, EventArgs e)
 {
     if (sender is ProductionPlanning.CheckComboBoxItem && formloaded)
     {
         ProductionPlanning.CheckComboBoxItem item = (ProductionPlanning.CheckComboBoxItem)sender;
         if (item.CheckState)
         {
             QueryParms.Greiges.Add(repo.LoadGreige(item._Pk));
         }
         else
         {
             var value = QueryParms.Greiges.Find(it => it.TLGreige_Id == item._Pk);
             if (value != null)
             {
                 QueryParms.Greiges.Remove(value);
             }
         }
     }
 }
Ejemplo n.º 3
0
 //-------------------------------------------------------------------------------------
 // this message handler gets called when the user checks/unchecks an item the combo box
 //----------------------------------------------------------------------------------------
 private void cmboSizes_CheckStateChanged(object sender, EventArgs e)
 {
     if (sender is ProductionPlanning.CheckComboBoxItem && formloaded)
     {
         ProductionPlanning.CheckComboBoxItem item = (ProductionPlanning.CheckComboBoxItem)sender;
         if (item.CheckState)
         {
             parms.Sizes.Add(repo.LoadSize(item._Pk));
         }
         else
         {
             var value = parms.Sizes.Find(it => it.SI_id == item._Pk);
             if (value != null)
             {
                 parms.Sizes.Remove(value);
             }
         }
     }
 }