/// <summary> /// 得到一个对象实体,从缓存中 /// </summary> public TDTK.PlatForm.MVC4.Model.TT_OutInWeight GetModelByCache(string InWeightCode, string OutWeightCode) { TT_OutInWeight oiw = new TT_OutInWeight(); oiw.InWeightCode = InWeightCode; oiw.OutWeightCode = OutWeightCode; string CacheKey = "TT_OutInWeightModel-" + InWeightCode + OutWeightCode; object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey); if (objModel == null) { try { objModel = dal.GetModel(oiw); 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_OutInWeight)objModel; }
public bool Delete(TT_OutInWeight t) { return dal.Delete(t); }
public TT_OutInWeight GetModel(TT_OutInWeight t) { return dal.GetModel(t); }
public bool Update(TT_OutInWeight t) { return dal.Update(t); }
public int Add(TT_OutInWeight t) { return dal.Add(t); }
public bool Exists(TT_OutInWeight t) { return dal.Exists(t); }
public Model.TT_OutInWeight DataRowToModel(DataRow row) { TDTK.PlatForm.MVC4.Model.TT_OutInWeight model = new TDTK.PlatForm.MVC4.Model.TT_OutInWeight(); if (row != null) { if (row["InWeightCode"] != null) { model.InWeightCode = row["InWeightCode"].ToString(); } if (row["OutWeightCode"] != null) { model.OutWeightCode = row["OutWeightCode"].ToString(); } if (row["CarNo"] != null) { model.CarNo = row["CarNo"].ToString(); } if (row["CarType"] != null) { model.CarType = row["CarType"].ToString(); } if (row["NavicertCode"] != null) { model.NavicertCode = row["NavicertCode"].ToString(); } if (row["InRoomName"] != null) { model.InRoomName = row["InRoomName"].ToString(); } if (row["OutRoomName"] != null) { model.OutRoomName = row["OutRoomName"].ToString(); } if (row["CoalKindName"] != null) { model.CoalKindName = row["CoalKindName"].ToString(); } if (row["InWeight"] != null && row["InWeight"].ToString() != "") { model.InWeight = decimal.Parse(row["InWeight"].ToString()); } if (row["OutWeight"] != null && row["OutWeight"].ToString() != "") { model.OutWeight = decimal.Parse(row["OutWeight"].ToString()); } if (row["InWeightDate"] != null && row["InWeightDate"].ToString() != "") { model.InWeightDate = DateTime.Parse(row["InWeightDate"].ToString()); } if (row["OutWeightDate"] != null && row["OutWeightDate"].ToString() != "") { model.OutWeightDate = DateTime.Parse(row["OutWeightDate"].ToString()); } if (row["ExceptLeft"] != null && row["ExceptLeft"].ToString() != "") { model.ExceptLeft = DateTime.Parse(row["ExceptLeft"].ToString()); } if (row["InOutDemo"] != null) { model.InOutDemo = row["InOutDemo"].ToString(); } } return model; }
public Model.TT_OutInWeight GetModel(Model.TT_OutInWeight t) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 InWeightCode,OutWeightCode,CarNo,CarType,NavicertCode,InRoomName,OutRoomName,CoalKindName,InWeight,OutWeight,InWeightDate,OutWeightDate,ExceptLeft,InOutDemo from TT_OutInWeight "); strSql.Append(" where InWeightCode=@InWeightCode and OutWeightCode=@OutWeightCode "); SqlParameter[] parameters = { new SqlParameter("@InWeightCode", SqlDbType.VarChar,20), new SqlParameter("@OutWeightCode", SqlDbType.VarChar,20) }; parameters[0].Value = t.InWeightCode; parameters[1].Value = t.OutWeightCode; TDTK.PlatForm.MVC4.Model.TT_OutInWeight model = new TDTK.PlatForm.MVC4.Model.TT_OutInWeight(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }