Ejemplo n.º 1
0
    public Model.tab_orders doshop_eticket(Model.tab_orders orders)
    {
        Model.tab_eticket  Modeticket;
        Model.tab_products product = new Model.tab_products();

        string items = orders.ReportContent;

        string[]      ts = items.Split(';');
        StringBuilder sb = new StringBuilder();
        string        s;
        int           index;

        for (int i = 0; i < ts.Length; i++)
        {
            sb.Append(ts[i]);
            index = ts[i].IndexOf('*');
            s     = ts[i].Substring(0, index);

            product.productID = int.Parse(s);
            product           = pb.getproducts(product);

            if (product.uplimit == "电子码")
            {
                string eticket = mketicket("MP" + s, product.productID * 10 + i);

                Modeticket              = new Model.tab_eticket();
                Modeticket.orderID      = orders.orderID;
                Modeticket.customerName = orders.customerName;
                Modeticket.productName  = product.productName;
                Modeticket.productID    = product.productID;
                Modeticket.itemnum      = ts[i].Substring(index + 1);
                Modeticket.eticket      = eticket;
                Modeticket.time         = DateTime.Now;
                eb.Add(Modeticket);

                sb.Append("|" + eticket);
            }
            sb.Append(";");
        }
        sb.Remove(sb.Length - 1, 1);

        orders.ReportContent = sb.ToString();
        return(orders);
    }