protected virtual IEnumerable <Tuple <string, string> > PrepareReplaceText(Order order) { if (order == null) { order = this.Entity; } var client = Model.Clients.GetById(order.ClientId); return(new[] { new Tuple <string, string>("#Дата_Передачи", DateTime.Now.ToString("D")), new Tuple <string, string>("#Дата_Выдачи", DateTime.Now.ToString("D")), new Tuple <string, string>("#Дата_Приёма", order.CreationDate.ToString("D")), new Tuple <string, string>("#Дата_Исполнения", order.ExecutionDate.ToString("D")), new Tuple <string, string>("#Цена_Заказа", $"{order.Price}₽"), new Tuple <string, string>("#Номер_Заказа", order.Id.ToString()), new Tuple <string, string>("#Статус_Заказа", _converter.Convert(order.Status, typeof(string), null, CultureInfo.CurrentCulture)?.ToString()), new Tuple <string, string>("#ФИО_Клиента", client.ToString()), new Tuple <string, string>("#Номер_Телефона_Клиента", client.PhoneNumber), new Tuple <string, string>("#ФИО_Выдающего_Приёмщика", Entity.IsCorporative ? Model.Clients.GetById(order.CorpDistributerId).ToString() : Model.Employees.GetById(order.DistributerId).ToString()), new Tuple <string, string>("#Адрес_Клиента", $"Г. {client.City}, ул. {client.Street}," + $" д. {client.House}, кв. {client.Flat}, почтовый индекс {client.ZipCode}") }); }
protected virtual IEnumerable <Tuple <string, string> > PrepareReplaceText(Order order) { return(new[] { new Tuple <string, string>("#Дата_Передачи", DateTime.Now.ToString("f")), new Tuple <string, string>("#Дата_Выдачи", DateTime.Now.ToString("f")), new Tuple <string, string>("#Дата_Приёма", order.CreationDate.ToString("f")), new Tuple <string, string>("#Дата_Исполнения", order.ExecutionDate.ToString("f")), new Tuple <string, string>("#Номер_Заказа", order.Id.ToString()), new Tuple <string, string>("#Статус_Заказа", _converter.Convert(order.Status, typeof(string), null, CultureInfo.CurrentCulture)?.ToString()), new Tuple <string, string>("#ФИО_Клиента", Model.Clients.GetById(order.ClientId).ToString()), new Tuple <string, string>("#ФИО_Выдающего_Приёмщика", Model.Employees.GetById(order.DistributerId).ToString()), new Tuple <string, string>("#ФИО_Прачечника", Model.Employees.GetById(order.WasherCourierId).ToString()), }); }
protected override IRow PrepareEntityRow(ISheet sheet, Order entity) { #region Общая информация var row = sheet.CreateRow(sheet.PhysicalNumberOfRows); row.CreateCell(0).SetCellValue(entity.Id); row.CreateCell(1).SetCellValue(entity.CreationDate.ToString("d")); row.CreateCell(2).SetCellValue(entity.ExecutionDate.ToString("d")); row.CreateCell(3).SetCellValue(entity.Price); row.CreateCell(4).SetCellValue(_statusConverter .Convert(entity.Status, typeof(string), null, CultureInfo.CurrentCulture)?.ToString()); row.CreateCell(5).SetCellValue(entity.InstancesCount); row.CreateCell(6).SetCellValue(entity.Comment); row.CreateCell(7).SetCellValue(entity.IsCorporative ? "Да" : "Нет"); #endregion row.CreateCell(8).SetCellValue(entity.ClientId); row.CreateCell(9).SetCellValue(_model.Clients.GetById(entity.ClientId).ToString()); #region Персонал row.CreateCell(10).SetCellValue(entity.ObtainerId); row.CreateCell(11).SetCellValue(entity.IsCorporative ? _model.Clients.GetById(entity.CorpObtainerId).ToString() : _model.Employees.GetById(entity.ObtainerId).ToString()); row.CreateCell(12).SetCellValue(entity.InCourierId); row.CreateCell(13).SetCellValue(_model.Employees.GetById(entity.InCourierId).ToString()); row.CreateCell(14).SetCellValue(entity.WasherCourierId); row.CreateCell(15).SetCellValue(_model.Employees.GetById(entity.WasherCourierId).ToString()); row.CreateCell(16).SetCellValue(entity.OutCourierId); row.CreateCell(17).SetCellValue(_model.Employees.GetById(entity.OutCourierId).ToString()); row.CreateCell(18).SetCellValue(entity.IsCorporative ? _model.Clients.GetById(entity.CorpDistributerId).ToString() : _model.Employees.GetById(entity.DistributerId).ToString()); #endregion row.CreateCell(19).SetCellValue(entity.InstancesCount); var clothString = string.Empty; foreach (var instance in entity.Instances) { var measure = _measureKindConverter.Convert(instance.ClothKindObj.MeasureKind, typeof(string), null, CultureInfo.CurrentCulture); clothString += $"{instance.ClothKindObj.Name}: {instance.Amount} {measure}; "; } row.CreateCell(20).SetCellValue(clothString != String.Empty ? clothString : "Нет вещей"); return(row); }