示例#1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            pos.EL.Registrations.Customers CustomerInfo = new pos.EL.Registrations.Customers();
            CustomerInfo.Customerid    = Convert.ToInt32(txtCustomersID.Text);
            CustomerInfo.Lastname      = txtLastName.Text;
            CustomerInfo.Firstname     = txtLastName.Text;
            CustomerInfo.Middleinitial = txtMiddleInitial.Text;
            CustomerInfo.Age           = Convert.ToInt32(txtAge.Text);
            CustomerInfo.Address       = txtAddress.Text;
            CustomerInfo.Tribe         = txtTribe.Text;


            pos.BL.Registrations.Customers CustomerBL = new pos.BL.Registrations.Customers();
            bool isSuccessfull = CustomerBL.Update(CustomerInfo);

            if (isSuccessfull)
            {
                MessageBox.Show("Record Successfully Updated!");
                loaddata();
            }
            else
            {
                MessageBox.Show("Updating Record Failed!");
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CustomerInfo.Customerid    = Convert.ToInt32(txtCustomerID.Text);
            CustomerInfo.Lastname      = txtLastName.Text;
            CustomerInfo.Firstname     = txtFirstName.Text;
            CustomerInfo.Middleinitial = txtMIddleName.Text;
            CustomerInfo.Age           = Convert.ToInt32(txtAge.Text);
            CustomerInfo.Address       = txtAddress.Text;
            CustomerInfo.Tribe         = txtTribe.Text;

            bool isSuccessfull = CustomerBL.Update(CustomerInfo);

            if (isSuccessfull)
            {
                MessageBox.Show("Record Successfully Updeted!");
                CustomerInfo           = new pos.EL.Registrations.Customers();
                dtCustomers.DataSource = CustomerBL.List(CustomerInfo);
            }
            else
            {
                MessageBox.Show("Addding Record Failed!");
            }
        }