コード例 #1
0
 public ActionResult Update(SellOrder sellOrder)
 {
     return Json(sellOrderOper.Update(sellOrder,
         delegate(object sender, ISession session) {
             //判断是否存在销售主单号
             IsExistsCode(session, sellOrder);
         }
         ));
 }
コード例 #2
0
        private void IsExistsCode(ISession session, SellOrder sellOrder)
        {
            ICriteria criteria = session.CreateCriteria(typeof(SellOrder));

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

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

            int count = (int)criteria.UniqueResult();
            if (count > 0) {
                throw new EasyJob.Tools.Exceptions.RetRentOrderIsExistsException();//销售主单号已经存在
            }
        }
コード例 #3
0
 public ActionResult Del(SellOrder sellOrder)
 {
     return Json(sellOrderOper.Del(sellOrder));
 }