Data/销售记录.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using 收银系统.Data.模型;
using System.Data.SQLite;
using 收银系统.Data.基础;
using System.Data;
using System.Diagnostics;

namespace 收银系统.Data
{
    class 销售记录
    {
        /// <summary>
        /// 添加销售记录到数据库
        /// </summary>
        /// <param name="销售记录集">统计型集合</param>
        public bool 添加(List<销售记录型> 销售记录集)
        {
            //如果销售记录集元素数为0则返回;
            if (销售记录集.Count == 0)
            {
                return false;
            }

            List<SQLiteParameter[]> 集 = new List<SQLiteParameter[]>();

            foreach (销售记录型 item in 销售记录集)
            {

                SQLiteParameter[] params1 = {new SQLiteParameter("@1", item.单号)
                                           ,new SQLiteParameter("@2", item.商品ID)
                                           ,new SQLiteParameter("@3", item.会员ID)
                                           ,new SQLiteParameter("@4", item.条码)
                                           ,new SQLiteParameter("@5", item.名称)
                                           ,new SQLiteParameter("@6", item.单位)
                                           ,new SQLiteParameter("@7", item.进货价)
                                           ,new SQLiteParameter("@8", item.销售价)
                                           ,new SQLiteParameter("@9", item.数量)
                                           ,new SQLiteParameter("@10", item.积分小计)
                                           ,new SQLiteParameter("@11", item.类别)
                                           ,new SQLiteParameter("@12", item.类型)
                                           ,new SQLiteParameter("@13", item.销售时间)
                                           };

                集.Add(params1);

            }

            
            return Data.基础.数据库.批量执行(默认值.主数据库连接串, "INSERT INTO [销售记录]( 单号, 商品ID, 会员ID, 条码, 名称, 单位, 进货价, 销售价, 数量, 积分小计, 类别, 类型, 销售时间) VALUES( @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13);", 集);

        }

        /// <summary>
        /// 根据单号删除销售记录,如果执行后受影响数大于0则返回true;
        /// </summary>
        /// <param name="单号">用作删除条件的销售单号</param>
        public bool 删除(string 单号)
后面还有 139 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。