Ejemplo n.º 1
0
        public int Update(ProductPriceRangeInfo oParam)
        {
            string sql = @"Update product_price_range
                            set RangeID=@RangeID,RangeName=@RangeName,RangeFrom=@RangeFrom,RangeTo=@RangeTo
                            where SysNo=@SysNo";

            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4);
            SqlParameter paramRangeID = new SqlParameter("@RangeID", SqlDbType.Int,4);
            SqlParameter paramRangeName = new SqlParameter("@RangeName", SqlDbType.NVarChar,100);
            SqlParameter paramRangeFrom = new SqlParameter("@RangeFrom", SqlDbType.Int,4);
            SqlParameter paramRangeTo = new SqlParameter("@RangeTo", SqlDbType.Int,4);

            if(oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;

            if(oParam.RangeID != AppConst.IntNull)
                paramRangeID.Value = oParam.RangeID;
            else
                paramRangeID.Value = System.DBNull.Value;

            if(oParam.RangeName != AppConst.StringNull)
                paramRangeName.Value = oParam.RangeName;
            else
                paramRangeName.Value = System.DBNull.Value;

            if(oParam.RangeFrom != AppConst.IntNull)
                paramRangeFrom.Value = oParam.RangeFrom;
            else
                paramRangeFrom.Value = System.DBNull.Value;

            if(oParam.RangeTo != AppConst.IntNull)
                paramRangeTo.Value = oParam.RangeTo;
            else
                paramRangeTo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramRangeID);
            cmd.Parameters.Add(paramRangeName);
            cmd.Parameters.Add(paramRangeFrom);
            cmd.Parameters.Add(paramRangeTo);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Ejemplo n.º 2
0
        public int Insert(ProductPriceRangeInfo oParam)
        {
            string sql = @"INSERT INTO product_price_range
                            (
                            RangeID,RangeName,RangeFrom,RangeTo
                            )
                            VALUES (
                            @RangeID,@RangeName,@RangeFrom,@RangeTo
                            )";

            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramRangeID = new SqlParameter("@RangeID", SqlDbType.Int,4);
            SqlParameter paramRangeName = new SqlParameter("@RangeName", SqlDbType.NVarChar,100);
            SqlParameter paramRangeFrom = new SqlParameter("@RangeFrom", SqlDbType.Int,4);
            SqlParameter paramRangeTo = new SqlParameter("@RangeTo", SqlDbType.Int,4);

            if(oParam.RangeID != AppConst.IntNull)
                paramRangeID.Value = oParam.RangeID;
            else
                paramRangeID.Value = System.DBNull.Value;

            if(oParam.RangeName != AppConst.StringNull)
                paramRangeName.Value = oParam.RangeName;
            else
                paramRangeName.Value = System.DBNull.Value;

            if(oParam.RangeFrom != AppConst.IntNull)
                paramRangeFrom.Value = oParam.RangeFrom;
            else
                paramRangeFrom.Value = System.DBNull.Value;

            if(oParam.RangeTo != AppConst.IntNull)
                paramRangeTo.Value = oParam.RangeTo;
            else
                paramRangeTo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramRangeID);
            cmd.Parameters.Add(paramRangeName);
            cmd.Parameters.Add(paramRangeFrom);
            cmd.Parameters.Add(paramRangeTo);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Ejemplo n.º 3
0
 public ProductPriceRangeInfo LoadPriceRange(int sysno)
 {
     string sql = "select sysno,rangeid,rangename,rangefrom,rangeto from product_price_range where sysno=" + sysno.ToString();
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     ProductPriceRangeInfo ppr = new ProductPriceRangeInfo();
     if (Util.HasMoreRow(ds))
     {
         mapPriceRange(ppr, ds.Tables[0].Rows[0]);
     }
     else
     {
         ppr = null;
     }
     return ppr;
 }
Ejemplo n.º 4
0
 private void mapPriceRange(ProductPriceRangeInfo oParam, DataRow dr)
 {
     oParam.SysNo = int.Parse(dr["SysNo"].ToString().Trim());
     oParam.RangeID = int.Parse(dr["RangeID"].ToString().Trim());
     oParam.RangeName = dr["RangeName"].ToString().Trim();
     oParam.RangeFrom = int.Parse(dr["RangeTo"].ToString().Trim());
     oParam.RangeTo = int.Parse(dr["RangeTo"].ToString().Trim());
 }
Ejemplo n.º 5
0
        /// <summary>
        /// ȡ�����м۸�������Ϣ
        /// </summary>
        /// <returns></returns>
        public SortedList GetProductPriceRanges()
        {
            string sql = "select sysno,rangeid,rangename,rangefrom,rangeto from product_price_range order by rangeid";
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            SortedList st = new SortedList();
            if (!Util.HasMoreRow(ds))
                return st;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                ProductPriceRangeInfo ppr = new ProductPriceRangeInfo();
                mapPriceRange(ppr, dr);
                st.Add(ppr, null);
            }
            return st;
        }