Beispiel #1
0
        public IFluentRecipeOperations AddOperation(string Name)
        {
            _operation = contx.AddRecUnitOperation(_recipe, Name);


            //_operation = contx.MasterRecipes.FirstOrDefault(g => g.BrandName == s);
            //MasterRecipe rec = _parent.GetRecipe();
            //_operation = rec.RecOperations.FirstOrDefault(g => g.OperationName == s);

            //_isnew = false;

            //if (_operation == null)
            //{

            //    _isnew = true;
            //    _operation = new RecUnitOperation();

            //    _operation.OperationName = s;
            //    _operation.SetPoint = 0;
            //    _operation.Transitions = new List<Transition>();
            //    _operation.AllowedUnits = new List<Unit>();


            //    contx.RecUnitOperations.Add(_operation);
            //    contx.SaveChanges();

            //    contx.MasterRecipes.FirstOrDefault(f => f.BrandName == rec.BrandName).RecOperations.Add(_operation);

            //    contx.SaveChanges();
            //}

            return(this);
        }
Beispiel #2
0
        public IFluentRecipeOperations ForOperation(string Name)
        {
            _operation = contx.MasterRecipes.FirstOrDefault(g => g.MasterRecipeID == _recipe.MasterRecipeID).RecOperations.FirstOrDefault(s => s.OperationName == Name);

//            _operation = contx.RecUnitOperations.FirstOrDefault(g => g.OperationName == s);

            return(this);
        }
        public Transition AddTransition(RecUnitOperation op, string Name)
        {
            BrewDBContext cont = new BrewDBContext();
            //MasterRecipe rec = cont.MasterRecipes.FirstOrDefault(g => g.MasterRecipeID == MasterRecipeID);
            RecUnitOperation operation = new RecUnitOperation();
            Transition       tran      = new Transition();

            tran = cont.RecUnitOperations.FirstOrDefault(i => i.RecUnitOperationID == op.RecUnitOperationID).Transitions.FirstOrDefault(s => s.TransitionName == Name);

            return(tran);
        }
        public RecUnitOperation AddUnitToRecUnitOperation(RecUnitOperation op, string Name)
        {
            BrewDBContext contx = new BrewDBContext();

            Unit             u   = contx.Units.FirstOrDefault(s => s.UnitName == Name);
            RecUnitOperation opx = contx.RecUnitOperations.FirstOrDefault(g => g.RecUnitOperationID == op.RecUnitOperationID);

            if (u != null)
            {
                contx.RecUnitOperations.FirstOrDefault(g => g.RecUnitOperationID == op.RecUnitOperationID).AllowedUnits.Add(u);

                contx.SaveChanges();
            }
            return(opx);
        }
Beispiel #5
0
        public FluentRecipeOperations(MasterRecipe parent, string s)
        {
            //MasterRecipe rec = parent;
            _recipe = parent;
//            _operation =_parent.GetRecipe().RecOperations.FirstOrDefault(g=>g.OperationName==s);
            //_operation = contx.MasterRecipes.FirstOrDefault(g => g.BrandName == rec.BrandName).RecOperations.FirstOrDefault(e => e.OperationName == s);
            _operation = _recipe.RecOperations.FirstOrDefault(g => g.OperationName == s);

            //if (_operation == null)
            //{
            //    //_operation = new RecUnitOperation();

            //    AddOperation(s);

            //}
        }
        public RecUnitOperation AddRecUnitOperation(MasterRecipe recx, string Name)
        {
            BrewDBContext    cont      = new BrewDBContext();
            MasterRecipe     rec       = cont.MasterRecipes.FirstOrDefault(g => g.MasterRecipeID == recx.MasterRecipeID);
            RecUnitOperation operation = cont.RecUnitOperations.Create();


            operation = rec.RecOperations.FirstOrDefault(g => g.OperationName == Name);



            if (operation == null)
            {
                operation = cont.RecUnitOperations.Create();

                operation.OperationName = Name;
                operation.SetPoint      = 0;
                operation.Transitions   = new List <Transition>();
                operation.AllowedUnits  = new List <Unit>();

                cont.MasterRecipes.FirstOrDefault(g => g.MasterRecipeID == recx.MasterRecipeID).RecOperations.Add(operation);

                //cont.RecUnitOperations.Add(operation);
                cont.SaveChanges();

                //cont.MasterRecipes.FirstOrDefault(f => f.BrandName == rec.BrandName).RecOperations.Add(_operation);

                //cont.SaveChanges();
            }
            //else
            //{


            //}


            return(operation);
        }
Beispiel #7
0
 public FluentTransition(RecUnitOperation op, string Name)
 {
     _transition = contx.RecUnitOperations.FirstOrDefault(i => i.RecUnitOperationID == op.RecUnitOperationID).Transitions.FirstOrDefault(s => s.TransitionName == Name);
 }
Beispiel #8
0
 public FluentTransition(RecUnitOperation op)
 {
     _operation = op;
 }