admin
2020-06-22 924bdf1c9fb74babf2438d5545db3594756625d1
WindowsFormsApp1/utils/DocUtil.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Data.Entity;
using System.Text;
using System.Windows.Forms;
using WindowsFormsApp1.entity;
using WindowsFormsApp1.utils;
@@ -13,7 +14,19 @@
        public static List<FirstOrderSubInfo> ydGoodsList=new List<FirstOrderSubInfo>();
        public static List<FirstOrderSubInfo> spGoodsList = new List<FirstOrderSubInfo>();
        public static void Clear() {
            ydGoodsList.Clear();
            spGoodsList.Clear();
        }
        public static void AddYDGoods(FirstOrderSubInfo info) {
            if (ydGoodsList != null && ydGoodsList.Count > 0)
            {
                if (ydGoodsList[0].LijinAmount != info.LijinAmount) {
                    MessageBox.Show("引单库的礼金面额必须一致");
                }
            }
            foreach (FirstOrderSubInfo i in ydGoodsList) {
                if (i.GoodsId == info.GoodsId)
                    return;
@@ -120,6 +133,8 @@
            if (config == null) {
                config = SQLiteDataBaseUtil.getInstance().GetConfig("sdlj_doc_template");
            }
            if (config == null)
                return "";
            String template = config.Value;
@@ -135,14 +150,26 @@
                    ydSt.Append("\r\n");
            }
            if (ydGoodsList.Count > 0) {
            }
            StringBuilder spSt = new StringBuilder();
            for (int i = 0; i < spGoodsList.Count; i++)
            {
                spSt.Append(sts[1].Replace("{实拍商品到手价}", spGoodsList[i].ActualPrice).Replace("{实拍商品标题}", spGoodsList[i].Title).Replace("{实拍商品链接}", spGoodsList[i].ItemUrl).Replace("{实拍商品口令}", spGoodsList[i].Tkl) + "\r\n");
                spSt.Append(sts[1].Replace("{实拍商品到手价}", spGoodsList[i].ActualPrice).Replace("{实拍商品标题}", spGoodsList[i].Title).Replace("{实拍商品链接}", spGoodsList[i].ItemUrl).Replace("{实拍商品口令}", spGoodsList[i].Tkl));
                if (i < spGoodsList.Count - 1)
                    spSt.Append("\r\n");
            }
            return template.Replace("[" + sts[0] + "]", ydSt.ToString()).Replace("[" + sts[1] + "]", spSt.ToString());
            template= template.Replace("[" + sts[0] + "]", ydSt.ToString()).Replace("[" + sts[1] + "]", spSt.ToString());
            if (ydGoodsList.Count > 0)
            {
                template = template.Replace("{引单礼金面额}", ydGoodsList[0].LijinAmount);
            }
            return template;
        }
    }
}