예제 #1
0
        public static void Initialize(MyRestaurantContext context)
        {
            PaymentTypeInitializer.Initialize(context);
            UnitOfMeasureInitializer.Initialize(context);
            StockTypeInitializer.Initialize(context);
            StockItemInitializer.Initialize(context);
            SupplierInitializer.Initialize(context);
            UserInitializer.Initialize(context);
            PurchaseOrderInitializer.Initialize(context);
            PurchaseOrderItemInitializer.Initialize(context);

            if (!context.GoodsReceivedNotes.Any())
            {
                var goodsReceivedNotes = new List <GoodsReceivedNote>
                {
                    new GoodsReceivedNote {
                        PurchaseOrderId = 1,
                        InvoiceNumber   = "INV_20210132_01",
                        PaymentTypeId   = 1,
                        Nbt             = 0.5m,
                        Vat             = 0.5m,
                        Discount        = 0.5m,
                        ReceivedBy      = context.Users.First(d => d.FirstName == "Admin").Id,
                        ReceivedDate    = DateTime.Now.AddDays(-5),
                        ApprovedBy      = Guid.Empty,
                        ApprovalStatus  = Status.Pending,
                        ApprovedDate    = default,
예제 #2
0
        public static void Initialize(MyRestaurantContext context)
        {
            UserInitializer.Initialize(context);
            SupplierInitializer.Initialize(context);

            if (!context.PurchaseOrders.Any())
            {
                var orders = new List <PurchaseOrder>
                {
                    new PurchaseOrder
                    {
                        OrderNumber    = "PO_20210130_8d8c510caee6a4b",
                        SupplierId     = 1,
                        RequestedBy    = context.Users.First(d => d.FirstName == "Normal").Id,
                        RequestedDate  = DateTime.Now.AddDays(-10),
                        ApprovalStatus = Status.Approved,
                        ApprovedBy     = context.Users.First(d => d.FirstName == "Admin").Id,
                        ApprovedDate   = DateTime.Now,
                        Description    = "Test",
                        ApprovalReason = "Items are required"
                    },
                    new PurchaseOrder
                    {
                        OrderNumber    = "PO_20210130_8d8c512f7cd7920",
                        SupplierId     = 2,
                        RequestedBy    = context.Users.First(d => d.FirstName == "Admin").Id,
                        RequestedDate  = DateTime.Now.AddDays(-5),
                        ApprovalStatus = Status.Pending,
                        ApprovedBy     = Guid.Empty,
                        ApprovedDate   = default,
 public SupplierServiceTest()
 {
     SupplierInitializer.Initialize(_myRestaurantContext);
 }