/// <summary>
 /// 得到一个对象实体,从缓存中
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.TT_PitheadBillDetail GetModelByCache(string PitheadCode)
 {
     TT_PitheadBillDetail pb = new TT_PitheadBillDetail();
     pb.PitheadCode = PitheadCode;
     string CacheKey = "TT_PitheadBillDetailModel-" + PitheadCode;
     object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
     if (objModel == null)
     {
         try
         {
             objModel = dal.GetModel(pb);
             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_PitheadBillDetail)objModel;
 }
 public TT_PitheadBillDetail GetModel(TT_PitheadBillDetail t)
 {
     return dal.GetModel(t);
 }
 public bool Delete(TT_PitheadBillDetail t)
 {
     return dal.Delete(t);
 }
 public bool Update(TT_PitheadBillDetail t)
 {
     return dal.Exists(t);
 }
 public int Add(TT_PitheadBillDetail t)
 {
     return dal.Add(t);
 }
 public Model.TT_PitheadBillDetail DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.TT_PitheadBillDetail model = new TDTK.PlatForm.MVC4.Model.TT_PitheadBillDetail();
     if (row != null)
     {
         if (row["PitheadCode"] != null)
         {
             model.PitheadCode = row["PitheadCode"].ToString();
         }
         if (row["Iedition"] != null)
         {
             model.Iedition = row["Iedition"].ToString();
         }
         if (row["SendTime"] != null && row["SendTime"].ToString() != "")
         {
             model.SendTime = DateTime.Parse(row["SendTime"].ToString());
         }
         if (row["IsUsed"] != null)
         {
             model.IsUsed = row["IsUsed"].ToString();
         }
         if (row["UseTime"] != null && row["UseTime"].ToString() != "")
         {
             model.UseTime = DateTime.Parse(row["UseTime"].ToString());
         }
         if (row["CollCode"] != null)
         {
             model.CollCode = row["CollCode"].ToString();
         }
         if (row["KindCode"] != null)
         {
             model.KindCode = row["KindCode"].ToString();
         }
     }
     return model;
 }
        public Model.TT_PitheadBillDetail GetModel(Model.TT_PitheadBillDetail t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 PitheadCode,Iedition,SendTime,IsUsed,UseTime,CollCode,KindCode from TT_PitheadBillDetail ");
            strSql.Append(" where PitheadCode=@PitheadCode ");
            SqlParameter[] parameters = {
					new SqlParameter("@PitheadCode", SqlDbType.VarChar,20)			};
            parameters[0].Value = t.PitheadCode;

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