/// <summary>
 /// 得到一个对象实体,从缓存中
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.TT_TaxUnit GetModelByCache(string UnitCode)
 {
     TT_TaxUnit tu = new TT_TaxUnit();
     tu.UnitCode = UnitCode;
     string CacheKey = "TT_TaxUnitModel-" + UnitCode;
     object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
     if (objModel == null)
     {
         try
         {
             objModel = dal.GetModel(tu);
             if (objModel != null)
             {
                 int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
                 Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
             }
         }
         catch { }
     }
     return (TDTK.PlatForm.MVC4.Model.TT_TaxUnit)objModel;
 }
 public bool Delete(TT_TaxUnit t)
 {
     return dal.Delete(t);
 }
 public TT_TaxUnit GetModel(TT_TaxUnit t)
 {
     return dal.GetModel(t);
 }
 public bool Update(TT_TaxUnit t)
 {
     return dal.Update(t);
 }
 public int Add(TT_TaxUnit t)
 {
     return dal.Add(t);
 }
 public bool Exists(TT_TaxUnit t)
 {
     return dal.Exists(t);
 }
示例#7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.TT_TaxUnit DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.TT_TaxUnit model = new TDTK.PlatForm.MVC4.Model.TT_TaxUnit();
     if (row != null)
     {
         if (row["UnitCode"] != null)
         {
             model.UnitCode = row["UnitCode"].ToString();
         }
         if (row["UnitName"] != null)
         {
             model.UnitName = row["UnitName"].ToString();
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
         if (row["IsForbid"] != null)
         {
             model.IsForbid = row["IsForbid"].ToString();
         }
     }
     return model;
 }
示例#8
0
        public Model.TT_TaxUnit GetModel(Model.TT_TaxUnit t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 UnitCode,UnitName,Remark,IsForbid from TT_TaxUnit ");
            strSql.Append(" where UnitCode=@UnitCode ");
            SqlParameter[] parameters = {
					new SqlParameter("@UnitCode", SqlDbType.VarChar,10)			};
            parameters[0].Value = t.UnitCode;

            TDTK.PlatForm.MVC4.Model.TT_TaxUnit model = new TDTK.PlatForm.MVC4.Model.TT_TaxUnit();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }