private void IsExists(ISession session, SellPriceInfo spi)
        {
            ICriteria criteria = session.CreateCriteria(typeof(SellPriceInfo));

            ICriterion criterion = null;
            if (spi.Id != Guid.Empty)
            {
                criterion = Restrictions.Not(Restrictions.IdEq(spi.Id));
                criteria.Add(criterion);
            }

            criterion = Restrictions.Eq("Storehouse", spi.Storehouse);
            criteria.Add(criterion);

            criterion = Restrictions.Eq("Goods", spi.Goods);
            criteria.Add(criterion);
            //统计
            criteria.SetProjection(
                Projections.ProjectionList()
                .Add(Projections.Count("Id"))
                );

            int count = (int)criteria.UniqueResult();
            if (count > 0)
            {
                throw new EasyJob.Tools.Exceptions.SellPriceInfoIsExistsException();//销售价格管理(商品资料子表)已经存在
            }
        }
 public ActionResult Update(SellPriceInfo sellPriceInfo)
 {
     return Json(sellPriceInfoOper.Update(sellPriceInfo,
         delegate(object sender, ISession session)
         {
             //判断是否存在销售价格管理(商品资料子表)
             IsExists(session, sellPriceInfo);
         }
         ));
 }
 public ActionResult Del(SellPriceInfo sellPriceInfo)
 {
     return Json(sellPriceInfoOper.Del(sellPriceInfo));
 }