public void Delete(int id) { try { AscmWmsContainerDelivery ascmWmsContainerDelivery = Get(id); if (ascmWmsContainerDelivery == null) { throw new Exception("系统错误:获取数据失败"); } using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) { try { YnDaoHelper.GetInstance().nHibernateHelper.Delete(ascmWmsContainerDelivery); tx.Commit();//正确执行提交 } catch (Exception ex) { tx.Rollback();//回滚 throw ex; } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmWmsContainerDelivery)", ex); throw ex; } }
public void Update(int id, decimal quantity) { try { AscmWmsContainerDelivery ascmWmsContainerDelivery = Get(id); if (ascmWmsContainerDelivery == null) { throw new Exception("系统错误:获取数据失败"); } ascmWmsContainerDelivery.modifyUser = ""; ascmWmsContainerDelivery.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmWmsContainerDelivery.quantity = quantity; using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) { try { YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmWmsContainerDelivery); tx.Commit();//正确执行提交 } catch (Exception ex) { tx.Rollback();//回滚 throw ex; } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("更新失败(Update AscmWmsContainerDelivery)", ex); throw ex; } }
public void Update(AscmWmsContainerDelivery ascmWmsContainerDelivery) { try { using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) { try { YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmWmsContainerDelivery>(ascmWmsContainerDelivery); tx.Commit();//正确执行提交 } catch (Exception ex) { tx.Rollback();//回滚 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmWmsContainerDelivery)", ex); throw ex; } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Save AscmWmsContainerDelivery)", ex); throw ex; } }
public void Delete(AscmWmsContainerDelivery ascmWmsContainerDelivery) { try { YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmWmsContainerDelivery>(ascmWmsContainerDelivery); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmWmsContainerDelivery)", ex); throw ex; } }
public AscmWmsContainerDelivery Get(int id) { AscmWmsContainerDelivery ascmWmsContainerDelivery = null; try { ascmWmsContainerDelivery = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmWmsContainerDelivery>(id); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmWmsContainerDelivery)", ex); throw ex; } return(ascmWmsContainerDelivery); }
public AscmWmsContainerDelivery Add(string containerSn, int preparationMainId, int materialId, int warelocationId, decimal quantity) { try { AscmWmsContainerDelivery ascmWmsContainerDelivery = new AscmWmsContainerDelivery(); ascmWmsContainerDelivery.organizationId = 775; ascmWmsContainerDelivery.createUser = ""; ascmWmsContainerDelivery.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmWmsContainerDelivery.modifyUser = ""; ascmWmsContainerDelivery.modifyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); ascmWmsContainerDelivery.containerSn = containerSn; ascmWmsContainerDelivery.preparationMainId = preparationMainId; ascmWmsContainerDelivery.materialId = materialId; ascmWmsContainerDelivery.quantity = quantity; int maxId = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmWmsContainerDelivery"); maxId++; ascmWmsContainerDelivery.id = maxId; using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) { try { YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmWmsContainerDelivery); tx.Commit();//正确执行提交 } catch (Exception ex) { tx.Rollback();//回滚 throw ex; } } return(ascmWmsContainerDelivery); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmWmsContainerDelivery)", ex); throw ex; } }