Exemplo n.º 1
0
        public async Task <Models.SimpleInvoice.Company> CancelCompanyChanges(Models.SimpleInvoice.Company item)
        {
            var entityToCancel = Context.Entry(item);

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

            return(item);
        }
Exemplo n.º 2
0
        public async Task <Models.SimpleInvoice.Company> CreateCompany(Models.SimpleInvoice.Company company)
        {
            OnCompanyCreated(company);

            Context.Companies.Add(company);
            Context.SaveChanges();

            OnAfterCompanyCreated(company);

            return(company);
        }
Exemplo n.º 3
0
        protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Company args)
        {
            try
            {
                var simpleInvoiceCreateCompanyResult = await SimpleInvoice.CreateCompany(company);

                DialogService.Close(company);
            }
            catch (System.Exception simpleInvoiceCreateCompanyException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to create new Company!"
                });
            }
        }
        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();
            }
        }
Exemplo n.º 5
0
 partial void OnAfterCompanyCreated(Models.SimpleInvoice.Company item);
Exemplo n.º 6
0
        public async Task <Models.SimpleInvoice.Company> UpdateCompany(int?companyId, Models.SimpleInvoice.Company company)
        {
            OnCompanyUpdated(company);

            var itemToUpdate = Context.Companies
                               .Where(i => i.CompanyId == companyId)
                               .FirstOrDefault();

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

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

            OnAfterCompanyUpdated(company);

            return(company);
        }
Exemplo n.º 7
0
 partial void OnCompanyUpdated(Models.SimpleInvoice.Company item);
Exemplo n.º 8
0
 partial void OnCompanyGet(Models.SimpleInvoice.Company item);
        protected async System.Threading.Tasks.Task Grid0RowSelect(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Company args)
        {
            var dialogResult = await DialogService.OpenAsync <EditCompany>("Edit Company", new Dictionary <string, object>() { { "CompanyId", args.CompanyId } });

            await InvokeAsync(() => { StateHasChanged(); });
        }
Exemplo n.º 10
0
 protected async System.Threading.Tasks.Task Load()
 {
     company = new SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Company()
     {
     };
 }
        protected async System.Threading.Tasks.Task Load()
        {
            var simpleInvoiceGetCompanyByCompanyIdResult = await SimpleInvoice.GetCompanyByCompanyId(CompanyId);

            company = simpleInvoiceGetCompanyByCompanyIdResult;
        }