Esempio n. 1
0
        /// <summary>
        /// 得到一个对象实体 by where条件
        /// </summary>
        public Lebi_Config GetModel(string strWhere, int seconds = 0)
        {
            if (strWhere.IndexOf("lbsql{") > 0)
            {
                SQLPara para = new SQLPara(strWhere, "", "");
                return(GetModel(para, seconds));
            }
            string strTableName = TableName;
            string strFieldShow = "*";
            string cachekey     = "";
            string cachestr     = "";

            if (BaseUtils.BaseUtilsInstance.MemcacheInstance != null && seconds > 0)
            {
                cachestr = "select * " + TableName + " where " + strWhere + "|" + seconds;
                cachekey = LB.Tools.Utils.MD5(cachestr);
                var obj = LB.DataAccess.DB.Instance.GetMemchche(cachekey);
                if (obj != null)
                {
                    return(obj as Lebi_Config);
                }
            }
            Lebi_Config model = null;

            using (IDataReader dataReader = LB.DataAccess.DB.Instance.TextExecuteReaderOne(strTableName, strFieldShow, strWhere, null))
            {
                if (dataReader == null)
                {
                    return(null);
                }
                while (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                    if (cachekey != "")
                    {
                        LB.DataAccess.DB.Instance.SetMemchche(cachekey, model, "Lebi_Config", model.id, cachestr, seconds);
                    }
                    return(model);
                }
            }
            return(null);
        }
Esempio n. 2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Config model)
 {
     return(D_Lebi_Config.Instance.Add(model));
 }
Esempio n. 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Config model)
 {
     D_Lebi_Config.Instance.Update(model);
 }
Esempio n. 4
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Config SafeBindForm(Lebi_Config model)
 {
     return(D_Lebi_Config.Instance.SafeBindForm(model));
 }