/// <summary> /// 得到一个对象实体,从缓存中 /// </summary> public TDTK.PlatForm.MVC4.Model.TT_RFCard GetModelByCache(string CardCode) { TT_RFCard rf = new TT_RFCard(); rf.CardCode = CardCode; string CacheKey = "TT_RFCardModel-" + CardCode; object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey); if (objModel == null) { try { objModel = dal.GetModel(rf); 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_RFCard)objModel; }
public Model.TT_RFCard DataRowToModel(DataRow row) { TDTK.PlatForm.MVC4.Model.TT_RFCard model = new TDTK.PlatForm.MVC4.Model.TT_RFCard(); if (row != null) { if (row["CardCode"] != null) { model.CardCode = row["CardCode"].ToString(); } if (row["InitialTime"] != null && row["InitialTime"].ToString() != "") { model.InitialTime = DateTime.Parse(row["InitialTime"].ToString()); } if (row["IntialPerson"] != null) { model.IntialPerson = row["IntialPerson"].ToString(); } } return model; }
public Model.TT_RFCard GetModel(Model.TT_RFCard t) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CardCode,InitialTime,IntialPerson from TT_RFCard "); strSql.Append(" where CardCode=@CardCode "); SqlParameter[] parameters = { new SqlParameter("@CardCode", SqlDbType.VarChar,12) }; parameters[0].Value = t.CardCode; TDTK.PlatForm.MVC4.Model.TT_RFCard model = new TDTK.PlatForm.MVC4.Model.TT_RFCard(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
public TT_RFCard GetModel(TT_RFCard t) { return dal.GetModel(t); }
public bool Delete(TT_RFCard t) { return dal.Delete(t); }
public bool Update(TT_RFCard t) { return dal.Update(t); }
public int Add(TT_RFCard t) { return dal.Add(t); }
public bool Exists(TT_RFCard t) { return dal.Exists(t); }