Exemplo n.º 1
0
 public void Save(AscmWhTeam AscmWhTeam)
 {
     try
     {
         int count = YnDaoHelper.GetInstance().nHibernateHelper.GetCount("select count(*) from AscmWhTeam where id=" + AscmWhTeam.id);
         if (count == 0)
         {
             using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
             {
                 try
                 {
                     int id = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId(" select max(id) from AscmWhTeam ") + 1;
                     AscmWhTeam.id = id;
                     YnDaoHelper.GetInstance().nHibernateHelper.Save(AscmWhTeam);
                     tx.Commit();        //正确执行提交
                 }
                 catch (Exception ex)
                 {
                     tx.Rollback();      //回滚
                     throw ex;
                 }
             }
         }
         else
         {
             throw new Exception("已经存在组别!");
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmWhTeam)", ex);
         throw ex;
     }
 }
Exemplo n.º 2
0
 public void Delete(int id)
 {
     try
     {
         AscmWhTeam AscmWhTeam = Get(id);
         Delete(AscmWhTeam);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public void Delete(AscmWhTeam AscmWhTeam)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmWhTeam>(AscmWhTeam);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmWhTeam)", ex);
         throw ex;
     }
 }
Exemplo n.º 4
0
        public AscmWhTeam Get(int id)
        {
            AscmWhTeam AscmWhTeam = null;

            try
            {
                AscmWhTeam = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmWhTeam>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error(" 查询失败 (Get AscmWhTeam) ", ex);
                throw ex;
            }
            return(AscmWhTeam);
        }
Exemplo n.º 5
0
 public void Update(AscmWhTeam AscmWhTeam)
 {
     using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
     {
         try
         {
             YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmWhTeam>(AscmWhTeam);
             tx.Commit();    //正确执行提交
         }
         catch (Exception ex)
         {
             tx.Rollback();  //回滚
             YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmWhTeam)", ex);
             throw ex;
         }
     }
 }