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