Exemplo n.º 1
0
 public ActionResult Update(RentOrder rentOrder)
 {
     return Json(rentOrderOper.Update(rentOrder,
         delegate(object sender, ISession session) {
             //判断是否存在领用主单号
             IsExistsCode(session, rentOrder);
         }
         ));
 }
Exemplo n.º 2
0
        private void IsExistsCode(ISession session, RentOrder rent)
        {
            ICriteria criteria = session.CreateCriteria(typeof(ReqOrder));

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

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

            int count = (int)criteria.UniqueResult();
            if (count > 0) {
                throw new EasyJob.Tools.Exceptions.RentOrderIsExistsException();//领用主单号已经存在
            }
        }
Exemplo n.º 3
0
 public ActionResult Del(RentOrder rentOrder)
 {
     return Json(rentOrderOper.Del(rentOrder));
 }