public void Update(AscmEmpCarSwipeLog ascmEmpCarSwipeLog) { //int count = YnDaoHelper.GetInstance().nHibernateHelper.GetCount("select count(*) from AscmEmpCarSwipeLog where id<>" + ascmEmpCarSwipeLog.id + " and docNumber='" + ascmEmpCarSwipeLog.docNumber + "'"); //if (count == 0) //{ // using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) // { // try // { // YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmEmpCarSwipeLog>(ascmEmpCarSwipeLog); // tx.Commit();//正确执行提交 // } // catch (Exception ex) // { // tx.Rollback();//回滚 // YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmEmpCarSwipeLog)", ex); // throw ex; // } // } //} //else //{ // throw new Exception("已经存在员工编号\"" + ascmEmpCarSwipeLog.name + "\"!"); //} }
public AscmEmpCarSwipeLog GetAddLog(int doorId, string readingHead, string rfid, string employeeName, string plateNumber, bool pass, string description, DateTime createTime, string direction) { try { DateTime dtServerTime = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentDate("AscmEmpCarSwipeLog"); AscmEmpCarSwipeLog ascmEmpCarSwipeLog = new AscmEmpCarSwipeLog(); ascmEmpCarSwipeLog.doorId = doorId; ascmEmpCarSwipeLog.readingHeadId = 0; ascmEmpCarSwipeLog.readingHead = readingHead; ascmEmpCarSwipeLog.rfid = rfid; ascmEmpCarSwipeLog.employeeName = employeeName; ascmEmpCarSwipeLog.plateNumber = plateNumber; ascmEmpCarSwipeLog.createTime = createTime.ToString("yyyy-MM-dd HH:mm:ss"); ascmEmpCarSwipeLog.modifyTime = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss"); ascmEmpCarSwipeLog.status = 1; ascmEmpCarSwipeLog.pass = pass; ascmEmpCarSwipeLog.direction = direction; ascmEmpCarSwipeLog.description = description; return(ascmEmpCarSwipeLog); } catch (Exception ex) { throw ex; } }
public void Delete(AscmEmpCarSwipeLog ascmEmpCarSwipeLog) { try { YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmEmpCarSwipeLog>(ascmEmpCarSwipeLog); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmEmpCarSwipeLog)", ex); throw ex; } }
public void Delete(string id) { try { AscmEmpCarSwipeLog ascmEmpCarSwipeLog = Get(id); Delete(ascmEmpCarSwipeLog); } catch (Exception ex) { throw ex; } }
public void AddLog(int doorId, string readingHead, string rfid, string employeeName, string plateNumber, bool pass, string description, DateTime createTime, string direction) { try { AscmEmpCarSwipeLog ascmEmpCarSwipeLog = GetAddLog(doorId, readingHead, rfid, employeeName, plateNumber, pass, description, createTime, direction); Save(ascmEmpCarSwipeLog); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("增加失败(Add AscmEmpCarSwipeLog)", ex); throw ex; } }
public AscmEmpCarSwipeLog Get(string id) { AscmEmpCarSwipeLog ascmEmpCarSwipeLog = null; try { ascmEmpCarSwipeLog = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmEmpCarSwipeLog>(id); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmEmpCarSwipeLog)", ex); throw ex; } return(ascmEmpCarSwipeLog); }
public void Save(AscmEmpCarSwipeLog ascmEmpCarSwipeLog) { try { using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) { try { YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmEmpCarSwipeLog); tx.Commit();//正确执行提交 } catch (Exception ex) { tx.Rollback();//回滚 throw ex; } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmEmpCarSwipeLog)", ex); throw ex; } }