Exemple #1
0
 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 + "\"!");
     //}
 }
Exemple #2
0
 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;
     }
 }
Exemple #3
0
 public void Delete(string id)
 {
     try
     {
         AscmReadingHeadLog ascmReadingHeadLog = Get(id);
         Delete(ascmReadingHeadLog);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
        public void AddLog(int readingHeadId, string rfid, string sn, DateTime createTime, bool processed, string sessionKey = null)
        {
            try
            {
                AscmReadingHeadLog ascmReadingHeadLog = GetAddLog(readingHeadId, rfid, sn, createTime, processed, sessionKey);

                Save(ascmReadingHeadLog, sessionKey);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("增加失败(Add AscmReadingHeadLog)", ex);
                throw ex;
            }
        }
Exemple #5
0
        public AscmReadingHeadLog Get(string id)
        {
            AscmReadingHeadLog ascmReadingHeadLog = null;

            try
            {
                ascmReadingHeadLog = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmReadingHeadLog>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmReadingHeadLog)", ex);
                throw ex;
            }
            return(ascmReadingHeadLog);
        }
Exemple #6
0
        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;
            }
        }
Exemple #7
0
 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;
     }
 }