orderpochin
This commit is contained in:
parent
69fe9ea9bc
commit
50e56467d7
@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using demo_hard.Models;
|
using demo_hard.Model;
|
||||||
|
|
||||||
namespace demo_hard;
|
namespace demo_hard;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ using Avalonia.Controls;
|
|||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
using demo_hard.Models;
|
using demo_hard.Model;
|
||||||
|
|
||||||
|
|
||||||
namespace demo_hard;
|
namespace demo_hard;
|
||||||
|
@ -7,7 +7,7 @@ using Avalonia.Controls;
|
|||||||
using Avalonia.Data.Converters;
|
using Avalonia.Data.Converters;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using demo_hard.Models;
|
using demo_hard.Model;
|
||||||
|
|
||||||
namespace demo_hard;
|
namespace demo_hard;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using demo_hard.Models;
|
using demo_hard.Model;
|
||||||
using Tmds.DBus.Protocol;
|
using Tmds.DBus.Protocol;
|
||||||
|
|
||||||
namespace demo_hard;
|
namespace demo_hard;
|
||||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
using demo_hard.Models;
|
using demo_hard.Model;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
using demo_hard.Models;
|
using demo_hard.Model;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace demo_hard.Models;
|
namespace demo_hard.Model;
|
||||||
|
|
||||||
public partial class Client
|
public partial class Client
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace demo_hard.Models;
|
namespace demo_hard.Model;
|
||||||
|
|
||||||
public partial class Employee
|
public partial class Employee
|
||||||
{
|
{
|
@ -1,19 +1,23 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace demo_hard.Models;
|
namespace demo_hard.Model;
|
||||||
|
|
||||||
public partial class Order
|
public partial class Order
|
||||||
{
|
{
|
||||||
public int OrderId { get; set; }
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
public string? OrderCode { get; set; }
|
public string? OrderCode { get; set; }
|
||||||
|
|
||||||
public TimeOnly? Time { get; set; }
|
public TimeOnly? Time { get; set; }
|
||||||
|
|
||||||
public DateOnly? EndDate { get; set; }
|
public DateOnly? EndDate { get; set; }
|
||||||
public int? RentTime { get; set; }
|
|
||||||
public DateOnly? StartDate { get; set; }
|
public DateOnly? StartDate { get; set; }
|
||||||
|
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
public string? Status { get; set; }
|
public string? Status { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<OrderService> OrderServices { get; set; } = new List<OrderService>();
|
public virtual ICollection<OrderService> OrderServices { get; set; } = new List<OrderService>();
|
||||||
public virtual ICollection<Service> Services { get; set; } = new List<Service>();
|
|
||||||
}
|
}
|
17
demo_hard/Model/OrderService.cs
Normal file
17
demo_hard/Model/OrderService.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace demo_hard.Model;
|
||||||
|
|
||||||
|
public partial class OrderService
|
||||||
|
{
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
|
public int ServiceId { get; set; }
|
||||||
|
|
||||||
|
public int RentTime { get; set; }
|
||||||
|
|
||||||
|
public virtual Order Order { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual Service Service { get; set; } = null!;
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace demo_hard.Models;
|
namespace demo_hard.Model;
|
||||||
|
|
||||||
public partial class Role
|
public partial class Role
|
||||||
{
|
{
|
@ -1,14 +1,17 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace demo_hard.Models;
|
namespace demo_hard.Model;
|
||||||
|
|
||||||
public partial class Service
|
public partial class Service
|
||||||
{
|
{
|
||||||
public string? ServiceName { get; set; }
|
public string? ServiceName { get; set; }
|
||||||
|
|
||||||
public int? CostPerHour { get; set; }
|
public int? CostPerHour { get; set; }
|
||||||
|
|
||||||
public string ServiceCode { get; set; } = null!;
|
public string ServiceCode { get; set; } = null!;
|
||||||
|
|
||||||
public int ServiceId { get; set; }
|
public int ServiceId { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<OrderService> OrderServices { get; set; } = new List<OrderService>();
|
public virtual ICollection<OrderService> OrderServices { get; set; } = new List<OrderService>();
|
||||||
public virtual ICollection<Order> Orders { get; set; } = new List<Order>();
|
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace demo_hard.Models;
|
namespace demo_hard.Model;
|
||||||
|
|
||||||
public partial class User15Context : DbContext
|
public partial class User15Context : DbContext
|
||||||
{
|
{
|
||||||
@ -16,26 +16,29 @@ public partial class User15Context : DbContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual DbSet<Client> Clients { get; set; }
|
public virtual DbSet<Client> Clients { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Employee> Employees { get; set; }
|
public virtual DbSet<Employee> Employees { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Order> Orders { get; set; }
|
public virtual DbSet<Order> Orders { get; set; }
|
||||||
public virtual DbSet<Role> Roles { get; set; }
|
|
||||||
public virtual DbSet<Service> Services { get; set; }
|
|
||||||
public virtual DbSet<OrderService> OrderServices { get; set; }
|
public virtual DbSet<OrderService> OrderServices { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Role> Roles { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Service> Services { get; set; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||||
if (!optionsBuilder.IsConfigured)
|
=> optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5421;USERNAME=user15;DATABASE=user15;Password=3XkvwMOb");
|
||||||
{
|
|
||||||
optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5421;USERNAME=user15;DATABASE=user15;Password=3XkvwMOb");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.Entity<Client>(entity =>
|
modelBuilder.Entity<Client>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.ClientId).HasName("client_pk");
|
entity.HasKey(e => e.ClientId).HasName("client_pk");
|
||||||
|
|
||||||
entity.ToTable("client");
|
entity.ToTable("client");
|
||||||
|
|
||||||
entity.HasIndex(e => e.ClientCode, "client_unique").IsUnique();
|
entity.HasIndex(e => e.ClientCode, "client_unique").IsUnique();
|
||||||
|
|
||||||
entity.Property(e => e.ClientId)
|
entity.Property(e => e.ClientId)
|
||||||
@ -64,6 +67,7 @@ public partial class User15Context : DbContext
|
|||||||
modelBuilder.Entity<Employee>(entity =>
|
modelBuilder.Entity<Employee>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.Id).HasName("employees_pk");
|
entity.HasKey(e => e.Id).HasName("employees_pk");
|
||||||
|
|
||||||
entity.ToTable("employees");
|
entity.ToTable("employees");
|
||||||
|
|
||||||
entity.Property(e => e.Id)
|
entity.Property(e => e.Id)
|
||||||
@ -93,6 +97,7 @@ public partial class User15Context : DbContext
|
|||||||
modelBuilder.Entity<Order>(entity =>
|
modelBuilder.Entity<Order>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.OrderId).HasName("orders_pk");
|
entity.HasKey(e => e.OrderId).HasName("orders_pk");
|
||||||
|
|
||||||
entity.ToTable("orders");
|
entity.ToTable("orders");
|
||||||
|
|
||||||
entity.Property(e => e.OrderId)
|
entity.Property(e => e.OrderId)
|
||||||
@ -103,21 +108,36 @@ public partial class User15Context : DbContext
|
|||||||
entity.Property(e => e.OrderCode)
|
entity.Property(e => e.OrderCode)
|
||||||
.HasColumnType("character varying")
|
.HasColumnType("character varying")
|
||||||
.HasColumnName("order_code");
|
.HasColumnName("order_code");
|
||||||
entity.Property(e => e.RentTime).HasColumnName("rent_time");
|
|
||||||
entity.Property(e => e.StartDate).HasColumnName("start_date");
|
entity.Property(e => e.StartDate).HasColumnName("start_date");
|
||||||
entity.Property(e => e.Status)
|
entity.Property(e => e.Status)
|
||||||
.HasColumnType("character varying")
|
.HasColumnType("character varying")
|
||||||
.HasColumnName("status");
|
.HasColumnName("status");
|
||||||
entity.Property(e => e.Time).HasColumnName("time");
|
entity.Property(e => e.Time).HasColumnName("time");
|
||||||
|
});
|
||||||
|
|
||||||
entity.HasMany(o => o.OrderServices)
|
modelBuilder.Entity<OrderService>(entity =>
|
||||||
.WithOne(os => os.Order)
|
{
|
||||||
.HasForeignKey(os => os.OrderId);
|
entity.HasKey(e => new { e.OrderId, e.ServiceId });
|
||||||
|
|
||||||
|
entity.ToTable("order_services");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.ServiceId, "IX_order_services_service_id");
|
||||||
|
|
||||||
|
entity.Property(e => e.OrderId).HasColumnName("order_id");
|
||||||
|
entity.Property(e => e.ServiceId).HasColumnName("service_id");
|
||||||
|
entity.Property(e => e.RentTime).HasColumnName("rent_time");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Order).WithMany(p => p.OrderServices).HasForeignKey(d => d.OrderId);
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Service).WithMany(p => p.OrderServices).HasForeignKey(d => d.ServiceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Role>(entity =>
|
modelBuilder.Entity<Role>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasNoKey().ToTable("roles");
|
entity
|
||||||
|
.HasNoKey()
|
||||||
|
.ToTable("roles");
|
||||||
|
|
||||||
entity.Property(e => e.RoleId).HasColumnName("role_id");
|
entity.Property(e => e.RoleId).HasColumnName("role_id");
|
||||||
entity.Property(e => e.RoleName)
|
entity.Property(e => e.RoleName)
|
||||||
.HasColumnType("character varying")
|
.HasColumnType("character varying")
|
||||||
@ -127,7 +147,9 @@ public partial class User15Context : DbContext
|
|||||||
modelBuilder.Entity<Service>(entity =>
|
modelBuilder.Entity<Service>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.ServiceId).HasName("services_pk");
|
entity.HasKey(e => e.ServiceId).HasName("services_pk");
|
||||||
|
|
||||||
entity.ToTable("services");
|
entity.ToTable("services");
|
||||||
|
|
||||||
entity.HasIndex(e => e.ServiceCode, "services_unique").IsUnique();
|
entity.HasIndex(e => e.ServiceCode, "services_unique").IsUnique();
|
||||||
|
|
||||||
entity.Property(e => e.ServiceId)
|
entity.Property(e => e.ServiceId)
|
||||||
@ -140,30 +162,6 @@ public partial class User15Context : DbContext
|
|||||||
entity.Property(e => e.ServiceName)
|
entity.Property(e => e.ServiceName)
|
||||||
.HasColumnType("character varying")
|
.HasColumnType("character varying")
|
||||||
.HasColumnName("service_name");
|
.HasColumnName("service_name");
|
||||||
|
|
||||||
entity.HasMany(s => s.OrderServices)
|
|
||||||
.WithOne(os => os.Service)
|
|
||||||
.HasForeignKey(os => os.ServiceId);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<OrderService>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasKey(os => new { os.OrderId, os.ServiceId });
|
|
||||||
entity.ToTable("order_services");
|
|
||||||
|
|
||||||
entity.Property(os => os.OrderId).HasColumnName("order_id");
|
|
||||||
entity.Property(os => os.ServiceId).HasColumnName("service_id");
|
|
||||||
entity.Property(os => os.RentTime).HasColumnName("rent_time");
|
|
||||||
|
|
||||||
entity.HasOne(os => os.Order)
|
|
||||||
.WithMany(o => o.OrderServices)
|
|
||||||
.HasForeignKey(os => os.OrderId)
|
|
||||||
.HasConstraintName("order_services_order_id_fkey");
|
|
||||||
|
|
||||||
entity.HasOne(os => os.Service)
|
|
||||||
.WithMany(s => s.OrderServices)
|
|
||||||
.HasForeignKey(os => os.ServiceId)
|
|
||||||
.HasConstraintName("order_services_service_id_fkey");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
OnModelCreatingPartial(modelBuilder);
|
OnModelCreatingPartial(modelBuilder);
|
@ -1,12 +0,0 @@
|
|||||||
namespace demo_hard.Models;
|
|
||||||
|
|
||||||
public class OrderService
|
|
||||||
{
|
|
||||||
public int OrderId { get; set; }
|
|
||||||
public int ServiceId { get; set; }
|
|
||||||
public int RentTime { get; set; }
|
|
||||||
|
|
||||||
public virtual Order Order { get; set; }
|
|
||||||
|
|
||||||
public virtual Service Service { get; set; }
|
|
||||||
}
|
|
@ -1,6 +1,7 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using demo_hard.Models;
|
using demo_hard.Model;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@ -8,10 +9,10 @@ namespace demo_hard;
|
|||||||
|
|
||||||
public partial class Order : Window
|
public partial class Order : Window
|
||||||
{
|
{
|
||||||
private readonly Models.Order _order;
|
private readonly Model.Order _order;
|
||||||
private readonly User15Context _db = new();
|
private readonly User15Context _db = new();
|
||||||
|
|
||||||
public Order(Models.Order order)
|
public Order(Model.Order order)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_order = order;
|
_order = order;
|
||||||
@ -21,42 +22,32 @@ public partial class Order : Window
|
|||||||
private void LoadOrderData()
|
private void LoadOrderData()
|
||||||
{
|
{
|
||||||
var client = _db.Clients.FirstOrDefault(c => c.ClientId == _order.ClientId);
|
var client = _db.Clients.FirstOrDefault(c => c.ClientId == _order.ClientId);
|
||||||
|
var orderServices = _db.OrderServices
|
||||||
|
.Include(os => os.Service)
|
||||||
|
.Where(os => os.OrderId == _order.OrderId)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
OrderNumber.Text = _order.OrderId.ToString();
|
OrderNumber.Text = _order.OrderId.ToString();
|
||||||
ClientName.Text = client?.Fio ?? "Не указан";
|
ClientName.Text = client?.Fio ?? "Не указан";
|
||||||
OrderDate.Text = $"{_order.StartDate} {_order.Time}";
|
OrderDate.Text = $"{_order.StartDate} {_order.Time}";
|
||||||
|
|
||||||
// Парсим информацию об услугах из OrderCode
|
var servicesInfo = CalculateServicesInfo(orderServices);
|
||||||
var servicesInfo = ParseServicesInfo(_order);
|
|
||||||
TotalCost.Text = servicesInfo.totalCost.ToString("C");
|
TotalCost.Text = servicesInfo.totalCost.ToString("C");
|
||||||
StatusText.Text = _order.Status ?? "Новая";
|
StatusText.Text = _order.Status ?? "Новая";
|
||||||
}
|
}
|
||||||
|
|
||||||
private (decimal totalCost, string servicesText) ParseServicesInfo(Models.Order order)
|
private (decimal totalCost, string servicesText) CalculateServicesInfo(List<OrderService> orderServices)
|
||||||
{
|
{
|
||||||
decimal total = 0;
|
decimal total = 0;
|
||||||
string info = "";
|
string info = "";
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(order.OrderCode))
|
foreach (var os in orderServices)
|
||||||
{
|
{
|
||||||
var parts = order.OrderCode.Split(';');
|
if (os.Service != null)
|
||||||
foreach (var part in parts)
|
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(part)) continue;
|
decimal cost = (os.Service.CostPerHour ?? 0) * (os.RentTime / 60m);
|
||||||
|
total += cost;
|
||||||
var serviceParts = part.Split(':');
|
info += $"{os.Service.ServiceName} - {os.RentTime} мин ({cost:C})\n";
|
||||||
if (serviceParts.Length == 2 &&
|
|
||||||
int.TryParse(serviceParts[0], out var serviceId) &&
|
|
||||||
int.TryParse(serviceParts[1], out var rentTime))
|
|
||||||
{
|
|
||||||
var service = _db.Services.Find(serviceId);
|
|
||||||
if (service != null)
|
|
||||||
{
|
|
||||||
var cost = (service.CostPerHour ?? 0) * rentTime;
|
|
||||||
total += cost;
|
|
||||||
info += $"{service.ServiceName} - {rentTime} ч ({cost:C})\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +56,11 @@ public partial class Order : Window
|
|||||||
|
|
||||||
private void PrintBarcode_Click(object sender, RoutedEventArgs e)
|
private void PrintBarcode_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
new BarcodeWindow(_order.OrderId, _order.RentTime ?? 1).Show();
|
int rentTime = _db.OrderServices
|
||||||
|
.Where(os => os.OrderId == _order.OrderId)
|
||||||
|
.Max(os => os.RentTime);
|
||||||
|
|
||||||
|
new BarcodeWindow(_order.OrderId, rentTime).Show();
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using demo_hard.Models;
|
using demo_hard.Model;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -178,13 +178,12 @@ public partial class SallerWindow : Window, INotifyPropertyChanged, IReactiveObj
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string orderNumber = $"{new Random().Next(10000000, 99999999)}/{DateTime.Now:dd.MM.yyyy}";
|
string orderNumber = $"{new Random().Next(10000000, 99999999)}/{DateTime.Now:dd.MM.yyyy}";
|
||||||
Models.Order newOrder = new Models.Order()
|
Model.Order newOrder = new Model.Order()
|
||||||
{
|
{
|
||||||
ClientId = SelectedClient.ClientId,
|
ClientId = SelectedClient.ClientId,
|
||||||
Time = TimeOnly.FromDateTime(DateTime.Now),
|
Time = TimeOnly.FromDateTime(DateTime.Now),
|
||||||
StartDate = DateOnly.FromDateTime(DateTime.Now),
|
StartDate = DateOnly.FromDateTime(DateTime.Now),
|
||||||
Status = "Новая",
|
Status = "Новая",
|
||||||
RentTime = SelectedServices.Max(service => service.RentTime),
|
|
||||||
OrderCode = orderNumber
|
OrderCode = orderNumber
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -203,7 +202,11 @@ public partial class SallerWindow : Window, INotifyPropertyChanged, IReactiveObj
|
|||||||
|
|
||||||
await _databaseContext.SaveChangesAsync();
|
await _databaseContext.SaveChangesAsync();
|
||||||
GenerateOrderPdfDocument(newOrder);
|
GenerateOrderPdfDocument(newOrder);
|
||||||
new BarcodeWindow(newOrder.OrderId, newOrder.RentTime ?? 30).Show();
|
|
||||||
|
// Получаем максимальное время аренды из выбранных услуг
|
||||||
|
int maxRentTime = SelectedServices.Max(s => s.RentTime);
|
||||||
|
new BarcodeWindow(newOrder.OrderId, maxRentTime).Show();
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@ -212,7 +215,7 @@ public partial class SallerWindow : Window, INotifyPropertyChanged, IReactiveObj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateOrderPdfDocument(Models.Order order)
|
private void GenerateOrderPdfDocument(Model.Order order)
|
||||||
{
|
{
|
||||||
string documentsDirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
string documentsDirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||||
string pdfFilePath = Path.Combine(documentsDirectoryPath, $"Заказ_{order.OrderCode.Replace("/", "_")}.pdf");
|
string pdfFilePath = Path.Combine(documentsDirectoryPath, $"Заказ_{order.OrderCode.Replace("/", "_")}.pdf");
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("demo_hard")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+156a9ed6bb53a76169eafb82e995c01d89a56817")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+69fe9ea9bc91472e247d6c5d565068a4efb0a683")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("demo_hard")]
|
[assembly: System.Reflection.AssemblyProductAttribute("demo_hard")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("demo_hard")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
812ad4f6e1371c563aeffa5b4bf990438482d87b5551f2810d09b0e13e09da16
|
b558e1c40e2637b7a5437875d3c594c1eda934e9d40f49c41e49dbf89f9df5f0
|
||||||
|
@ -1 +1 @@
|
|||||||
0bbac13ec88c23487d9db86ba7974427e4532f7c392dba1fdea7e096e6b18f90
|
8a3ffaadb0909b81ef510f10eee5bfc4b36ff8994bac3e39e3d64c1f02f66b23
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
17452753038636502
|
17453098515261366
|
@ -1 +1 @@
|
|||||||
17452753050856052
|
17453098574157962
|
Loading…
Reference in New Issue
Block a user