Ejemplo n.º 1
0
       private void IsExistsCode(ISession session, RetOrder pet)
        {
            ICriteria criteria = session.CreateCriteria(typeof(RetOrder));

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

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

            int count = (int)criteria.UniqueResult();
            if (count > 0)
            {
                throw new EasyJob.Tools.Exceptions.RetOrderIsExistsException();//退货主单号已经存在
            }
        }
Ejemplo n.º 2
0
 public ActionResult Update(RetOrder retOrder)
 {
     return Json(retOrderOper.Update(retOrder,
         delegate(object sender, ISession session)
         {
             //判断是否存在退货主单号
             IsExistsCode(session, retOrder);
         }
         ));
 }
Ejemplo n.º 3
0
 public ActionResult Del(RetOrder retOrder)
 {
     return Json(retOrderOper.Del(retOrder));
 }