/// <summary> /// 得到一个对象实体,从缓存中 /// </summary> public TDTK.PlatForm.MVC4.Model.TT_ColieryAccount GetModelByCache(string CollCode) { TT_ColieryAccount ca = new TT_ColieryAccount(); ca.CollCode = CollCode; string CacheKey = "TT_ColieryAccountModel-" + CollCode; object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey); if (objModel == null) { try { objModel = dal.GetModel(ca); 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_ColieryAccount)objModel; }
public Model.TT_ColieryAccount DataRowToModel(System.Data.DataRow row) { TDTK.PlatForm.MVC4.Model.TT_ColieryAccount model = new TDTK.PlatForm.MVC4.Model.TT_ColieryAccount(); if (row != null) { if (row["CollCode"] != null) { model.CollCode = row["CollCode"].ToString(); } if (row["Account"] != null && row["Account"].ToString() != "") { model.Account = decimal.Parse(row["Account"].ToString()); } if (row["EnabledCardNum"] != null && row["EnabledCardNum"].ToString() != "") { model.EnabledCardNum = decimal.Parse(row["EnabledCardNum"].ToString()); } if (row["LowAccount"] != null && row["LowAccount"].ToString() != "") { model.LowAccount = decimal.Parse(row["LowAccount"].ToString()); } if (row["MarkCardNum"] != null && row["MarkCardNum"].ToString() != "") { model.MarkCardNum = decimal.Parse(row["MarkCardNum"].ToString()); } } return model; }
public Model.TT_ColieryAccount GetModel(Model.TT_ColieryAccount t) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CollCode,Account,EnabledCardNum,LowAccount,MarkCardNum from TT_ColieryAccount "); strSql.Append(" where CollCode=@CollCode "); SqlParameter[] parameters = { new SqlParameter("@CollCode", SqlDbType.VarChar,10) }; parameters[0].Value = t.CollCode; TDTK.PlatForm.MVC4.Model.TT_ColieryAccount model = new TDTK.PlatForm.MVC4.Model.TT_ColieryAccount(); 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_ColieryAccount GetModel(TT_ColieryAccount t) { return dal.GetModel(t); }
public bool Delete(TT_ColieryAccount t) { return dal.Delete(t); }
public bool Update(TT_ColieryAccount t) { return dal.Update(t); }
public int Add(TT_ColieryAccount t) { return dal.Add(t); }
public bool Exists(TT_ColieryAccount t) { return dal.Exists(t); }