コード例 #1
0
        private void IsExistsCode(ISession session, PurOrder pur)
        {
            ICriteria criteria = session.CreateCriteria(typeof(PurOrder));

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

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

            int count = (int)criteria.UniqueResult();
            if (count > 0)
            {
                throw new EasyJob.Tools.Exceptions.PurOrderIsExistsException();//采购主单号已经存在
            }
        }
コード例 #2
0
 public ActionResult Update(PurOrder purOrder)
 {
     return Json(purOrderOper.Update(purOrder,
         delegate(object sender, ISession session)
         {
             //判断是否存在采购主单号
             IsExistsCode(session, purOrder);
         }
         ));
 }
コード例 #3
0
 public ActionResult Del(PurOrder purOrder)
 {
     return Json(purOrderOper.Del(purOrder));
 }