日期:2014-05-17  浏览次数:20376 次

求!ASP.NET 单据开发,主、明细表功能实现
RT
功能效果如下

保存按钮  选择物品  增行 删行  
表头
单据编号:   日期:    XX

明细
序    物品名称  物品编号  数量 单价   合计金额
1     XX           XXX     1    10.00   10.00
2     XX            XX     2     8.00    16.00



跪求类似这样的单据功能实现

------解决方案--------------------
给你写一个demo,你可以自己去修改。

首先,定义好数据实体模型,例如
public class Product
{
    public string Name { get; set; }
    public decimal Price { get; set; }

    private DateTime _最后更新时间 = DateTime.Now;

    public DateTime 最后更新时间
    {
        get { return _最后更新时间; }
        set { _最后更新时间 = value; }
    }
}

public class ProductOrder
{
    public string ProductName { get; set; }
    public DateTime DateTime { get; set; }
    public string Address { get; set; }
    public int Quantiy { get; set; }
    public string Supplier { get; set; }
}


看这个实体模型,就是主从关系的。


然后,确定好业务逻辑层接口功能,例如:
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;

public static class BLL
{
    private static List<Product> ProductDatabase = new List<Product>(){ 
                new Product { Name="月亮美眉", Price=9009999},
                new Product{ Name="屋子", Price=83722323},
                new Product{ Name="一本书", Price=20}
            }