public int StoreNewSlab(long aStartScanTime, long aEndScanTime) { try { var slabEntity = new SlabInfoEntity { StartScanTime = aStartScanTime, EndScanTime = aEndScanTime }; using (var session = NHibernateHelper.OpenSession()) { using (var t = session.BeginTransaction()) { session.Save(slabEntity); t.Commit(); } } return slabEntity.Id; } catch (Exception ex) { logger.Error("Ошибка при сохранении Slab: " + ex.Message); return -1; } }
public void UpdateStandartSizeId(int aSlabId, int aStandartSizeId) { try { var slabInfo = GetSlabInfo(aSlabId); var slabEntity = new SlabInfoEntity() { Id = slabInfo.GetId(), Number = slabInfo.GetNumber(), EndScanTime = slabInfo.GetEndScanTime(), StartScanTime = slabInfo.GetStartScanTime(), StandartSizeId = aStandartSizeId }; using (var session = NHibernateHelper.OpenSession()) { using (var transaction = session.BeginTransaction()) { session.Update(slabEntity); transaction.Commit(); } } } catch (Exception ex) { logger.Error("Ошибка при обновлении StandartSizeId: " + ex.Message); } }