/// <summary>
 /// 得到一个对象实体,从缓存中
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.Sys_LeaveWord GetModelByCache(string LeaveID)
 {
     Sys_LeaveWord slw = new Sys_LeaveWord();
     slw.LeaveID = LeaveID;
     string CacheKey = "Sys_LeaveWordModel-" + LeaveID;
     object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
     if (objModel == null)
     {
         try
         {
             objModel = dal.GetModel(slw);
             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_LeaveWord)objModel;
 }
예제 #2
0
 public Model.Sys_LeaveWord DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.Sys_LeaveWord model = new TDTK.PlatForm.MVC4.Model.Sys_LeaveWord();
     if (row != null)
     {
         if (row["LeaveID"] != null)
         {
             model.LeaveID = row["LeaveID"].ToString();
         }
         if (row["LeaveTitle"] != null)
         {
             model.LeaveTitle = row["LeaveTitle"].ToString();
         }
         if (row["LeaveDate"] != null && row["LeaveDate"].ToString() != "")
         {
             model.LeaveDate = DateTime.Parse(row["LeaveDate"].ToString());
         }
         if (row["LeaveContent"] != null)
         {
             model.LeaveContent = row["LeaveContent"].ToString();
         }
         if (row["Operator"] != null)
         {
             model.Operator = row["Operator"].ToString();
         }
         if (row["ReceiveID"] != null)
         {
             model.ReceiveID = row["ReceiveID"].ToString();
         }
         if (row["IsRead"] != null)
         {
             model.IsRead = row["IsRead"].ToString();
         }
     }
     return model;
 }
예제 #3
0
        public Model.Sys_LeaveWord GetModel(Model.Sys_LeaveWord t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 LeaveID,LeaveTitle,LeaveDate,LeaveContent,Operator,ReceiveID,IsRead from Sys_LeaveWord ");
            strSql.Append(" where LeaveID=@LeaveID ");
            SqlParameter[] parameters = {
					new SqlParameter("@LeaveID", SqlDbType.VarChar,32)			};
            parameters[0].Value = t.LeaveID;

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