Ejemplo n.º 1
0
        public AscmMaterialSubCategory GetId(string combinationCode)
        {
            AscmMaterialSubCategory MaterialSubCategory = null;

            try
            {
                string sql = "from AscmMaterialSubCategory";
                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(combinationCode))
                {
                    whereQueryWord = "combinationCode = '" + combinationCode + "'";
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                }
                IList <AscmMaterialSubCategory> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmMaterialSubCategory>(sql);
                if (ilist != null && ilist.Count > 0)
                {
                    foreach (AscmMaterialSubCategory ascmMaterialSubCategory in ilist)
                    {
                        MaterialSubCategory = ascmMaterialSubCategory;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmMaterialSubCategory)", ex);
                throw ex;
            }

            return(MaterialSubCategory);
        }
Ejemplo n.º 2
0
 public void Update(AscmMaterialSubCategory ascmMaterialSubCategory)
 {
     try
     {
         using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
         {
             try
             {
                 YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmMaterialSubCategory>(ascmMaterialSubCategory);
                 tx.Commit();//正确执行提交
             }
             catch (Exception ex)
             {
                 tx.Rollback();//回滚
                 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmMaterialSubCategory)", ex);
                 throw ex;
             }
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Get AscmMaterialSubCategory)", ex);
         throw ex;
     }
 }
Ejemplo n.º 3
0
 public void Delete(AscmMaterialSubCategory ascmMaterialSubCategory)
 {
     try
     {
         YnDaoHelper.GetInstance().nHibernateHelper.Delete <AscmMaterialSubCategory>(ascmMaterialSubCategory);
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmMaterialSubCategory)", ex);
         throw ex;
     }
 }
Ejemplo n.º 4
0
 public void Delete(int id)
 {
     try
     {
         AscmMaterialSubCategory ascmMaterialSubCategory = Get(id);
         Delete(ascmMaterialSubCategory);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
        public AscmMaterialSubCategory Get(int id)
        {
            AscmMaterialSubCategory ascmMaterialSubCategory = null;

            try
            {
                ascmMaterialSubCategory = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmMaterialSubCategory>(id);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmMaterialSubCategory)", ex);
                throw ex;
            }
            return(ascmMaterialSubCategory);
        }