public void Update(AscmBuildingWarehouseLink ascmBuildingWarehouseLink)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmBuildingWarehouseLink>(ascmBuildingWarehouseLink);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmBuildingWarehouseLink)", ex);
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Save AscmBuildingWarehouseLink)", ex);
         throw ex;
     }
 }
 public void Delete(AscmBuildingWarehouseLink ascmBuildingWarehouseLink)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmBuildingWarehouseLink>(ascmBuildingWarehouseLink);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmBuildingWarehouseLink)", ex);
         throw ex;
     }
 }
 public void Delete(int id)
 {
     try
     {
         AscmBuildingWarehouseLink ascmBuildingWarehouseLink = Get(id);
         Delete(ascmBuildingWarehouseLink);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public AscmBuildingWarehouseLink Get(int id)
        {
            AscmBuildingWarehouseLink ascmBuildingWarehouseLink = null;

            try
            {
                ascmBuildingWarehouseLink = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmBuildingWarehouseLink>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmBuildingWarehouseLink)", ex);
                throw ex;
            }
            return(ascmBuildingWarehouseLink);
        }
        public AscmBuildingWarehouseLink Get(int buildingId, string warehouseId)
        {
            AscmBuildingWarehouseLink ascmBuildingWarehouseLink = null;

            try
            {
                string sql = "from AscmBuildingWarehouseLink where buildingId=" + buildingId + " and warehouseId='" + warehouseId + "'";
                IList <AscmBuildingWarehouseLink> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmBuildingWarehouseLink>(sql);
                if (ilist != null && ilist.Count > 0)
                {
                    ascmBuildingWarehouseLink = ilist[0];
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmBuildingWarehouseLink)", ex);
                throw ex;
            }
            return(ascmBuildingWarehouseLink);
        }