/// <summary> /// 得到一个对象实体,从缓存中 /// </summary> public TDTK.PlatForm.MVC4.Model.TT_CarInfo GetModelByCache(string CarCode) { TT_CarInfo tc = new TT_CarInfo(); tc.CarCode = CarCode; string CacheKey = "TT_CarInfoModel-" + CarCode; object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey); if (objModel == null) { try { objModel = dal.GetModel(tc); 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_CarInfo)objModel; }
public Model.TT_CarInfo DataRowToModel(System.Data.DataRow row) { TDTK.PlatForm.MVC4.Model.TT_CarInfo model = new TDTK.PlatForm.MVC4.Model.TT_CarInfo(); if (row != null) { if (row["CarCode"] != null) { model.CarCode = row["CarCode"].ToString(); } if (row["RemoteCardCode"] != null) { model.RemoteCardCode = row["RemoteCardCode"].ToString(); } if (row["RoomCode"] != null) { model.RoomCode = row["RoomCode"].ToString(); } if (row["CarNo"] != null) { model.CarNo = row["CarNo"].ToString(); } if (row["CarType"] != null) { model.CarType = row["CarType"].ToString(); } if (row["EmptyWeight"] != null && row["EmptyWeight"].ToString() != "") { model.EmptyWeight = decimal.Parse(row["EmptyWeight"].ToString()); } if (row["MostWeight"] != null && row["MostWeight"].ToString() != "") { model.MostWeight = decimal.Parse(row["MostWeight"].ToString()); } if (row["Operator"] != null) { model.Operator = row["Operator"].ToString(); } if (row["BangType"] != null) { model.BangType = row["BangType"].ToString(); } if (row["RandomCode"] != null) { model.RandomCode = row["RandomCode"].ToString(); } if (row["EmptyBangTime"] != null && row["EmptyBangTime"].ToString() != "") { model.EmptyBangTime = DateTime.Parse(row["EmptyBangTime"].ToString()); } if (row["CarOwnerName"] != null) { model.CarOwnerName = row["CarOwnerName"].ToString(); } if (row["CarOwnerIDCard"] != null) { model.CarOwnerIDCard = row["CarOwnerIDCard"].ToString(); } if (row["CarOwnerPhone"] != null) { model.CarOwnerPhone = row["CarOwnerPhone"].ToString(); } if (row["DriveLicense"] != null) { model.DriveLicense = row["DriveLicense"].ToString(); } if (row["CarWidth"] != null && row["CarWidth"].ToString() != "") { model.CarWidth = decimal.Parse(row["CarWidth"].ToString()); } if (row["CarLength"] != null && row["CarLength"].ToString() != "") { model.CarLength = decimal.Parse(row["CarLength"].ToString()); } if (row["CarHight"] != null && row["CarHight"].ToString() != "") { model.CarHight = decimal.Parse(row["CarHight"].ToString()); } if (row["FirstImage"] != null) { model.FirstImage = row["FirstImage"].ToString(); } if (row["IsAuditing"] != null) { model.IsAuditing = row["IsAuditing"].ToString(); } if (row["AuditUser"] != null) { model.AuditUser = row["AuditUser"].ToString(); } if (row["AuditTime"] != null && row["AuditTime"].ToString() != "") { model.AuditTime = DateTime.Parse(row["AuditTime"].ToString()); } if (row["Remark"] != null) { model.Remark = row["Remark"].ToString(); } if (row["DriverName"] != null) { model.DriverName = row["DriverName"].ToString(); } if (row["DriverIDCard"] != null) { model.DriverIDCard = row["DriverIDCard"].ToString(); } if (row["DriverPhone"] != null) { model.DriverPhone = row["DriverPhone"].ToString(); } } return model; }
public Model.TT_CarInfo GetModel(Model.TT_CarInfo t) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CarCode,RemoteCardCode,RoomCode,CarNo,CarType,EmptyWeight,MostWeight,Operator,BangType,RandomCode,EmptyBangTime,CarOwnerName,CarOwnerIDCard,CarOwnerPhone,DriveLicense,CarWidth,CarLength,CarHight,FirstImage,IsAuditing,AuditUser,AuditTime,Remark,DriverName,DriverIDCard,DriverPhone from TT_CarInfo "); strSql.Append(" where CarCode=@CarCode "); SqlParameter[] parameters = { new SqlParameter("@CarCode", SqlDbType.VarChar,20) }; parameters[0].Value = t.CarCode; TDTK.PlatForm.MVC4.Model.TT_CarInfo model = new TDTK.PlatForm.MVC4.Model.TT_CarInfo(); 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_CarInfo GetModel(TT_CarInfo t) { return dal.GetModel(t); }
public bool Delete(TT_CarInfo t) { return dal.Delete(t); }
public bool Update(TT_CarInfo t) { return dal.Update(t); }
public int Add(TT_CarInfo t) { return dal.Add(t); }
public bool Exists(TT_CarInfo t) { return dal.Exists(t); }