/// <summary>
 /// 得到一个对象实体,从缓存中
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.TT_EmptyWeight GetModelByCache(string EmptyCode)
 {
     TT_EmptyWeight ew = new TT_EmptyWeight();
     ew.EmptyCode = EmptyCode;
     string CacheKey = "TT_EmptyWeightModel-" + EmptyCode;
     object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
     if (objModel == null)
     {
         try
         {
             objModel = dal.GetModel(ew);
             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_EmptyWeight)objModel;
 }
 public bool Delete(TT_EmptyWeight t)
 {
     return dal.Delete(t);
 }
 public TT_EmptyWeight GetModel(TT_EmptyWeight t)
 {
     return dal.GetModel(t);
 }
 public bool Update(TT_EmptyWeight t)
 {
     return dal.Update(t);
 }
 public int Add(TT_EmptyWeight t)
 {
     return dal.Add(t);
 }
 public bool Exists(TT_EmptyWeight t)
 {
     return dal.Exists(t);
 }
 public Model.TT_EmptyWeight DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.TT_EmptyWeight model = new TDTK.PlatForm.MVC4.Model.TT_EmptyWeight();
     if (row != null)
     {
         if (row["EmptyCode"] != null)
         {
             model.EmptyCode = row["EmptyCode"].ToString();
         }
         if (row["CarCode"] != null)
         {
             model.CarCode = row["CarCode"].ToString();
         }
         if (row["RemoteCardCode"] != null)
         {
             model.RemoteCardCode = row["RemoteCardCode"].ToString();
         }
         if (row["NavicertCode"] != null)
         {
             model.NavicertCode = row["NavicertCode"].ToString();
         }
         if (row["EmptyWeight"] != null && row["EmptyWeight"].ToString() != "")
         {
             model.EmptyWeight = decimal.Parse(row["EmptyWeight"].ToString());
         }
         if (row["BangType"] != null)
         {
             model.BangType = row["BangType"].ToString();
         }
         if (row["RoomCode"] != null)
         {
             model.RoomCode = row["RoomCode"].ToString();
         }
         if (row["FrontImage"] != null)
         {
             model.FrontImage = row["FrontImage"].ToString();
         }
         if (row["Operator"] != null)
         {
             model.Operator = row["Operator"].ToString();
         }
         if (row["BangTime"] != null && row["BangTime"].ToString() != "")
         {
             model.BangTime = DateTime.Parse(row["BangTime"].ToString());
         }
         if (row["IsLoadWeight"] != null)
         {
             model.IsLoadWeight = row["IsLoadWeight"].ToString();
         }
         if (row["CarNo"] != null)
         {
             model.CarNo = row["CarNo"].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["RandomCode"] != null)
         {
             model.RandomCode = row["RandomCode"].ToString();
         }
     }
     return model;
 }
        public Model.TT_EmptyWeight GetModel(Model.TT_EmptyWeight t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 EmptyCode,CarCode,RemoteCardCode,NavicertCode,EmptyWeight,BangType,RoomCode,FrontImage,Operator,BangTime,IsLoadWeight,CarNo,CarOwnerName,CarOwnerIDCard,CarOwnerPhone,RandomCode from TT_EmptyWeight ");
            strSql.Append(" where EmptyCode=@EmptyCode ");
            SqlParameter[] parameters = {
					new SqlParameter("@EmptyCode", SqlDbType.VarChar,20)			};
            parameters[0].Value = t.EmptyCode;

            TDTK.PlatForm.MVC4.Model.TT_EmptyWeight model = new TDTK.PlatForm.MVC4.Model.TT_EmptyWeight();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }