/// <summary>
 /// 得到一个对象实体,从缓存中
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.Sys_FileSave GetModelByCache(string FileCode)
 {
     Sys_FileSave sfs = new Sys_FileSave();
     sfs.FileCode = FileCode;
     string CacheKey = "Sys_FileSaveModel-" + FileCode;
     object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
     if (objModel == null)
     {
         try
         {
             objModel = dal.GetModel(sfs);
             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.Sys_FileSave)objModel;
 }
 public bool Delete(Sys_FileSave t)
 {
     return dal.Delete(t);
 }
 public Sys_FileSave GetModel(Sys_FileSave t)
 {
     return dal.GetModel(t);
 }
 public bool Update(Sys_FileSave t)
 {
     return dal.Update(t);
 }
 public int Add(Sys_FileSave t)
 {
     return dal.Add(t);
 }
 public bool Exists(Sys_FileSave t)
 {
     return dal.Exists(t);
 }
예제 #7
0
 public Model.Sys_FileSave DataRowToModel(System.Data.DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.Sys_FileSave model = new TDTK.PlatForm.MVC4.Model.Sys_FileSave();
     if (row != null)
     {
         if (row["FileCode"] != null)
         {
             model.FileCode = row["FileCode"].ToString();
         }
         if (row["FileName"] != null)
         {
             model.FileName = row["FileName"].ToString();
         }
         if (row["FilePath"] != null)
         {
             model.FilePath = row["FilePath"].ToString();
         }
         if (row["FileSize"] != null && row["FileSize"].ToString() != "")
         {
             model.FileSize = decimal.Parse(row["FileSize"].ToString());
         }
         if (row["FileType"] != null)
         {
             model.FileType = row["FileType"].ToString();
         }
         if (row["FileContent"] != null && row["FileContent"].ToString() != "")
         {
             model.FileContent = (byte[])row["FileContent"];
         }
     }
     return model;
 }
예제 #8
0
        public Model.Sys_FileSave GetModel(Model.Sys_FileSave t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 FileCode,FileName,FilePath,FileSize,FileType,FileContent from Sys_FileSave ");
            strSql.Append(" where FileCode=@FileCode ");
            SqlParameter[] parameters = {
					new SqlParameter("@FileCode", SqlDbType.VarChar,32)			};
            parameters[0].Value = t.FileCode;

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