예제 #1
0
        public async Task <Models.SimpleInvoice.Customer> CancelCustomerChanges(Models.SimpleInvoice.Customer item)
        {
            var entityToCancel = Context.Entry(item);

            entityToCancel.CurrentValues.SetValues(entityToCancel.OriginalValues);
            entityToCancel.State = EntityState.Unchanged;

            return(item);
        }
예제 #2
0
        public async Task <Models.SimpleInvoice.Customer> CreateCustomer(Models.SimpleInvoice.Customer customer)
        {
            OnCustomerCreated(customer);

            Context.Customers.Add(customer);
            Context.SaveChanges();

            OnAfterCustomerCreated(customer);

            return(customer);
        }
예제 #3
0
        protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Customer args)
        {
            try
            {
                var simpleInvoiceUpdateCustomerResult = await SimpleInvoice.UpdateCustomer(CustomerId, customer);

                DialogService.Close(customer);
            }
            catch (System.Exception simpleInvoiceUpdateCustomerException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to update Customer"
                });
            }
        }
        public void DataInitialization()
        {
            var company = Context.Companies.FirstOrDefault();

            if (company == null)
            {
                company             = new Models.SimpleInvoice.Company();
                company.Name        = "YourCompany, Inc.";
                company.Description = "My next great company.";
                company.Address     = "1st Pajajaran Street.";
                company.City        = "Bandung City.";

                Context.Companies.Add(company);

                var customer = new Models.SimpleInvoice.Customer();
                customer.Name        = "Default Customer";
                customer.Description = "My best loyal customer";
                customer.Address     = "1st Sudirman Street.";
                customer.City        = "Jakarta City.";

                Context.Customers.Add(customer);

                var officeBasic = new Models.SimpleInvoice.Product();
                officeBasic.Name      = "Basic, MS Office 365.";
                officeBasic.UnitPrice = 50;

                var officeStandard = new Models.SimpleInvoice.Product();
                officeStandard.Name      = "Standard, MS Office 365.";
                officeStandard.UnitPrice = 100;

                var officePremium = new Models.SimpleInvoice.Product();
                officePremium.Name      = "Premium, MS Office 365.";
                officePremium.UnitPrice = 200;

                Context.Products.AddRange(officeBasic, officeStandard, officePremium);

                var tax = new Models.SimpleInvoice.Tax();
                tax.Name = "VAT";
                tax.TaxTariffPercentage = 10;

                Context.Taxes.Add(tax);

                Context.SaveChanges();
            }
        }
예제 #5
0
        protected async System.Threading.Tasks.Task Grid0RowSelect(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Customer args)
        {
            var dialogResult = await DialogService.OpenAsync <EditCustomer>("Edit Customer", new Dictionary <string, object>() { { "CustomerId", args.CustomerId } });

            await InvokeAsync(() => { StateHasChanged(); });
        }
예제 #6
0
        protected async System.Threading.Tasks.Task Load()
        {
            var simpleInvoiceGetCustomerByCustomerIdResult = await SimpleInvoice.GetCustomerByCustomerId(CustomerId);

            customer = simpleInvoiceGetCustomerByCustomerIdResult;
        }
예제 #7
0
        public async Task <Models.SimpleInvoice.Customer> UpdateCustomer(int?customerId, Models.SimpleInvoice.Customer customer)
        {
            OnCustomerUpdated(customer);

            var itemToUpdate = Context.Customers
                               .Where(i => i.CustomerId == customerId)
                               .FirstOrDefault();

            if (itemToUpdate == null)
            {
                throw new Exception("Item no longer available");
            }
            var entryToUpdate = Context.Entry(itemToUpdate);

            entryToUpdate.CurrentValues.SetValues(customer);
            entryToUpdate.State = EntityState.Modified;
            Context.SaveChanges();

            OnAfterCustomerUpdated(customer);

            return(customer);
        }
예제 #8
0
 partial void OnAfterCustomerUpdated(Models.SimpleInvoice.Customer item);
예제 #9
0
 partial void OnCustomerGet(Models.SimpleInvoice.Customer item);
예제 #10
0
 partial void OnCustomerDeleted(Models.SimpleInvoice.Customer item);
 protected async System.Threading.Tasks.Task Load()
 {
     customer = new SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Customer()
     {
     };
 }