private List <NnStock> _getStocks(string str)
        {
            List <NnStock> list = new List <NnStock>();

            string[] strs = str.Split('\n');
            foreach (var v in strs)
            {
                if (string.IsNullOrWhiteSpace(v))
                {
                    continue;
                }
                NnStock stock = new NnStock(v);
                list.Add(stock);
            }
            return(list);
        }
        private string _getSubmitFeedback(string subStr, NnStock stock, int count, StringBuilder errorstr)
        {
            string showStr = subStr.TrimEnd() + "\t---\t";

            switch (stock.State)
            {
            case NnStock.StockState.Insert:
                showStr += "添加";
                break;

            case NnStock.StockState.Update:
                showStr += "更新";
                break;

            case NnStock.StockState.Delete:
                showStr += "移除";
                break;
            }
            if (count > 0)
            {
                showStr += "成功\n";
            }
            else
            {
                switch (stock.State)
                {
                case NnStock.StockState.Insert:
                    showStr += "失败,记录已存在\n";
                    break;

                case NnStock.StockState.Update:
                    showStr += "失败,记录不存在\n";
                    break;

                case NnStock.StockState.Delete:
                    showStr += "失败,记录不存在\n";
                    break;
                }
                errorstr.Append(showStr);
            }
            return(showStr);
        }
예제 #3
0
        /// <summary>
        /// 获取库存信息
        /// </summary>
        internal NnStockInfo GetStockInfo(NnPolypeptide p)
        {
            NnStockInfo info = new NnStockInfo(p);

            try
            {
                using (OleDbCommand cmd = new OleDbCommand("SELECT * FROM history,stock_new where history.orderId = stock_new.orderId AND history.sequence=@v1", mConnection))
                {
                    cmd.Parameters.AddWithValue("v1", p.Sequence);
                    using (OleDbDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            NnStock stock = new NnStock();
                            stock.InitStockByDb(reader);
                            info.Add(stock);// 这里只添加,由stockInfo判断是否有效,决定是否添加(所以这里添加了,不一定会真添加到库存信息中)
                        }
                    }
                }
            }
            catch (Exception e) { Console.WriteLine(e.ToString()); }
            return(info);
        }