Beispiel #1
0
 public CreatedOrder CreateOrder(OrderForCreate order)
 {
     Customer customerAdd = new Customer
     {
         LastName = order.LastName,
         Name = order.Name,
         MiddleName = order.MiddleName,
         PhoneNumber = order.PhoneNumber,
         Address = order.Address,
         PassportSeries = order.PassportSeries,
         PassportNumber = order.PassportNumber,
         PassportIssuedBy = order.PassportIssuedBy,
         PassportIssuedDate = order.PassportIssuedDate,
     };
     Order orderAdd = new Order
     {
         ServiceId = order.ServiceId,
         Status = OrderStatus.Проверяется.ToString(),
         ReceiptDate = DateTime.Now,
         WorkStartDate = order.WorkStartDate.Add(order.WorkStartTime),
         WorkEndDate = order.WorkEndDate.Add(order.WorkEndTime),
         Customer = customerAdd,
     };
     _context.Orders.Create(orderAdd);
     int saveResult = _context.Save();
     if (saveResult > 0)
     {
         return new CreatedOrder
         {
             Id = orderAdd.Id,
             Date = orderAdd.WorkStartDate,
         };
     }
     return null;
 }
Beispiel #2
0
 private string GetTransportContract(string templatePath, string savePath, Order order)
 {
     ContractRentReport report = new ContractRentReport(templatePath, savePath)
     {
         City = OrganizationData.City,
         ContractStartDate = order.WorkStartDate,
         ContractEndDate = order.WorkEndDate,
         ContractNumber = order.Id,
         CostInHour = CurrencyConverter.ConvertUsd(order.Service.Cost, _serverPath + "XmlExRates.xml"),
         CountHours = CalculateHours(order.WorkStartDate, order.WorkEndDate),
         CrewCount = order.Brigade.Workers.Count,
         Date = order.ReceiptDate,
         DateBeforeEnd = order.WorkEndDate.AddDays(1),
         Fine = OrganizationData.Fine,
         LandLord = OrganizationData.OrganizationName,
         LandLordFIO = OrganizationData.DirectorFullName,
         LandLordAddress = OrganizationData.Address,
         LandLordBank = OrganizationData.BankDetails,
         LandLordPhone = OrganizationData.Phone,
         RentCost = CalculateCost(order.WorkStartDate, order.WorkEndDate, order.Service.Cost),
         Renter = string.Format("{0} {1} {2}", order.Customer.LastName, order.Customer.Name, order.Customer.MiddleName),
         RenterFIO = string.Format("{0} {1}. {2}."
             , order.Customer.LastName, order.Customer.Name.Substring(0, 1), order.Customer.MiddleName.Substring(0, 1)),
         RenterPassport = string.Format("{0} {1}", order.Customer.PassportSeries, order.Customer.PassportNumber),
         RenterPhone = order.Customer.PhoneNumber,
         TransportBodyNumber = order.Transport.BodyNumber,
         TransportEngineNumber = order.Transport.EngineNumber,
         TransportName = order.Transport.Name,
         TransportRegNumber = order.Transport.GovernNumber,
         TransportSpecialPurpose = order.Transport.SpecialPurpose,
     };
     return report.GetReport();
 }
Beispiel #3
0
 private string GetServiceContract(string templatePath, string savePath, Order order)
 {
     ContractServiceReport report = new ContractServiceReport(templatePath, savePath)
     {
         City = OrganizationData.City,
         Cost = CalculateCost(order.WorkStartDate, order.WorkEndDate, order.Service.Cost),
         Customer = string.Format("{0} {1} {2}", order.Customer.LastName, order.Customer.Name, order.Customer.MiddleName),
         CustomerInitials = string.Format("{0} {1}. {2}."
             , order.Customer.LastName, order.Customer.Name.Substring(0, 1), order.Customer.MiddleName.Substring(0, 1)),
         Date = order.ReceiptDate,
         TimeAndOrders = string.Format("разовым платежом, до {0}", order.WorkEndDate.AddDays(1).ToShortDateString()),
         StartDate = order.WorkStartDate,
         EndDate = order.WorkEndDate,
         Executor = OrganizationData.DirectorFullName,
         ExecutorInitials = OrganizationData.DirectorInitials,
         Organization = OrganizationData.OrganizationName,
         Service = order.Service.Title,
     };
     return report.GetReport();
 }
Beispiel #4
0
 private string GetTransportAct(string templatePath, string savePath, Order order)
 {
     ActRentReport report = new ActRentReport(templatePath, savePath)
     {
         City = OrganizationData.City,
         ContractDate = order.ReceiptDate,
         Date = order.WorkEndDate,
         Director = OrganizationData.DirectorInitials,
         LandLord = OrganizationData.OrganizationName,
         LandLordFIO = OrganizationData.DirectorFullName,
         Number = order.Id,
         Renter = string.Format("{0} {1} {2}", order.Customer.LastName, order.Customer.Name, order.Customer.MiddleName),
         RenterFIO = string.Format("{0} {1}. {2}."
             , order.Customer.LastName, order.Customer.Name.Substring(0, 1), order.Customer.MiddleName.Substring(0, 1)),
         TransportName = order.Transport.Name,
         TransportRegNumber = order.Transport.GovernNumber,
     };
     return report.GetReport();
 }
Beispiel #5
0
 private string GetServiceAct(string templatePath, string savePath, Order order)
 {
     ActServiceReport report = new ActServiceReport(templatePath, savePath)
     {
         ActualEndDate = order.ActualEndDate.Value,
         City = OrganizationData.City,
         ContractDate = order.ReceiptDate,
         ContractNumber = order.Id,
         Contractor = OrganizationData.OrganizationName,
         ContractorFIO = OrganizationData.DirectorInitials,
         Customer = string.Format("{0} {1} {2}", order.Customer.LastName, order.Customer.Name, order.Customer.MiddleName),
         CustomerFIO = string.Format("{0} {1}. {2}."
             , order.Customer.LastName, order.Customer.Name.Substring(0, 1), order.Customer.MiddleName.Substring(0, 1)),
         Date = order.WorkEndDate,
         Director = OrganizationData.DirectorFullName,
         EndDate = order.WorkEndDate,
         PassportIssuedBy = order.Customer.PassportIssuedBy,
         PassportIssuedDate = order.Customer.PassportIssuedDate,
         PassportNumber = order.Customer.PassportNumber,
         PassportSeries = order.Customer.PassportSeries,
         Services = order.Service.Title,
     };
     return report.GetReport();
 }