Пример #1
0
        private void BtnADD_Click(object sender, EventArgs e)
        {
            d.type       = cmbType.Text;
            d.name       = txtName.Text;
            d.email      = txtEmail.Text;
            d.contact    = txtContact.Text;
            d.address    = txtAddress.Text;
            d.added_date = DateTime.Now;
            //Geting Username of logged in user
            string     loggedUser = frmLogin.loggedIn;
            DeaCustBLL usr        = dal.GetIDFromUsername(loggedUser);

            d.added_by = usr.id;

            //Creatae boolean to chec if the product is added successflly or not
            bool success = dal.Insert(d);

            if (success == true)
            {
                //Product Inserted successfully
                MessageBox.Show("Data Added Successfully");
                Clear();
                DataTable dt = dal.Select();
                dgvDeaCust.DataSource = dt;
            }
            else
            {
                //Failed to ADD New Product
                MessageBox.Show("Failed to Add new Data");
                Clear();
                DataTable dt = dal.Select();
                dgvDeaCust.DataSource = dt;
            }
        }