private void InitializeDetailsList() { this.detailsList = new List<ZdBpostDetails>(); string detailsFileContent = new FileInfo(this.directoryService.DetailsLogFilePath).Read(); var lines = detailsFileContent.ToLines(); bool isNew = true; ZdBpostDetails details = null; foreach (var item in lines) { if (isNew) { if (item.Trim().IsNullOrEmpty()) continue; details = new ZdBpostDetails(); details.RecipientName = item; this.detailsList.Add(details); isNew = false; } else { details.AcceptNewItem(item); } if (item.Trim().Length == 0) isNew = true; } }
private float FillItemDetail(Excel.Worksheet xlWorkSheet,int realRowIndex,string inputDetail) { ZdBpostDetails zbpostDetails = new ZdBpostDetails(); var lines = inputDetail.ToLines(); lines.ForEach(x => zbpostDetails.AcceptNewItem(x)); for (int i = 0; i < zbpostDetails.Items.Count; i++) { var item = zbpostDetails.Items[i]; xlWorkSheet.Cells[realRowIndex, ToIndex(mapping[i][0])] = item.IntQuantity; xlWorkSheet.Cells[realRowIndex, ToIndex(mapping[i][1])] = item.IntValue * item.IntQuantity; xlWorkSheet.Cells[realRowIndex, ToIndex(mapping[i][2])] = item.Content; xlWorkSheet.Cells[realRowIndex, ToIndex(mapping[i][3])] = item.NetWeight; } return (float)Math.Round(zbpostDetails.TotalValue, 2); }