Пример #1
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public Lebi_Supplier_Verified_Log ReaderBind(IDataReader dataReader)
        {
            Lebi_Supplier_Verified_Log model = new Lebi_Supplier_Verified_Log();
            object ojb;

            ojb = dataReader["id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.id = Convert.ToInt32(ojb);
            }
            model.ImageUrl = dataReader["ImageUrl"].ToString();
            ojb            = dataReader["Supplier_id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Supplier_id = Convert.ToInt32(ojb);
            }
            ojb = dataReader["Time_Add"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Time_Add = (DateTime)ojb;
            }
            ojb = dataReader["Type_id_SupplierVerifiedStatus"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Type_id_SupplierVerifiedStatus = Convert.ToInt32(ojb);
            }
            ojb = dataReader["Verified_id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Verified_id = Convert.ToInt32(ojb);
            }
            return(model);
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Lebi_Supplier_Verified_Log model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + TableName + " (");
            strSql.Append(LB.DataAccess.DB.BaseUtilsInstance.ColName("ImageUrl") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("Supplier_id") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("Time_Add") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("Type_id_SupplierVerifiedStatus") + "," + LB.DataAccess.DB.BaseUtilsInstance.ColName("Verified_id") + ")");
            strSql.Append(" values (");
            strSql.Append("@ImageUrl,@Supplier_id,@Time_Add,@Type_id_SupplierVerifiedStatus,@Verified_id);select @@identity;");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ImageUrl",                       model.ImageUrl),
                new SqlParameter("@Supplier_id",                    model.Supplier_id),
                new SqlParameter("@Time_Add",                       model.Time_Add),
                new SqlParameter("@Type_id_SupplierVerifiedStatus", model.Type_id_SupplierVerifiedStatus),
                new SqlParameter("@Verified_id",                    model.Verified_id)
            };

            object obj = LB.DataAccess.DB.Instance.TextExecute(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体 by where条件
        /// </summary>
        public Lebi_Supplier_Verified_Log 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_Supplier_Verified_Log);
                }
            }
            Lebi_Supplier_Verified_Log 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_Supplier_Verified_Log", model.id, cachestr, seconds);
                    }
                    return(model);
                }
            }
            return(null);
        }
Пример #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Lebi_Supplier_Verified_Log model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + TableName + " set ");
            List <string> cols = new List <string>();

            if (("," + model.UpdateCols + ",").IndexOf(",ImageUrl,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("ImageUrl") + "= @ImageUrl");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",Supplier_id,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("Supplier_id") + "= @Supplier_id");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",Time_Add,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("Time_Add") + "= @Time_Add");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",Type_id_SupplierVerifiedStatus,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("Type_id_SupplierVerifiedStatus") + "= @Type_id_SupplierVerifiedStatus");
            }
            if (("," + model.UpdateCols + ",").IndexOf(",Verified_id,") > -1 || model.UpdateCols == "")
            {
                cols.Add(LB.DataAccess.DB.BaseUtilsInstance.ColName("Verified_id") + "= @Verified_id");
            }
            strSql.Append(string.Join(",", cols));
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",                             model.id),
                new SqlParameter("@ImageUrl",                       model.ImageUrl),
                new SqlParameter("@Supplier_id",                    model.Supplier_id),
                new SqlParameter("@Time_Add",                       model.Time_Add),
                new SqlParameter("@Type_id_SupplierVerifiedStatus", model.Type_id_SupplierVerifiedStatus),
                new SqlParameter("@Verified_id",                    model.Verified_id)
            };
            LB.DataAccess.DB.Instance.TextExecuteNonQuery(strSql.ToString().Replace(", where id=@id", " where id=@id"), parameters);
        }
Пример #5
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Supplier_Verified_Log SafeBindForm(Lebi_Supplier_Verified_Log model)
 {
     if (HttpContext.Current.Request["ImageUrl"] != null)
     {
         model.ImageUrl = LB.Tools.RequestTool.RequestSafeString("ImageUrl");
     }
     if (HttpContext.Current.Request["Supplier_id"] != null)
     {
         model.Supplier_id = LB.Tools.RequestTool.RequestInt("Supplier_id", 0);
     }
     if (HttpContext.Current.Request["Time_Add"] != null)
     {
         model.Time_Add = LB.Tools.RequestTool.RequestTime("Time_Add", System.DateTime.Now);
     }
     if (HttpContext.Current.Request["Type_id_SupplierVerifiedStatus"] != null)
     {
         model.Type_id_SupplierVerifiedStatus = LB.Tools.RequestTool.RequestInt("Type_id_SupplierVerifiedStatus", 0);
     }
     if (HttpContext.Current.Request["Verified_id"] != null)
     {
         model.Verified_id = LB.Tools.RequestTool.RequestInt("Verified_id", 0);
     }
     return(model);
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Supplier_Verified_Log model)
 {
     D_Lebi_Supplier_Verified_Log.Instance.Update(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Supplier_Verified_Log model)
 {
     return(D_Lebi_Supplier_Verified_Log.Instance.Add(model));
 }
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Supplier_Verified_Log SafeBindForm(Lebi_Supplier_Verified_Log model)
 {
     return(D_Lebi_Supplier_Verified_Log.Instance.SafeBindForm(model));
 }