Esempio n. 1
0
        private void IsExists(ISession session, StorageAlarm storageAlarm)
        {
            ICriteria criteria = session.CreateCriteria(typeof(StorageAlarm));

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

            criterion = Restrictions.Eq("Storehouse", storageAlarm.Storehouse);
            criteria.Add(criterion);

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

            int count = (int)criteria.UniqueResult();
            if (count > 0)
            {
                throw new EasyJob.Tools.Exceptions.StorageAlarmIsExistsException();//库存报警表存在
            }
        }
Esempio n. 2
0
 public ActionResult Update(StorageAlarm storageAlarm)
 {
     return Json(storageAlarmOper.Update(storageAlarm,
         delegate(object sender, ISession session)
         {
             //判断是否存在库存数据
             IsExists(session, storageAlarm);
         }
         ));
 }
Esempio n. 3
0
 public ActionResult Del(StorageAlarm storageAlarm)
 {
     return Json(storageAlarmOper.Del(storageAlarm));
 }