Exemple #1
0
        public void Insert(string Status, int CustomerId, int ProductId, int BranchId)
        {
            IPTEntities db = new IPTEntities();
            {
                if (db.Customers.Any(o => o.Id == CustomerId) &&
                    db.Products.Any(p => p.Id == ProductId) &&
                    db.Branches.Any(b => b.Id == BranchId))
                {
                    OrderStatu orderStatu = new OrderStatu();

                    orderStatu.Status     = Status;
                    orderStatu.CustomerId = CustomerId;
                    orderStatu.ProductId  = ProductId;
                    orderStatu.BranchId   = BranchId;

                    var db1 = new IPTEntities();
                    db1.OrderStatus.Add(orderStatu);
                    db1.SaveChanges();
                    db1.Dispose();
                }

                else
                {
                    Console.WriteLine("One of the paremeter is not in the table");
                }
            }
        }
Exemple #2
0
        public void Insert(string ProductName, String ProductWeight, String ProductPrice)
        {
            Product product = new Product();

            product.ProductName   = ProductName;
            product.ProductWeight = ProductWeight;
            product.ProductPrice  = ProductPrice;

            var db = new IPTEntities();

            db.Products.Add(product);
            db.SaveChanges();
            db.Dispose();
        }
Exemple #3
0
        public void Insert(string BranchName, String BranchManager, String BranchAddress, String BranchContact)
        {
            Branch branch = new Branch();

            branch.BranchName    = BranchName;
            branch.BranchAddress = BranchAddress;
            branch.BranchManager = BranchManager;
            branch.BranchContact = BranchContact;

            var db = new IPTEntities();

            db.Branches.Add(branch);
            db.SaveChanges();
            db.Dispose();
        }
Exemple #4
0
        public void Insert(string Name, String Address, String Email, String PhoneNumber)
        {
            Customer customer = new Customer();

            customer.Name        = Name;
            customer.Address     = Address;
            customer.Email       = Email;
            customer.PhoneNumber = PhoneNumber;

            var db = new IPTEntities();

            db.Customers.Add(customer);
            db.SaveChanges();
            db.Dispose();
        }