Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Customer customer = new Customer
            {
                Name       = txtName.Text,
                Age        = txtAge.Text,
                Email      = txtEmail.Text,
                WineID     = Convert.ToInt32(DropDownListWine.SelectedValue),
                RateListID = Convert.ToInt32(ddl_RateList.SelectedValue)
            };

            BussinessCustomer.AddCustomers(customer);
            CustomerDropDownFill();
        }
Ejemplo n.º 2
0
        private void CustomerDropDownFill()
        {
            BussinessCustomer customerMdl = new BussinessCustomer();
            List <Customer>   customers   = customerMdl.GetCustomers();

            if (customers != null && customers.Count > 0)
            {
                grd.DataSource = customers;
                grd.DataBind();
            }
            else
            {
                grd.DataSource = null;
                grd.DataBind();
            }
        }
Ejemplo n.º 3
0
        protected void DropDownListCustomer_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <Customer> customers = BussinessCustomer.CustomerDetails(DropDownListCustomer.SelectedValue);

            if (customers != null && customers.Count > 0)
            {
                for (int i = 0; i < customers.Count; i++)
                {
                    txtName.Text  = customers[i].Name;
                    txtAge.Text   = customers[i].Age;
                    txtEmail.Text = customers[i].Email;
                    DropDownListWine.SelectedValue = Convert.ToString(customers[i].WineID);
                    ddl_RateList.SelectedValue     = Convert.ToString(customers[i].RateListID);
                }
            }
        }
Ejemplo n.º 4
0
        private void CustomerDDL()
        {
            BussinessCustomer cs        = new BussinessCustomer();
            List <Customer>   customers = cs.GetCustomers();

            if (customers != null && customers.Count > 0)
            {
                for (int i = 0; i < customers.Count; i++)
                {
                    DropDownListCustomer.Items.Add(customers[i].ID.ToString());
                }
                DropDownListCustomer.Items.Insert(0, new ListItem("Select Customers", " "));
            }
            else
            {
                DropDownListCustomer.Items.Clear();
            }
        }