コード例 #1
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Product_Limit SafeBindForm(Lebi_Product_Limit model)
 {
     if (HttpContext.Current.Request["Product_id"] != null)
     {
         model.Product_id = Shop.Tools.RequestTool.RequestInt("Product_id", 0);
     }
     if (HttpContext.Current.Request["User_id"] != null)
     {
         model.User_id = Shop.Tools.RequestTool.RequestInt("User_id", 0);
     }
     if (HttpContext.Current.Request["IsShow"] != null)
     {
         model.IsShow = Shop.Tools.RequestTool.RequestInt("IsShow", 0);
     }
     if (HttpContext.Current.Request["IsPriceShow"] != null)
     {
         model.IsPriceShow = Shop.Tools.RequestTool.RequestInt("IsPriceShow", 0);
     }
     if (HttpContext.Current.Request["IsBuy"] != null)
     {
         model.IsBuy = Shop.Tools.RequestTool.RequestInt("IsBuy", 0);
     }
     if (HttpContext.Current.Request["UserLevel_id"] != null)
     {
         model.UserLevel_id = Shop.Tools.RequestTool.RequestInt("UserLevel_id", 0);
     }
     return(model);
 }
コード例 #2
0
        public Lebi_Product_Limit GetLimitInfo(int proid)
        {
            Lebi_Product_Limit model = null;

            if (user.id > 0)
            {
                model = B_Lebi_Product_Limit.GetModel("Product_id=" + proid + " and User_id=" + user.id + "");
                if (model == null)
                {
                    int c = B_Lebi_Product_Limit.Counts("User_id=" + user.id + "");
                    if (c == 0)
                    {
                        model = B_Lebi_Product_Limit.GetModel("Product_id=" + proid + " and  UserLevel_id=" + user.UserLevel_id + "");
                    }
                }
            }
            else
            {
                model = B_Lebi_Product_Limit.GetModel("Product_id=" + proid + " and  UserLevel_id=" + userlevel.id + "");
            }

            if (model == null)
            {
                return(new Lebi_Product_Limit());
            }
            return(model);
        }
コード例 #3
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Product_Limit model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Product_Limit] set ");
                strSql.Append("Product_id= @Product_id,");
                strSql.Append("User_id= @User_id,");
                strSql.Append("IsShow= @IsShow,");
                strSql.Append("IsPriceShow= @IsPriceShow,");
                strSql.Append("IsBuy= @IsBuy,");
                strSql.Append("UserLevel_id= @UserLevel_id");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",           SqlDbType.Int, 4),
                    new SqlParameter("@Product_id",   SqlDbType.Int, 4),
                    new SqlParameter("@User_id",      SqlDbType.Int, 4),
                    new SqlParameter("@IsShow",       SqlDbType.Int, 4),
                    new SqlParameter("@IsPriceShow",  SqlDbType.Int, 4),
                    new SqlParameter("@IsBuy",        SqlDbType.Int, 4),
                    new SqlParameter("@UserLevel_id", SqlDbType.Int, 4)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Product_id;
                parameters[2].Value = model.User_id;
                parameters[3].Value = model.IsShow;
                parameters[4].Value = model.IsPriceShow;
                parameters[5].Value = model.IsBuy;
                parameters[6].Value = model.UserLevel_id;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
コード例 #4
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Product_Limit model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Product_Limit](");
                strSql.Append("Product_id,User_id,IsShow,IsPriceShow,IsBuy,UserLevel_id)");
                strSql.Append(" values (");
                strSql.Append("@Product_id,@User_id,@IsShow,@IsPriceShow,@IsBuy,@UserLevel_id)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Product_id",   model.Product_id),
                    new SqlParameter("@User_id",      model.User_id),
                    new SqlParameter("@IsShow",       model.IsShow),
                    new SqlParameter("@IsPriceShow",  model.IsPriceShow),
                    new SqlParameter("@IsBuy",        model.IsBuy),
                    new SqlParameter("@UserLevel_id", model.UserLevel_id)
                };

                object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
コード例 #5
0
        public Lebi_Product_Limit GetLimitInfo(int userid)
        {
            Lebi_Product_Limit model = B_Lebi_Product_Limit.GetModel("Product_id=" + product.id + " and User_id=" + userid + "");

            if (model == null)
            {
                return(new Lebi_Product_Limit());
            }
            return(model);
        }
コード例 #6
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Product_Limit GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Product_Limit] ");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id", SqlDbType.Int, 4)
                };
                parameters[0].Value = id;

                Lebi_Product_Limit model = new Lebi_Product_Limit();
                DataSet            ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Product_id"].ToString() != "")
                    {
                        model.Product_id = int.Parse(ds.Tables[0].Rows[0]["Product_id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["User_id"].ToString() != "")
                    {
                        model.User_id = int.Parse(ds.Tables[0].Rows[0]["User_id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["IsShow"].ToString() != "")
                    {
                        model.IsShow = int.Parse(ds.Tables[0].Rows[0]["IsShow"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["IsPriceShow"].ToString() != "")
                    {
                        model.IsPriceShow = int.Parse(ds.Tables[0].Rows[0]["IsPriceShow"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["IsBuy"].ToString() != "")
                    {
                        model.IsBuy = int.Parse(ds.Tables[0].Rows[0]["IsBuy"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["UserLevel_id"].ToString() != "")
                    {
                        model.UserLevel_id = int.Parse(ds.Tables[0].Rows[0]["UserLevel_id"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
コード例 #7
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_Product_Limit GetModel(string strWhere)
            {
                if (strWhere.IndexOf("lbsql{") > 0)
                {
                    SQLPara para = new SQLPara(strWhere, "", "");
                    return(GetModel(para));
                }
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Product_Limit] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_Product_Limit model = new Lebi_Product_Limit();
                DataSet            ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Product_id"].ToString() != "")
                    {
                        model.Product_id = int.Parse(ds.Tables[0].Rows[0]["Product_id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["User_id"].ToString() != "")
                    {
                        model.User_id = int.Parse(ds.Tables[0].Rows[0]["User_id"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["IsShow"].ToString() != "")
                    {
                        model.IsShow = int.Parse(ds.Tables[0].Rows[0]["IsShow"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["IsPriceShow"].ToString() != "")
                    {
                        model.IsPriceShow = int.Parse(ds.Tables[0].Rows[0]["IsPriceShow"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["IsBuy"].ToString() != "")
                    {
                        model.IsBuy = int.Parse(ds.Tables[0].Rows[0]["IsBuy"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["UserLevel_id"].ToString() != "")
                    {
                        model.UserLevel_id = int.Parse(ds.Tables[0].Rows[0]["UserLevel_id"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
コード例 #8
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Product_Limit ReaderBind(IDataReader dataReader)
            {
                Lebi_Product_Limit model = new Lebi_Product_Limit();
                object             ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                ojb = dataReader["Product_id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Product_id = (int)ojb;
                }
                ojb = dataReader["User_id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.User_id = (int)ojb;
                }
                ojb = dataReader["IsShow"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.IsShow = (int)ojb;
                }
                ojb = dataReader["IsPriceShow"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.IsPriceShow = (int)ojb;
                }
                ojb = dataReader["IsBuy"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.IsBuy = (int)ojb;
                }
                ojb = dataReader["UserLevel_id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.UserLevel_id = (int)ojb;
                }
                return(model);
            }
コード例 #9
0
        public Lebi_Product_Limit GetLimitInfo(Lebi_User user)
        {
            Lebi_Product_Limit model = B_Lebi_Product_Limit.GetModel("Product_id=" + product.id + " and User_id=" + user.id + "");

            if (model != null)
            {
                return(model);
            }
            int c = B_Lebi_Product_Limit.Counts("User_id=" + userid + "");

            if (c == 0)
            {
                model = B_Lebi_Product_Limit.GetModel("Product_id=" + product.id + " and UserLevel_id=" + user.UserLevel_id + "");
            }
            if (model == null)
            {
                return(new Lebi_Product_Limit());
            }
            return(model);
        }
コード例 #10
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Product_Limit model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Product_Limit](");
                strSql.Append("[Product_id],[User_id],[IsShow],[IsPriceShow],[IsBuy],[UserLevel_id])");
                strSql.Append(" values (");
                strSql.Append("@Product_id,@User_id,@IsShow,@IsPriceShow,@IsBuy,@UserLevel_id)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Product_id",   model.Product_id),
                    new OleDbParameter("@User_id",      model.User_id),
                    new OleDbParameter("@IsShow",       model.IsShow),
                    new OleDbParameter("@IsPriceShow",  model.IsPriceShow),
                    new OleDbParameter("@IsBuy",        model.IsBuy),
                    new OleDbParameter("@UserLevel_id", model.UserLevel_id)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            userlevelid = RequestTool.RequestInt("userlevelid");
            userid      = RequestTool.RequestInt("userid");

            productid = RequestTool.RequestInt("productid");
            key       = RequestTool.RequestString("key");
            userlevel = B_Lebi_UserLevel.GetModel(userlevelid);
            product   = B_Lebi_Product.GetModel(productid);
            if (product == null)
            {
                product = new Lebi_Product();
            }
            if (userlevel == null)
            {
                userlevel = new Lebi_UserLevel();
            }
            string where = "IsAnonymous<>1";
            if (key != "")
            {
                where += " and (UserName like '%" + key + "%' or RealName like '%" + key + "%' or NickName like '%" + key + "%')";
            }
            if (userlevelid > 0)
            {
                where += " and UserLevel_id =" + userlevelid + "";
            }

            PageSize = RequestTool.getpageSize(20);
            int recordCount = B_Lebi_User.Counts(where);

            PageString = Pager.GetPaginationStringForJS("reloadproducts({0},'" + key + "'," + userlevel.id + ");", page, PageSize, recordCount);
            users      = B_Lebi_User.GetList(where, "", PageSize, page);

            userlevellimit = B_Lebi_Product_Limit.GetModel("Product_id=" + product.id + " and UserLevel_id=" + userlevelid + "");
            if (userlevellimit == null)
            {
                userlevellimit = new Lebi_Product_Limit();
            }
        }
コード例 #12
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Product_Limit model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Product_Limit] set ");
                strSql.Append("[Product_id]=@Product_id,");
                strSql.Append("[User_id]=@User_id,");
                strSql.Append("[IsShow]=@IsShow,");
                strSql.Append("[IsPriceShow]=@IsPriceShow,");
                strSql.Append("[IsBuy]=@IsBuy,");
                strSql.Append("[UserLevel_id]=@UserLevel_id");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Product_id",   model.Product_id),
                    new OleDbParameter("@User_id",      model.User_id),
                    new OleDbParameter("@IsShow",       model.IsShow),
                    new OleDbParameter("@IsPriceShow",  model.IsPriceShow),
                    new OleDbParameter("@IsBuy",        model.IsBuy),
                    new OleDbParameter("@UserLevel_id", model.UserLevel_id)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
コード例 #13
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Product_Limit model)
 {
     D_Lebi_Product_Limit.Instance.Update(model);
 }
コード例 #14
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Product_Limit model)
 {
     return(D_Lebi_Product_Limit.Instance.Add(model));
 }
コード例 #15
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Product_Limit SafeBindForm(Lebi_Product_Limit model)
 {
     return(D_Lebi_Product_Limit.Instance.SafeBindForm(model));
 }