/// <summary> /// Insert the report BO data into a file template of a report for customers. /// Вставка данных в шаблон отчета для заказчиков. /// </summary> /// <param name="report">report BO to insert</param> /// <param name="service">file template of report for customer</param> /// <returns>resulting file template with data</returns> private static WordService InsertIntoClientReport(Report report, WordService service) { var lotInfo = DataBaseClient.GetLotByCode(report.Code); try { service.FindReplace("[orderNumber]", lotInfo == null ? "Номер аукциона" : lotInfo.auction.number); service.FindReplace("[dealNumber]", report.Number); try { service.SetCell(1, 6, 2, lotInfo.auction.customer.company.name); var customerCode = DataBaseClient.GetSupplierCodeByCompany(lotInfo.auction.customer.company.id); if (customerCode != null) { service.SetCell(1, 7, 2, customerCode); } } catch { } service.FindReplace("[auctionDate]", report.Moment.Substring(0, report.Moment.IndexOf(" ", StringComparison.Ordinal))); service.FindReplace("[dealRegDate]", report.Moment); service.FindReplace("[lotCode]", report.Code); service.FindReplace("[productName]", report.ProductName); } catch (Exception) { } string lotSum = lotInfo != null ? $"{lotInfo.sum:C}" : "0,00"; lotSum = lotSum.Substring(0, lotSum.Length - 2); service.FindReplace("[startPrice]", lotInfo == null ? "Введите стартовую цену" : lotSum + " тенге, с учетом НДС"); service.FindReplace("[amountSum]", report.Amt); var supplierInfo = DataBaseClient.GetSupplierByBroker_Auction(report.ContrCode, lotInfo == null ? 0 : lotInfo.auctionid, lotInfo == null ? 0 : lotInfo.id); service.FindReplace("[supplierCode]", supplierInfo == null ? "Код поставщика" : supplierInfo[0]); service.FindReplace("[supplierName]", supplierInfo == null ? "Наименование поставщика" : supplierInfo[1]); service.FindReplace("[brokerCode]", report.ContrCode); switch (report.ContrCode.ToLower()) { case "altk": report.BrokerName = "ТОО Альта и К"; break; case "kord": report.BrokerName = "ТОО Корунд-777"; break; case "alta": report.BrokerName = "ТОО Альтаир Нур"; break; case "akal": report.BrokerName = "ТОО Ак Алтын Ко"; break; default: report.BrokerName = ""; break; } service.FindReplace("[brokerName]", report.BrokerName); // Change auction status try { if (lotInfo != null) { DataBaseClient.SetAuctionStatus(lotInfo.auctionid, 2); } } catch (Exception) { } return(service); }