private void ProcessDetail(PLData source,int index,FileStream fs) { switch (source.Type) { case BusinessTypeEnum.RealizedPL: var realizedPlData = source as RealizedPLData; if (realizedPlData != null) { RealizedPlManager.Process(realizedPlData, index, fs); } break; case BusinessTypeEnum.FloatingPL: var floatingPlData = source as FloatingPLData; if (floatingPlData != null) { FloatingPlManager.Process(floatingPlData, index, fs); } break; case BusinessTypeEnum.InterestPL: case BusinessTypeEnum.StoragePL: case BusinessTypeEnum.Commission: case BusinessTypeEnum.Levy: var otherPlData = source as InterestStorageLevyCommisionPLData; if (otherPlData != null) { OtherPLManager.Process(otherPlData, index, fs); } break; default: break; } }
public void Process(PLData[] data, int startIndex,FileStream fs) { if (data == null) return; for(int i=0;i<data.Length;i++) { var source = data[i]; int index = startIndex + i; ProcessDetail(source, index,fs); } }
public static void GeneratedContent(PLData[] data, FileStream fs, int startIndex, IFlexService service, string sessionId) { string voucherType = "HVHV"; foreach (var item in data) { string line1 = MainWindowHelper.FormatString(voucherType, XmlProccessor.GetFormatString(startIndex.ToString(), false), item.TradeDay , item.CustomerCode, item.TradeDay, item.TradeDay, item.CurrencyName, Math.Abs(item.Amount), item.CurrencyRate, Math.Abs(item.Amount) * item.CurrencyRate, "D"); MainWindowHelper.WriteToFile(line1, fs, false); string line2 = MainWindowHelper.FormatString(voucherType, XmlProccessor.GetFormatString(startIndex.ToString(), false), item.TradeDay, item.AccountingCode, item.TradeDay, item.TradeDay, item.CurrencyName, Math.Abs(item.Amount), item.CurrencyRate, Math.Abs(item.Amount) * item.CurrencyRate, "C"); MainWindowHelper.WriteToFile(line2, fs, true); startIndex++; } }
protected static void CreateHelper(DataRow dr, PLData data) { data.FromMt4LoginID = dr.EscapeDBNULL<int>("MT4LoginId").ToString(); if (dr["AccountingMappingCode"] == DBNull.Value) { throw new ArgumentNullException("AccountingMappingCode"); } data.ToMt4LoginID = dr.EscapeDBNULL<int>("AccountingMappingCode").ToString(); data.CurrencyCode = dr.EscapeDBNULL<string>("AccountingCurrencyName"); if (dr["AccountingCurrencyRate"] == DBNull.Value) { throw new ArgumentNullException("AccountingCurrencyRate"); } data.ExchangeRate = (decimal)dr.EscapeDBNULL<double>("AccountingCurrencyRate"); var otherPlData = data as InterestStorageLevyCommisionPLData; if (otherPlData != null) { otherPlData.CustomerCode = dr.EscapeDBNULL<string>("CustomerCode"); otherPlData.CustomerName = dr.EscapeDBNULL<string>("CustomerDesc"); otherPlData.ProductName = dr.EscapeDBNULL<string>("ProductName"); } }