Example #1
0
        public void Add(Customer customer, DatabaseTypes databaseTypes)
        {
            Utility.Validate(new CustomerValidator(), customer);
            CustomerDal customerDal = new CustomerDal(databaseTypes);

            customerDal.Add(customer);
        }
Example #2
0
        static void Main(string[] args)
        {
            Customer customer = new Customer {
                firstName = "Mustafa", lastName = "Demirel", Age = 21
            };
            CustomerDal customerDal = new CustomerDal();

            customerDal.Add(customer);
            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            Customer customer = new Customer {
                Id = 1, LastName = "Kaya", Age = 32
            };
            CustomerDal customerDal = new CustomerDal();

            customerDal.Add(customer);

            Console.ReadLine();
        }
Example #4
0
 public void AddCustomer()
 {
     customerDal.Add(new Customer
     {
         CustomerID  = txt_CustomerID.Text,
         CompanyName = txt_CompanyName.Text,
         ContactName = txt_ContactName.Text,
         City        = txt_City.Text,
         Country     = txt_Country.Text,
         Orders      = null
     }
                     );
 }
Example #5
0
        static void Main(string[] args)
        {
            Customer customer1 = new Customer()
            {
                Id        = 4,
                FirstName = "Ali",
                LastName  = "Aksu",
                TcNo      = "1234567890"
            };

            Games game1 = new Games()
            {
                Id       = 3,
                GameName = "Rust",
                Price    = 29.00,
            };

            CheckManager checkManager = new CheckManager();
            CustomerDal  customerDal  = new CustomerDal();


            if (checkManager.CustomerCheck(customer1))
            {
                customerDal.Add(customer1);
            }
            else
            {
                Console.WriteLine("Birey E Devlet'te bulunamadı.");
            }


            GamesDal    gameManager = new GamesDal();
            SaleManager saleManager = new SaleManager();


            gameManager.Add(game1);

            if (saleManager.BlackFridaySale(game1, customer1))
            {
                saleManager.Sale(game1, customer1);
            }
            else if (saleManager.GameDaySale(game1, customer1))
            {
                saleManager.Sale(game1, customer1);
            }
            else
            {
                saleManager.Sale(game1, customer1);
            }
        }
Example #6
0
        private void BtnAdd_Click(object sender, EventArgs e) // Callback function
        {
            try
            {
                Customer custobj = new Customer(); // creating the object
                custobj.CustomerName = txtCustomerName.Text;
                custobj.PhoneNumber  = txtPhoneNumber.Text;
                custobj.BillAmount   = Convert.ToDecimal(txtBillAmount.Text);
                custobj.ProductId    = Convert.ToInt16(((DataRowView)cmbProduct.SelectedValue)["ProductId"]); //https://stackoverflow.com/questions/9429139/unable-to-cast-object-of-type-system-data-datarowview-to-type-system-iconvert/37696708

                if (custobj.Validate())                                                                       // thrown
                {
                    CustomerDal dal = new CustomerDal();
                    dal.Add(custobj);
                }
                LoadGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public bool Add(Customer customer)
 {
     return(_customer.Add(customer));
 }
Example #8
0
        public void Add()
        {
            CustomerDal obj = new CustomerDal();

            obj.Add(this);
        }