⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productupdatedal.cs

📁 c#三层架构项目开发的全过程
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Model;
namespace DAL.Goods
{
  public class ProductUpdateDal
  {
      #region 通过绑定商品编号显示修改前的信息
      public List<Model.Goods.ProductModel> Getupdateshow(string  product_id)
      {
          string cmdshow = "Proupdateshow";
          SqlParameter proid = new SqlParameter("@Product_id",SqlDbType.Char,20);
          proid.Value = product_id;
          DataSet dt = new DataSet();
          SqlHelper.FillDataSet(SqlHelper.conStr, CommandType.StoredProcedure, cmdshow, dt, new string[] {}, new SqlParameter[] { proid });
          List<Model.Goods.ProductModel> li = new List<Model.Goods.ProductModel>();
          foreach (DataRow item in dt.Tables[0].Rows)
          {
           
              Model.Goods.ProductModel  mgp = new Model.Goods.ProductModel();
              mgp.product_id = item["product_id"].ToString();
              mgp.brand_id = (int)item["brand_id"];
              mgp.product_saleprice = (decimal)item["product_saleprice"];
              mgp.Product_costprice = (decimal)item["Product_costprice"];
              mgp.Product_tradeprice = (decimal)item["Product_tradeprice"];
              mgp.product_name = item["product_name"].ToString();
              li.Add(mgp);
          }
          return li;
      }
      #endregion

      #region 商品修改
      public int proupdate(string product_id,decimal product_saleprice, decimal product_costprice, decimal product_tradeprice, string product_name)
      {
          string up = "UpdateProduct";
          SqlParameter pid = new SqlParameter("@Product_id",SqlDbType.Char,20);
          pid.Value = product_id;
          SqlParameter sal = new SqlParameter("@Product_SalePrice",SqlDbType.Decimal);
          sal.Value = product_saleprice;
          SqlParameter cos = new SqlParameter("@Product_CostPrice",SqlDbType.Decimal );
          cos.Value = product_costprice;
          SqlParameter tra = new SqlParameter("@Product_TradePrice",SqlDbType.Decimal );
          tra.Value = product_tradeprice;
          SqlParameter na = new SqlParameter("@Product_Name", SqlDbType.VarChar, 30);
          na.Value = product_name;
          return SqlHelper.ExecuteNonQuery(SqlHelper.conStr, CommandType.StoredProcedure, up, new SqlParameter[] { pid, sal, cos, tra, na});
      }
      #endregion

      #region 商品删除
      public int ProductDelete(string product_id)
      {
          string com = "DeleteProduct";
          SqlParameter id = new SqlParameter("@Product_id", SqlDbType.VarChar, 10);
          id.Value = product_id;

          return SqlHelper.ExecuteNonQuery(SqlHelper.conStr, CommandType.StoredProcedure, com, new SqlParameter[] { id });
      }

      #endregion
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -