/// <summary>
 /// 得到一个对象实体,从缓存中
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.TT_InitialCard GetModelByCache(string cardID,string cardNo)
 {
     TT_InitialCard ini = new TT_InitialCard();
     ini.CardID = cardID;
     ini.CardNO = cardNo;
     string CacheKey = "TT_InitialCardModel-"+cardID+cardNo;
     object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
     if (objModel == null)
     {
         try
         {
             objModel = dal.GetModel(ini);
             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_InitialCard)objModel;
 }
Пример #2
0
 public Model.TT_InitialCard DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.TT_InitialCard model = new TDTK.PlatForm.MVC4.Model.TT_InitialCard();
     if (row != null)
     {
         if (row["CardID"] != null)
         {
             model.CardID = row["CardID"].ToString();
         }
         if (row["CardNO"] != null)
         {
             model.CardNO = row["CardNO"].ToString();
         }
         if (row["CardType"] != null)
         {
             model.CardType = row["CardType"].ToString();
         }
         if (row["InitialTime"] != null && row["InitialTime"].ToString() != "")
         {
             model.InitialTime = DateTime.Parse(row["InitialTime"].ToString());
         }
         if (row["IntialPerson"] != null)
         {
             model.IntialPerson = row["IntialPerson"].ToString();
         }
         if (row["CoalKindCode"] != null)
         {
             model.CoalKindCode = row["CoalKindCode"].ToString();
         }
     }
     return model;
 }
Пример #3
0
        public Model.TT_InitialCard GetModel(Model.TT_InitialCard t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 CardID,CardNO,CardType,InitialTime,IntialPerson,CoalKindCode from TT_InitialCard ");
            strSql.Append(" where CardID=@CardID and CardNO=@CardNO");
            SqlParameter[] parameters = {
					new SqlParameter("@CardID", SqlDbType.VarChar,20),
                                        new SqlParameter("CardNO",SqlDbType.VarChar,20)};
            parameters[0].Value = t.CardID;
            parameters[1].Value = t.CardNO;

            TDTK.PlatForm.MVC4.Model.TT_InitialCard model = new TDTK.PlatForm.MVC4.Model.TT_InitialCard();
            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_InitialCard GetModel(TT_InitialCard t)
 {
     return dal.GetModel(t);
 }
 public bool Delete(TT_InitialCard t)
 {
     return dal.Delete(t);
 }
 public bool Update(TT_InitialCard t)
 {
     return dal.Update(t);
 }
 public int Add(TT_InitialCard t)
 {
     return dal.Add(t);
 }
 public bool Exists(TT_InitialCard t)
 {
     return dal.Exists(t);
 }