Example #1
0
        /// <summary>
        /// 得到一个订单产品对象实体
        /// </summary>
        public tbOrdersPros tbOrdersPros_GetModel(int ID)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)
            };
              parameters[0].Value = ID;

              tbOrdersPros model = new tbOrdersPros();

              DataSet ds = dbhelper.ExcuteSelectReturnDataSet("tbOrdersPros_GetModel", CommandType.StoredProcedure, 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]["OrderID"].ToString() != "")
              {
                  model.OrderID = int.Parse(ds.Tables[0].Rows[0]["OrderID"].ToString());
              }
              if (ds.Tables[0].Rows[0]["ProID"].ToString() != "")
              {
                  model.ProID = int.Parse(ds.Tables[0].Rows[0]["ProID"].ToString());
              }
              if (ds.Tables[0].Rows[0]["Discount"].ToString() != "")
              {
                  model.Discount = decimal.Parse(ds.Tables[0].Rows[0]["Discount"].ToString());
              }
              if (ds.Tables[0].Rows[0]["ProPrice"].ToString() != "")
              {
                  model.ProPrice = decimal.Parse(ds.Tables[0].Rows[0]["ProPrice"].ToString());
              }
              if (ds.Tables[0].Rows[0]["ProCount"].ToString() != "")
              {
                  model.ProCount = int.Parse(ds.Tables[0].Rows[0]["ProCount"].ToString());
              }

              return model;
              }
              else
              {
              return null;
              }
        }
Example #2
0
        /// <summary>
        ///  更新一条订单产品数据
        /// </summary>
        public int tbOrdersPros_Update(tbOrdersPros model)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4),
                    new SqlParameter("@OrderID", SqlDbType.Int,4),
                    new SqlParameter("@ProID", SqlDbType.Int,4),
                    new SqlParameter("@Discount", SqlDbType.Money,8),
                    new SqlParameter("@ProPrice", SqlDbType.Money,8),
                    new SqlParameter("@ProCount", SqlDbType.Int,4)};
              parameters[0].Value = model.ID;
              parameters[1].Value = model.OrderID;
              parameters[2].Value = model.ProID;
              parameters[3].Value = model.Discount;
              parameters[4].Value = model.ProPrice;
              parameters[5].Value = model.ProCount;

             return  dbhelper.ExcuteCommandReturnInt("tbOrdersPros_Update", CommandType.StoredProcedure, parameters);
        }
Example #3
0
        /// <summary>
        ///  增加一条订单产品数据
        /// </summary>
        public int tbOrdersPros_Add(tbOrdersPros model)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4),
                    new SqlParameter("@OrderID", SqlDbType.Int,4),
                    new SqlParameter("@ProID", SqlDbType.Int,4),
                    new SqlParameter("@Discount", SqlDbType.Money,8),
                    new SqlParameter("@ProPrice", SqlDbType.Money,8),
                    new SqlParameter("@ProCount", SqlDbType.Int,4)};
              parameters[0].Direction = ParameterDirection.Output;
              parameters[1].Value = model.OrderID;
              parameters[2].Value = model.ProID;
              parameters[3].Value = model.Discount;
              parameters[4].Value = model.ProPrice;
              parameters[5].Value = model.ProCount;

              dbhelper.ExcuteCommandReturnInt("tbOrdersPros_ADD", CommandType.StoredProcedure, parameters);

              return (int)parameters[0].Value;
        }