示例#1
0
        public void AddCustomerandSaleHeader()
        {
            FFREntities ffrDb = new FFREntities();

            Customer customer = new Customer();
            customer.FirstName = "Nick";
            customer.LastName = "Olsen";
            customer.City = "Parker";
            customer.State = "CO";
            customer.Zip = "80134";
            //Need to Add Street Name and Suite Fields
            customer.Address = customer.FirstName + " " + customer.LastName + "11321 Lovage Way " + customer.City + ", " + customer.State + " " + customer.Zip;
            customer.Phone = "3037181336";
            customer.Email = "*****@*****.**";

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

            SalesHeader salesHeader = new SalesHeader();

            //salesHeader.CustomerId = 1;
            salesHeader.SalesStatus = "Open";
            salesHeader.OrderSalesBalance = 50;
            salesHeader.OrderTaxAmount = 5;
            salesHeader.OrderTotal = salesHeader.OrderSalesBalance + salesHeader.OrderTaxAmount;

            ffrDb.SalesHeaders.Add(salesHeader);
            ffrDb.SaveChanges();
        }
示例#2
0
        public void UpdateItemCategory()
        {
            FFREntities ffrDb = new FFREntities();
            ItemCategory itemCategory = new ItemCategory();

            itemCategory.Category = "Update";
            itemCategory.Description = "Update";

            ffrDb.ItemCategories.Add(itemCategory);
            ffrDb.SaveChanges();

            ItemCategory updateItemCategory = (from d in ffrDb.ItemCategories where d.Category == "Update" select d).Single();
            updateItemCategory.Description = "Item Category has been updated";
            ffrDb.SaveChanges();
        }
示例#3
0
        public void UpdateSalesHeader()
        {
            FFREntities ffrDb = new FFREntities();

            SalesHeader salesHeader = new SalesHeader();
            salesHeader.CustomerId = 1;
            salesHeader.SalesStatus = "Update";
            salesHeader.OrderSalesBalance = 50;
            salesHeader.OrderTaxAmount = 5;
            salesHeader.OrderTotal = salesHeader.OrderSalesBalance + salesHeader.OrderTaxAmount;

            ffrDb.SalesHeaders.Add(salesHeader);
            ffrDb.SaveChanges();

            SalesHeader updateSalesHeader = (from d in ffrDb.SalesHeaders where d.SalesStatus == "Update" select d).Single();
            updateSalesHeader.SalesStatus = "Record has been updated!";
            ffrDb.SaveChanges();
        }
示例#4
0
        public void DeleteItemCategory()
        {
            FFREntities ffrDb = new FFREntities();
            ItemCategory itemCategory = new ItemCategory();

            itemCategory.Category = "Delete";
            itemCategory.Description = "Delete";

            ffrDb.ItemCategories.Add(itemCategory);
            ffrDb.SaveChanges();

            ItemCategory deleteItemCategory = (from d in ffrDb.ItemCategories where d.Category == "Delete" select d).Single();
            ffrDb.ItemCategories.Remove(deleteItemCategory);
            ffrDb.SaveChanges();
        }
示例#5
0
        public void DeleteSalesHeader()
        {
            FFREntities ffrDb = new FFREntities();

            SalesHeader salesHeader = new SalesHeader();
            salesHeader.SalesStatus = "Delete";
            salesHeader.OrderSalesBalance = 50;
            salesHeader.OrderTaxAmount = 5;
            salesHeader.OrderTotal = salesHeader.OrderSalesBalance + salesHeader.OrderTaxAmount;

            ffrDb.SalesHeaders.Add(salesHeader);
            ffrDb.SaveChanges();

            SalesHeader deleteSalesHeader = (from d in ffrDb.SalesHeaders where d.SalesId == 2 select d).Single();
            ffrDb.SalesHeaders.Remove(deleteSalesHeader);
            ffrDb.SaveChanges();
        }