public void btnRegister_Click(object sender, EventArgs e)
        {
            try
            {
                Person p = new Person();

                p.Name = txtName.Text;
                p.Address = txtAddress.Text;
                p.Email = txtEmail.Text;

                PersonDAL d = new PersonDAL();

                d.Insert(p); // record person

                lblMessage.Text = p.Name + "'s was registered with Success!!!";

                txtName.Text = string.Empty;
                txtAddress.Text = string.Empty;
                txtEmail.Text = string.Empty;
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Exemple #2
0
        protected void btnUpdateClient(object sender, EventArgs e)
        {
            try
            {
                Person p = new Person();

                p.Code      = Convert.ToInt32(txtCode.Text);
                p.Name      = Convert.ToString(txtName.Text);
                p.Address   = Convert.ToString(txtAddress.Text);
                p.Email     = Convert.ToString(txtEmail.Text);

                PersonDAL d = new PersonDAL();
                d.Update(p);

                lblMessage.Text = "Update was done with success!";

                txtCode.Text    = string.Empty;
                txtName.Text    = string.Empty;
                txtAddress.Text = string.Empty;
                txtEmail.Text   = string.Empty;
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Exemple #3
0
        protected void btnSearchClient(object sender, EventArgs e)
        {
            try
            {
                int Code = Convert.ToInt32(txtCode.Text);

                PersonDAL d = new PersonDAL();
                Person p = d.GetPersonCode(Code);

                if (p != null)
                {
                    pnlData.Visible     = true;
                    txtName.Text        = p.Name;
                    txtAddress.Text     = p.Address;
                    txtEmail.Text       = p.Email;
                }
                else
                {
                    lblMessage.Text = "Client not found!";

                    txtCode.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                PersonDAL d = new PersonDAL();

                gridClients.DataSource = d.List();
                gridClients.DataBind();
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Exemple #5
0
        protected void btnDeleteClient(object sender, EventArgs e)
        {
            try
            {
                int Code = Convert.ToInt32(txtCode.Text);

                Person p    = new Person();
                PersonDAL d = new PersonDAL();

                d.Delete(Code);

                lblMessage.Text = "Deleted Client!";

                txtCode.Text    = string.Empty;
                txtName.Text    = string.Empty;
                txtAddress.Text = string.Empty;
                txtEmail.Text   = string.Empty;
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }