/// <summary> /// 得到一个对象实体,从缓存中 /// </summary> public TDTK.PlatForm.MVC4.Model.TT_LoadWeightByDay GetModelByCache(string RoomCode, string CollCode, string CoalKindCode, decimal TaxGroup, DateTime WeightTime) { TT_LoadWeightByDay lb = new TT_LoadWeightByDay(); lb.RoomCode = RoomCode; lb.CollCode = CollCode; lb.CoalKindCode = CoalKindCode; lb.TaxGroup = TaxGroup; lb.WeightTime = WeightTime; string CacheKey = "TT_LoadWeightByDayModel-" + RoomCode + CollCode + CoalKindCode + TaxGroup + WeightTime; object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey); if (objModel == null) { try { objModel = dal.GetModel(lb); 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_LoadWeightByDay)objModel; }
public Model.TT_LoadWeightByDay DataRowToModel(DataRow row) { TDTK.PlatForm.MVC4.Model.TT_LoadWeightByDay model = new TDTK.PlatForm.MVC4.Model.TT_LoadWeightByDay(); if (row != null) { if (row["RoomCode"] != null) { model.RoomCode = row["RoomCode"].ToString(); } if (row["CollCode"] != null) { model.CollCode = row["CollCode"].ToString(); } if (row["CoalKindCode"] != null) { model.CoalKindCode = row["CoalKindCode"].ToString(); } if (row["TaxGroup"] != null && row["TaxGroup"].ToString() != "") { model.TaxGroup = decimal.Parse(row["TaxGroup"].ToString()); } if (row["WeightTime"] != null && row["WeightTime"].ToString() != "") { model.WeightTime = DateTime.Parse(row["WeightTime"].ToString()); } if (row["NetWeight"] != null && row["NetWeight"].ToString() != "") { model.NetWeight = decimal.Parse(row["NetWeight"].ToString()); } if (row["TaxAmount"] != null && row["TaxAmount"].ToString() != "") { model.TaxAmount = decimal.Parse(row["TaxAmount"].ToString()); } } return model; }
public Model.TT_LoadWeightByDay GetModel(Model.TT_LoadWeightByDay t) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 RoomCode,CollCode,CoalKindCode,TaxGroup,WeightTime,NetWeight,TaxAmount from TT_LoadWeightByDay "); strSql.Append(" where RoomCode=@RoomCode and CollCode=@CollCode and CoalKindCode=@CoalKindCode and TaxGroup=@TaxGroup and WeightTime=@WeightTime "); SqlParameter[] parameters = { new SqlParameter("@RoomCode", SqlDbType.VarChar,10), new SqlParameter("@CollCode", SqlDbType.VarChar,10), new SqlParameter("@CoalKindCode", SqlDbType.VarChar,10), new SqlParameter("@TaxGroup", SqlDbType.Decimal,9), new SqlParameter("@WeightTime", SqlDbType.DateTime) }; parameters[0].Value = t.RoomCode; parameters[1].Value = t.CollCode; parameters[2].Value = t.CoalKindCode; parameters[3].Value = t.TaxGroup; parameters[4].Value = t.WeightTime; TDTK.PlatForm.MVC4.Model.TT_LoadWeightByDay model = new TDTK.PlatForm.MVC4.Model.TT_LoadWeightByDay(); 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_LoadWeightByDay GetModel(TT_LoadWeightByDay t) { return dal.GetModel(t); }
public bool Delete(TT_LoadWeightByDay t) { return dal.Delete(t); }
public bool Update(TT_LoadWeightByDay t) { return dal.Update(t); }
public int Add(TT_LoadWeightByDay t) { return dal.Add(t); }
public bool Exists(TT_LoadWeightByDay t) { return dal.Exists(t); }