public bool ValidLabor(LaborComponent lc)
        {
            if (lc.State == LMState.Unadded || lc.State == LMState.Deleted)
            {
                return(true);
            }
            if (string.IsNullOrEmpty(lc.Name))
            {
                throw new OjMissingLaborException("You must enter a Name!");
            }

            return(true);
        }
        void AddLabor(LaborComponent c, StyleViewModel svm, int keyVal)
        {
            Labor labor = new Labor(c);

            labor.Id = c.Id == 0 ? keyVal : c.Id;
            db.Labors.Add(labor);
            StyleLabor sl = new StyleLabor()
            {
                StyleId = svm.Style.Id, LaborId = labor.Id
            };

            db.StyleLabors.Add(sl);
        }
        public void AddDefaultEntries(StyleViewModel svm)
        {
            // Get the cost data and find initial values for the Finishing Labor & Packaging Costs. Both are based on the style's jewelry type
            decimal flPrice   = 0;
            decimal packPrice = 0;

            JewelryType jt = db.JewelryTypes.Where(j => svm.CompanyId == j.CompanyId).FirstOrDefault();

            if (jt != null)
            {
                flPrice   = jt.FinishingCost;
                packPrice = jt.PackagingCost;
            }

            // Add 2 Fixed Labor entries and 1 Fixed Misc entry
            LaborComponent lc = new LaborComponent
            {
                Id    = -1,
                Name  = StyleViewModel.FinishingLaborName,
                State = LMState.Fixed,
                PPP   = flPrice,
                Qty   = 1,
                Total = flPrice
            };

            svm.Labors.Add(lc);
            MiscComponent mc = new MiscComponent
            {
                Id    = -1,
                Name  = StyleViewModel.PackagingName,
                State = SVMStateEnum.Fixed,
                PPP   = packPrice,
                Qty   = 1,
                Total = packPrice
            };

            svm.Miscs.Add(mc);
        }