예제 #1
0
 /// <summary>
 /// 得到一个对象实体,从缓存中
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.TT_Navicert GetModelByCache(string NavicertCode)
 {
     TT_Navicert n = new TT_Navicert();
     n.NavicertCode=NavicertCode;
     string CacheKey = "TT_NavicertModel-" + NavicertCode;
     object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
     if (objModel == null)
     {
         try
         {
             objModel = dal.GetModel(n);
             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_Navicert)objModel;
 }
예제 #2
0
 public bool Delete(TT_Navicert t)
 {
     return dal.Delete(t);
 }
예제 #3
0
 public TT_Navicert GetModel(TT_Navicert t)
 {
     return dal.GetModel(t);
 }
예제 #4
0
 public bool Update(TT_Navicert t)
 {
     return dal.Update(t);
 }
예제 #5
0
 public int Add(TT_Navicert t)
 {
     return dal.Add(t);
 }
예제 #6
0
 public bool Exists(TT_Navicert t)
 {
     return dal.Exists(t);
 }
예제 #7
0
 public Model.TT_Navicert DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.TT_Navicert model = new TDTK.PlatForm.MVC4.Model.TT_Navicert();
     if (row != null)
     {
         if (row["NavicertCode"] != null)
         {
             model.NavicertCode = row["NavicertCode"].ToString();
         }
         if (row["RoomCode"] != null)
         {
             model.RoomCode = row["RoomCode"].ToString();
         }
         if (row["CarCode"] != null)
         {
             model.CarCode = row["CarCode"].ToString();
         }
         if (row["CarNo"] != null)
         {
             model.CarNo = row["CarNo"].ToString();
         }
         if (row["CarType"] != null)
         {
             model.CarType = row["CarType"].ToString();
         }
         if (row["CarOwnerName"] != null)
         {
             model.CarOwnerName = row["CarOwnerName"].ToString();
         }
         if (row["CarOwnerPhone"] != null)
         {
             model.CarOwnerPhone = row["CarOwnerPhone"].ToString();
         }
         if (row["CarOwnerIDCard"] != null)
         {
             model.CarOwnerIDCard = row["CarOwnerIDCard"].ToString();
         }
         if (row["MostWeight"] != null && row["MostWeight"].ToString() != "")
         {
             model.MostWeight = decimal.Parse(row["MostWeight"].ToString());
         }
         if (row["EmptyWeight"] != null && row["EmptyWeight"].ToString() != "")
         {
             model.EmptyWeight = decimal.Parse(row["EmptyWeight"].ToString());
         }
         if (row["NavicertState"] != null)
         {
             model.NavicertState = row["NavicertState"].ToString();
         }
         if (row["CardType"] != null)
         {
             model.CardType = row["CardType"].ToString();
         }
         if (row["StartTime"] != null && row["StartTime"].ToString() != "")
         {
             model.StartTime = DateTime.Parse(row["StartTime"].ToString());
         }
         if (row["EndTime"] != null && row["EndTime"].ToString() != "")
         {
             model.EndTime = DateTime.Parse(row["EndTime"].ToString());
         }
         if (row["SendPerson"] != null)
         {
             model.SendPerson = row["SendPerson"].ToString();
         }
         if (row["ClaimPersonName"] != null)
         {
             model.ClaimPersonName = row["ClaimPersonName"].ToString();
         }
         if (row["IsForbid"] != null)
         {
             model.IsForbid = row["IsForbid"].ToString();
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
         if (row["NavicertNo"] != null)
         {
             model.NavicertNo = row["NavicertNo"].ToString();
         }
     }
     return model;
 }
예제 #8
0
        public Model.TT_Navicert GetModel(Model.TT_Navicert t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 NavicertCode,RoomCode,CarCode,CarNo,CarType,CarOwnerName,CarOwnerPhone,CarOwnerIDCard,MostWeight,EmptyWeight,NavicertState,CardType,StartTime,EndTime,SendPerson,ClaimPersonName,IsForbid,Remark,NavicertNo from TT_Navicert ");
            strSql.Append(" where NavicertCode=@NavicertCode ");
            SqlParameter[] parameters = {
					new SqlParameter("@NavicertCode", SqlDbType.VarChar,20)			};
            parameters[0].Value = t.NavicertCode;

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