public void Update(AscmAllocateRule ascmAllocateRule) { try { using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) { try { YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmAllocateRule>(ascmAllocateRule); tx.Commit();//正确执行提交 } catch (Exception ex) { tx.Rollback();//回滚 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmAllocateRule)", ex); throw ex; } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmAllocateRule)", ex); throw ex; } }
public void Delete(AscmAllocateRule ascmAllocateRule) { try { YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmAllocateRule>(ascmAllocateRule); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmAllocateRule)", ex); throw ex; } }
public void Delete(int id) { try { AscmAllocateRule ascmAllocateRule = Get(id); Delete(ascmAllocateRule); } catch (Exception ex) { throw ex; } }
public AscmAllocateRule Get(int id) { AscmAllocateRule ascmAllocateRule = null; try { ascmAllocateRule = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmAllocateRule>(id); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmAllocateRule)", ex); throw ex; } return(ascmAllocateRule); }
public void SetLogisticsClass(AscmAllocateRule ascmAllocateRule) { if (ascmAllocateRule != null) { string ids = string.Empty; if (!string.IsNullOrEmpty(ascmAllocateRule.logisticsClassId.ToString()) && ascmAllocateRule.logisticsClassId != 0) { ids = ascmAllocateRule.logisticsClassId.ToString(); } if (!string.IsNullOrEmpty(ids)) { string sql = "from AscmLogisticsClassInfo where id = " + ids; IList <AscmLogisticsClassInfo> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmLogisticsClassInfo>(sql); if (ilist != null && ilist.Count > 0) { List <AscmLogisticsClassInfo> listAscmLogisticsClassInfo = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmLogisticsClassInfo>(ilist); ascmAllocateRule.ascmLogisticsClassInfo = listAscmLogisticsClassInfo.Find(e => e.id == ascmAllocateRule.logisticsClassId); } } } }