示例#1
0
 public RecipeFermentable(Recipe recipe, IFermentable fermentable, Weight weight, decimal pppg)
     : base(fermentable.Name)
 {
     this.recipe = recipe;
     this.fermentable = fermentable;
     this.weight = weight;
     this.pppg = pppg;
 }
示例#2
0
文件: Recipe.cs 项目: Jonsey/BrewRoom
        public virtual void AddFermentable(IFermentable fermentable, Weight weight, decimal pppg)
        {
            if (grains.Count > 0)
            {
                var existing = grains.SingleOrDefault(x => x.Name == fermentable.Name && x.Pppg == pppg);

                if (existing != null)
                    existing.IncreaseWeight(weight);
                else
                    grains.Add(new RecipeFermentable(this, fermentable, weight, pppg));
            }
            else
                grains.Add(new RecipeFermentable(this, fermentable, weight, pppg));
        }
示例#3
0
        public Guid Save(IFermentable fermentable)
        {
            using(var tran = Session.BeginTransaction())
            {
                try
                {
                    _session.SaveOrUpdate(fermentable);
                    tran.Commit();
                }
                catch (Exception)
                {
                    tran.Rollback();
                    _session.Close();
                    _session.Dispose();
                    _session = null;
                }
            }

            return fermentable.Id;
        }
示例#4
0
 //public FermentableViewModel()
 //{
 //    this._fermentable = new Fermentable("");
 //}
 public FermentableViewModel(IFermentable fermentable)
 {
     _fermentable = fermentable;
 }