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

📄 stock_setailsdal.cs

📁 c#三层架构项目开发的全过程
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Model;
using System.Configuration;

namespace DAL.Stock
{
    public class Stock_SetailsDal
    {
        #region 添加采购明细
        /// <summary>
        /// 添加采购明细
        /// </summary>
        /// <param name="stockform_id">采购单据编号</param>
        /// <param name="Product_id">商品编号</param>
        /// <param name="stock_setails_s1">尺码1</param>
        /// <param name="stock_setails_s2">尺码2</param>
        /// <param name="stock_setails_s3">尺码3</param>
        /// <param name="stock_setails_s4">尺码4</param>
        /// <param name="stock_setails_s5">尺码5</param>
        /// <param name="stock_setails_s6">尺码6</param>
        /// <param name="stock_setails_s7">尺码7</param>
        /// <param name="stock_setails_pirce">采购商品单价</param>
        /// <param name="stock_setails_color">采购商品颜色</param>
        /// <param name="stock_setails_brand">采购商品品牌</param>
        /// <param name="stock_setails_sum">采购总数量</param>
        /// <returns></returns>
        public int AddStockLists(string stockform_id, string product_id, int stock_setails_s1, int stock_setails_s2, int stock_setails_s3, int stock_setails_s4, int stock_setails_s5, int stock_setails_s6, int stock_setails_s7, decimal stock_setails_pirce, string stock_setails_color, string stock_setails_brand, int stock_setails_sum)
        {
            string commandtext = "StockSetails_Add";
            SqlParameter id = new SqlParameter("@StockForm_id", SqlDbType.VarChar, 50);
            SqlParameter productid = new SqlParameter("@Product_id", SqlDbType.Char, 10);
            SqlParameter size1 = new SqlParameter("@Stock_Setails_s1", SqlDbType.Int);
            SqlParameter size2 = new SqlParameter("@Stock_Setails_s2", SqlDbType.Int);
            SqlParameter size3 = new SqlParameter("@Stock_Setails_s3", SqlDbType.Int);
            SqlParameter size4 = new SqlParameter("@Stock_Setails_s4", SqlDbType.Int);
            SqlParameter size5 = new SqlParameter("@Stock_Setails_s5", SqlDbType.Int);
            SqlParameter size6 = new SqlParameter("@Stock_Setails_s6", SqlDbType.Int);
            SqlParameter size7 = new SqlParameter("@Stock_Setails_s7", SqlDbType.Int);
            SqlParameter price = new SqlParameter("@Stock_Setails_TradePrice", SqlDbType.Decimal);
            SqlParameter color = new SqlParameter("@Stock_Setails_color", SqlDbType.VarChar, 10);
            SqlParameter brand = new SqlParameter("@Stock_Setails_brand", SqlDbType.VarChar, 10);
            SqlParameter sum = new SqlParameter("@Stock_Setails_sum", SqlDbType.Int);
            id.Value = stockform_id;
            productid.Value = product_id;
            size1.Value = stock_setails_s1;
            size2.Value = stock_setails_s2;
            size3.Value = stock_setails_s3;
            size4.Value = stock_setails_s4;
            size5.Value = stock_setails_s5;
            size6.Value = stock_setails_s6;
            size7.Value = stock_setails_s7;
            price.Value = stock_setails_pirce;
            color.Value = stock_setails_color;
            brand.Value = stock_setails_brand;
            sum.Value = stock_setails_sum;
            return SqlHelper.ExecuteNonQuery(SqlHelper.conStr, CommandType.StoredProcedure, commandtext, new SqlParameter[] { id, productid, size1, size2, size3, size4, size5, size6, size7, price, color, brand, sum });
        }
        #endregion

        #region 查询采购明细(按搜索条件)
        /// <summary>
        /// 查询采购明细(搜索条件)
        /// </summary>
        /// <returns></returns>
        public List<Model.Stock.Stock_SetailsModel> stocksetail()
       {
           string commandtext = "StockSetail_Select";
           DataSet ds = new DataSet();
           SqlHelper.FillDataSet(SqlHelper.conStr, CommandType.StoredProcedure, commandtext, ds, new string[] { }, null);
           List<Model.Stock.Stock_SetailsModel> li = new List<Model.Stock.Stock_SetailsModel>();
           foreach (DataRow dr in ds.Tables[0].Rows)
           {
               Model.Stock.Stock_SetailsModel inf = new Model.Stock.Stock_SetailsModel();
               inf.stockform_id = dr["StockForm_id"].ToString();
               inf.product_id = dr["Product_id"].ToString();
               inf.stock_setails_s1 = (int)dr["Stock_Setails_s1"];
               inf.stock_setails_s2 = (int)dr["Stock_Setails_s2"];
               inf.stock_setails_s3 = (int)dr["Stock_Setails_s3"];
               inf.stock_setails_s4 = (int)dr["Stock_Setails_s4"];
               inf.stock_setails_s5 = (int)dr["Stock_Setails_s5"];
               inf.stock_setails_s6 = (int)dr["Stock_Setails_s6"];
               inf.stock_setails_s7 = (int)dr["Stock_Setails_s7"];
               inf.stock_setails_tradeprice = (decimal)dr["Stock_Setails_TradePrice"];
               inf.stock_setails_color = dr["Stock_Setails_color"].ToString();
               inf.stock_setails_brand = dr["Stock_Setails_brand"].ToString().Trim();
               inf.stock_setails_sum = (int)dr["Stock_Setails_sum"];
               li.Add(inf);
           }
           return li;
       }
        #endregion

        #region 查询商品品牌
        /// <summary>
        /// 查询商品品牌
        /// </summary>
        /// <returns></returns>
        public List<Model.Stock.Stock_SetailsModel> SelectBrand()
        {
            string commandtext = "Brand_Select";
            DataSet ds = new DataSet();
            SqlHelper.FillDataSet(SqlHelper.conStr, CommandType.StoredProcedure, commandtext, ds, new string[] { }, null);
            List<Model.Stock.Stock_SetailsModel> li = new List<Model.Stock.Stock_SetailsModel>();
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                Model.Stock.Stock_SetailsModel inf = new Model.Stock.Stock_SetailsModel();
                inf.brand_Name = dr["brand_Name"].ToString().Trim ();
                li.Add(inf);
            }
            return li;
        }
        #endregion

        #region 通过采购单据编号查询采购明细
        /// <summary>
        /// 通过采购单据编号查询采购明细
       /// </summary>
       /// <param name="stockformid">采购单据编号</param>
       /// <returns></returns>
        public List<Model.Stock.Stock_SetailsModel> stocksetailbystockform(string stockformid)
        {
            string commandtext = "StockSetailByStockFormID_Select";
            SqlParameter id = new SqlParameter("@StockForm_id", SqlDbType.VarChar, 50);
            id.Value = stockformid;
            DataSet ds = new DataSet();
            SqlHelper.FillDataSet(SqlHelper.conStr, CommandType.StoredProcedure, commandtext, ds, new string[] { }, new SqlParameter[]{id});
            List<Model.Stock.Stock_SetailsModel> li = new List<Model.Stock.Stock_SetailsModel>();
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                Model.Stock.Stock_SetailsModel inf = new Model.Stock.Stock_SetailsModel();
                inf.stockform_id = dr["StockForm_id"].ToString().Trim();
                inf.product_id = dr["Product_id"].ToString();
                inf.stock_setails_s1 = (int)dr["Stock_Setails_s1"];
                inf.stock_setails_s2 = (int)dr["Stock_Setails_s2"];
                inf.stock_setails_s3 = (int)dr["Stock_Setails_s3"];
                inf.stock_setails_s4 = (int)dr["Stock_Setails_s4"];
                inf.stock_setails_s5 = (int)dr["Stock_Setails_s5"];
                inf.stock_setails_s6 = (int)dr["Stock_Setails_s6"];
                inf.stock_setails_s7 = (int)dr["Stock_Setails_s7"];
                inf.stock_setails_tradeprice = (decimal)dr["Stock_Setails_TradePrice"];
                inf.stock_setails_color = dr["Stock_Setails_color"].ToString();
                inf.stock_setails_brand = dr["Stock_Setails_brand"].ToString();
                inf.stock_setails_sum = (int)dr["Stock_Setails_sum"];
                li.Add(inf);
            }
            return li;
        }
        #endregion

        #region 通过采购单据编号删除采购明细
        /// <summary>
        /// 通过采购单据编号删除采购明细
        /// </summary>
        /// <param name="stockformid">采购单据编号</param>
        /// <returns>返回删除采购单据影响的行数</returns>
        public int StockSetailDelete(string stockformid)
        {
            string com = "StockSetail_Delete";
            SqlParameter id = new SqlParameter("@StockForm_id", SqlDbType.VarChar, 20);
            id.Value = stockformid;
            return SqlHelper.ExecuteNonQuery(SqlHelper.conStr, CommandType.StoredProcedure, com, new SqlParameter[] { id });
        }
        #endregion
    }
}

⌨️ 快捷键说明

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