Exemplo n.º 1
0
        /// <summary>
        /// 取得每页记录
        /// </summary>
        /// <param name="p_pageIndex">当前页</param>
        /// <param name="p_pageSize">分页大小</param>
        /// <param name="p_recordCount">返回总记录数</param>
        /// <param name="strWhere">查询条件</param>
        /// <returns>IList DrawBox</returns>
        public IList <BCW.Draw.Model.DrawBox> GetDrawBoxs(int p_pageIndex, int p_pageSize, string strWhere, string strOrder, out int p_recordCount)
        {
            IList <BCW.Draw.Model.DrawBox> listDrawBoxs = new List <BCW.Draw.Model.DrawBox>();
            string sTable     = "tb_DrawBox";
            string sPkey      = "id";
            string sField     = "ID,GoodsName,Explain,GoodsImg,GoodsType,GoodsValue,GoodsNum,AddTime,OverTime,ReceiveTime,GoodsCounts,Statue,beizhu,rank,points,AllNum,lun";
            string sCondition = strWhere;
            string sOrder     = strOrder;
            int    iSCounts   = 0;

            using (SqlDataReader reader = SqlHelper.RunProcedureMe(sTable, sPkey, sField, p_pageIndex, p_pageSize, sCondition, sOrder, iSCounts, out p_recordCount))
            {
                //计算总页数
                if (p_recordCount > 0)
                {
                    int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex);
                }
                else
                {
                    return(listDrawBoxs);
                }
                while (reader.Read())
                {
                    BCW.Draw.Model.DrawBox objDrawBox = new BCW.Draw.Model.DrawBox();
                    objDrawBox.ID          = reader.GetInt32(0);
                    objDrawBox.GoodsName   = reader.GetString(1);
                    objDrawBox.Explain     = reader.GetString(2);
                    objDrawBox.GoodsImg    = reader.GetString(3);
                    objDrawBox.GoodsType   = reader.GetInt32(4);
                    objDrawBox.GoodsValue  = reader.GetInt32(5);
                    objDrawBox.GoodsNum    = reader.GetInt32(6);
                    objDrawBox.AddTime     = reader.GetDateTime(7);
                    objDrawBox.OverTime    = reader.GetDateTime(8);
                    objDrawBox.ReceiveTime = reader.GetDateTime(9);
                    objDrawBox.GoodsCounts = reader.GetInt32(10);
                    objDrawBox.Statue      = reader.GetInt32(11);
                    objDrawBox.beizhu      = reader.GetString(12);
                    objDrawBox.rank        = reader.GetInt32(13);
                    objDrawBox.points      = reader.GetInt32(14);
                    objDrawBox.AllNum      = reader.GetInt32(15);
                    objDrawBox.AllNum      = reader.GetInt32(16);
                    listDrawBoxs.Add(objDrawBox);
                }
            }
            return(listDrawBoxs);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(BCW.Draw.Model.DrawBox model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_DrawBox(");
            strSql.Append("GoodsName,Explain,GoodsImg,GoodsType,GoodsValue,GoodsNum,AddTime,OverTime,ReceiveTime,GoodsCounts,Statue,beizhu,Rank,Points,AllNum,lun)");
            strSql.Append(" values (");
            strSql.Append("@GoodsName,@Explain,@GoodsImg,@GoodsType,@GoodsValue,@GoodsNum,@AddTime,@OverTime,@ReceiveTime,@GoodsCounts,@Statue,@beizhu,@Rank,@Points,@AllNum,@lun)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@GoodsName",   SqlDbType.NVarChar,  50),
                new SqlParameter("@Explain",     SqlDbType.NVarChar),
                new SqlParameter("@GoodsImg",    SqlDbType.NVarChar),
                new SqlParameter("@GoodsType",   SqlDbType.Int,        4),
                new SqlParameter("@GoodsValue",  SqlDbType.Int,        4),
                new SqlParameter("@GoodsNum",    SqlDbType.Int,        4),
                new SqlParameter("@AddTime",     SqlDbType.DateTime),
                new SqlParameter("@OverTime",    SqlDbType.DateTime),
                new SqlParameter("@ReceiveTime", SqlDbType.DateTime),
                new SqlParameter("@GoodsCounts", SqlDbType.Int,        4),
                new SqlParameter("@Statue",      SqlDbType.Int,        4),
                new SqlParameter("@beizhu",      SqlDbType.NVarChar,  50),
                new SqlParameter("@rank",        SqlDbType.Int,        4),
                new SqlParameter("@Points",      SqlDbType.Int,        4),
                new SqlParameter("@AllNum",      SqlDbType.Int,        4),
                new SqlParameter("@lun",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.GoodsName;
            parameters[1].Value  = model.Explain;
            parameters[2].Value  = model.GoodsImg;
            parameters[3].Value  = model.GoodsType;
            parameters[4].Value  = model.GoodsValue;
            parameters[5].Value  = model.GoodsNum;
            parameters[6].Value  = model.AddTime;
            parameters[7].Value  = model.OverTime;
            parameters[8].Value  = model.ReceiveTime;
            parameters[9].Value  = model.GoodsCounts;
            parameters[10].Value = model.Statue;
            parameters[11].Value = model.beizhu;
            parameters[12].Value = model.rank;
            parameters[13].Value = model.points;
            parameters[14].Value = model.AllNum;
            parameters[15].Value = model.lun;

            SqlHelper.ExecuteSql(strSql.ToString(), parameters);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BCW.Draw.Model.DrawBox GetDrawBoxbyC(int GoodsCounts)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,GoodsName,Explain,GoodsImg,GoodsType,GoodsValue,GoodsNum,AddTime,OverTime,ReceiveTime,GoodsCounts,Statue,beizhu,rank,points,AllNum,lun from tb_DrawBox ");
            strSql.Append(" where GoodsCounts=@GoodsCounts ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@GoodsCounts", SqlDbType.Int, 4)
            };
            parameters[0].Value = GoodsCounts;

            BCW.Draw.Model.DrawBox model = new BCW.Draw.Model.DrawBox();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.HasRows)
                {
                    reader.Read();
                    model.ID          = reader.GetInt32(0);
                    model.GoodsName   = reader.GetString(1);
                    model.Explain     = reader.GetString(2);
                    model.GoodsImg    = reader.GetString(3);
                    model.GoodsType   = reader.GetInt32(4);
                    model.GoodsValue  = reader.GetInt32(5);
                    model.GoodsNum    = reader.GetInt32(6);
                    model.AddTime     = reader.GetDateTime(7);
                    model.OverTime    = reader.GetDateTime(8);
                    model.ReceiveTime = reader.GetDateTime(9);
                    model.GoodsCounts = reader.GetInt32(10);
                    model.Statue      = reader.GetInt32(11);
                    model.beizhu      = reader.GetString(12);
                    model.rank        = reader.GetInt32(13);
                    model.points      = reader.GetInt32(14);
                    model.AllNum      = reader.GetInt32(15);
                    model.lun         = reader.GetInt32(16);
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(BCW.Draw.Model.DrawBox model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_DrawBox set ");
            strSql.Append("GoodsName=@GoodsName,");
            strSql.Append("Explain=@Explain,");
            strSql.Append("GoodsImg=@GoodsImg,");
            strSql.Append("GoodsType=@GoodsType,");
            strSql.Append("GoodsValue=@GoodsValue,");
            strSql.Append("GoodsNum=@GoodsNum,");
            strSql.Append("AddTime=@AddTime,");
            strSql.Append("OverTime=@OverTime,");
            strSql.Append("ReceiveTime=@ReceiveTime,");
            strSql.Append("GoodsCounts=@GoodsCounts,");
            strSql.Append("Statue=@Statue,");
            strSql.Append("beizhu=@beizhu,");
            strSql.Append("rank=@rank,");
            strSql.Append("points=@points, ");
            strSql.Append("AllNum=@AllNum, ");
            strSql.Append("lun=@lun ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",          SqlDbType.Int,        4),
                new SqlParameter("@GoodsName",   SqlDbType.NVarChar,  50),
                new SqlParameter("@Explain",     SqlDbType.NVarChar),
                new SqlParameter("@GoodsImg",    SqlDbType.NVarChar),
                new SqlParameter("@GoodsType",   SqlDbType.Int,        4),
                new SqlParameter("@GoodsValue",  SqlDbType.Int,        4),
                new SqlParameter("@GoodsNum",    SqlDbType.Int,        4),
                new SqlParameter("@AddTime",     SqlDbType.DateTime),
                new SqlParameter("@OverTime",    SqlDbType.DateTime),
                new SqlParameter("@ReceiveTime", SqlDbType.DateTime),
                new SqlParameter("@GoodsCounts", SqlDbType.Int,        4),
                new SqlParameter("@Statue",      SqlDbType.Int,        4),
                new SqlParameter("@beizhu",      SqlDbType.NVarChar,  50),
                new SqlParameter("@rank",        SqlDbType.Int,        4),
                new SqlParameter("@points",      SqlDbType.Int,        4),
                new SqlParameter("@AllNum",      SqlDbType.Int,        4),
                new SqlParameter("@lun",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.ID;
            parameters[1].Value  = model.GoodsName;
            parameters[2].Value  = model.Explain;
            parameters[3].Value  = model.GoodsImg;
            parameters[4].Value  = model.GoodsType;
            parameters[5].Value  = model.GoodsValue;
            parameters[6].Value  = model.GoodsNum;
            parameters[7].Value  = model.AddTime;
            parameters[8].Value  = model.OverTime;
            parameters[9].Value  = model.ReceiveTime;
            parameters[10].Value = model.GoodsCounts;
            parameters[11].Value = model.Statue;
            parameters[12].Value = model.beizhu;
            parameters[13].Value = model.rank;
            parameters[14].Value = model.points;
            parameters[15].Value = model.AllNum;
            parameters[16].Value = model.lun;

            SqlHelper.ExecuteSql(strSql.ToString(), parameters);
        }