Esempio n. 1
0
        private void IsExistsCode(ISession session, Position pos)
        {
            ICriteria criteria = session.CreateCriteria(typeof(Position));

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

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

            int count = (int)criteria.UniqueResult();
            if (count > 0)
            {
                throw new EasyJob.Tools.Exceptions.PosCodeIsExistsException();//职位Code已经存在
            }
        }
Esempio n. 2
0
 public ActionResult Update(Position position)
 {
     return Json(positionOper.Update(position,
         delegate(object sender, ISession session)
         {
             //判断是否存在部门Code
             IsExistsCode(session, position);
         }
         ));
 }
Esempio n. 3
0
 public ActionResult Del(Position position)
 {
     return Json(positionOper.Del(position));
 }
 public IList<EmpModFunc> GetEmpModFuncs(Position pos)
 {
     return GetEmpModFuncs(EmpModFunc.RoleFlagVal.Emp, pos.Id);
 }