Пример #1
0
 public ActionResult Update(CheckStock checkStock)
 {
     return Json(checkStockOper.Update(checkStock,
         delegate(object sender, ISession session) {
             //判断是否存在盘点主单号
             IsExistsCode(session, checkStock);
         }
         ));
 }
Пример #2
0
        private void IsExistsCode(ISession session, CheckStock check)
        {
            ICriteria criteria = session.CreateCriteria(typeof(ReqOrder));

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

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

            int count = (int)criteria.UniqueResult();
            if (count > 0) {
                throw new EasyJob.Tools.Exceptions.CheckStockIsExistsException();//盘点主单号已经存在
            }
        }
Пример #3
0
 public ActionResult Del(CheckStock checkStock)
 {
     return Json(checkStockOper.Del(checkStock));
 }