/// <summary> /// 得到一个对象实体,从缓存中 /// </summary> public TDTK.PlatForm.MVC4.Model.Sys_OperatorPosition GetModelByCache(string PositonCode, string UserCode) { Sys_OperatorPosition sop = new Sys_OperatorPosition(); sop.PositonCode = PositonCode; sop.UserCode = UserCode; string CacheKey = "Sys_OperatorPositionModel-" + PositonCode + UserCode; object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey); if (objModel == null) { try { objModel = dal.GetModel(sop); 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_OperatorPosition)objModel; }
public Model.Sys_OperatorPosition DataRowToModel(System.Data.DataRow row) { TDTK.PlatForm.MVC4.Model.Sys_OperatorPosition model = new TDTK.PlatForm.MVC4.Model.Sys_OperatorPosition(); if (row != null) { if (row["PositonCode"] != null) { model.PositonCode = row["PositonCode"].ToString(); } if (row["UserCode"] != null) { model.UserCode = row["UserCode"].ToString(); } } return model; }
public Model.Sys_OperatorPosition GetModel(Model.Sys_OperatorPosition t) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 PositonCode,UserCode from Sys_OperatorPosition "); strSql.Append(" where PositonCode=@PositonCode and UserCode=@UserCode "); SqlParameter[] parameters = { new SqlParameter("@PositonCode", SqlDbType.VarChar,10), new SqlParameter("@UserCode", SqlDbType.VarChar,10) }; parameters[0].Value = t.PositonCode; parameters[1].Value = t.UserCode; TDTK.PlatForm.MVC4.Model.Sys_OperatorPosition model = new TDTK.PlatForm.MVC4.Model.Sys_OperatorPosition(); 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_OperatorPosition GetModel(Sys_OperatorPosition t) { return dal.GetModel(t); }
public bool Delete(Sys_OperatorPosition t) { return dal.Delete(t); }
public bool Update(Sys_OperatorPosition t) { return dal.Update(t); }
public int Add(Sys_OperatorPosition t) { return dal.Add(t); }
public bool Exists(Sys_OperatorPosition t) { return dal.Exists(t); }