public void Delete(AscmReadingHeadLog ascmReadingHeadLog)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete<AscmReadingHeadLog>(ascmReadingHeadLog);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmReadingHeadLog)", ex);
         throw ex;
     }
 }
 public void Save(AscmReadingHeadLog ascmReadingHeadLog, string sessionKey = null)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession(sessionKey).BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmReadingHeadLog, sessionKey);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmReadingHeadLog)", ex);
         throw ex;
     }
 }
 public void Update(AscmReadingHeadLog ascmReadingHeadLog)
 {
     //int count = YnDaoHelper.GetInstance().nHibernateHelper.GetCount("select count(*) from AscmReadingHeadLog where id<>" + ascmReadingHeadLog.id + " and docNumber='" + ascmReadingHeadLog.docNumber + "'");
     //if (count == 0)
     //{
     //    using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
     //    {
     //        try
     //        {
     //            YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmReadingHeadLog>(ascmReadingHeadLog);
     //            tx.Commit();//正确执行提交
     //        }
     //        catch (Exception ex)
     //        {
     //            tx.Rollback();//回滚
     //            YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmReadingHeadLog)", ex);
     //            throw ex;
     //        }
     //    }
     //}
     //else
     //{
     //    throw new Exception("已经存在员工编号\"" + ascmReadingHeadLog.name + "\"!");
     //}
 }
        public AscmReadingHeadLog GetAddLog(int readingHeadId, string rfid, string sn, DateTime createTime, bool processed, string sessionKey = null)
        {
            try
            {
                DateTime dtServerTime = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentDate("AscmReadingHead", sessionKey);

                AscmReadingHeadLog ascmReadingHeadLog = new AscmReadingHeadLog();
                ascmReadingHeadLog.readingHeadId = readingHeadId;
                ascmReadingHeadLog.rfid = rfid;
                ascmReadingHeadLog.sn = sn;
                ascmReadingHeadLog.createTime = createTime.ToString("yyyy-MM-dd HH:mm:ss");
                ascmReadingHeadLog.modifyTime = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss");
                ascmReadingHeadLog.processed = processed;
                return ascmReadingHeadLog;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }