Пример #1
0
 public void Save(AscmWipDiscreteJobsStatus ascmWipDiscreteJobsStatus)
 {
     try
     {
         int count = YnDaoHelper.GetInstance().nHibernateHelper.GetCount("select count(*) from AscmWipDiscreteJobsStatus where wipEntityId=" + ascmWipDiscreteJobsStatus.wipEntityId + " AND leaderId='" + ascmWipDiscreteJobsStatus.leaderId + "'");
         if (count == 0)
         {
             using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
             {
                 try
                 {
                     int id = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId(" select max(id) from AscmWipDiscreteJobsStatus ") + 1;
                     ascmWipDiscreteJobsStatus.id = id;
                     YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmWipDiscreteJobsStatus);
                     tx.Commit();        //正确执行提交
                 }
                 catch (Exception ex)
                 {
                     tx.Rollback();      //回滚
                     throw ex;
                 }
             }
         }
         else
         {
             //throw new Exception("已经存在记录!(AscmWipDiscreteJobsStatus)");
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmWipDiscreteJobsStatus)", ex);
         throw ex;
     }
 }
Пример #2
0
 public void Update(AscmWipDiscreteJobsStatus AscmWipDiscreteJobsStatus)
 {
     using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
     {
         try
         {
             YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmWipDiscreteJobsStatus>(AscmWipDiscreteJobsStatus);
             tx.Commit();    //正确执行提交
         }
         catch (Exception ex)
         {
             tx.Rollback();  //回滚
             YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmWipDiscreteJobsStatus)", ex);
             throw ex;
         }
     }
 }
Пример #3
0
 public void Delete(AscmWipDiscreteJobsStatus AscmWipDiscreteJobsStatus)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete<AscmWipDiscreteJobsStatus>(AscmWipDiscreteJobsStatus);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmWipDiscreteJobsStatus)", ex);
         throw ex;
     }
 }