Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int er = 0;

            if (txtName.Text == "")
            {
                er++;
                lblEMessage.Text = "Required";
            }
            if (er > 0)
            {
                return;
            }

            DAL.Country country = new DAL.Country();
            country.Name = txtName.Text;

            if (country.Insert())
            {
                btnReset_Click(null, null);
                lblMessage.Text      = "Saved";
                lblMessage.ForeColor = System.Drawing.Color.Green;
                txtName.Focus();
            }
            else
            {
                lblMessage.Text      = country.Error;
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int er = 0;

            lblEName.Text   = "";
            lblMessage.Text = "";

            if (txtName.Text == "")
            {
                er++;
                lblEName.Text = "Required";
            }

            if (er > 0)
            {
                return;
            }

            DAL.Country cnt = new DAL.Country();
            cnt.Name = txtName.Text;
            if (cnt.Insert())
            {
                lblMessage.Text      = "Country Inserted";
                lblMessage.ForeColor = System.Drawing.Color.Green;
                txtName.Text         = "";
                txtName.Focus();
            }
            else
            {
                lblMessage.Text      = cnt.Error;
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Ejemplo n.º 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(5000);
            int er = 0;

            if (txtName.Text == "")
            {
                er++;
                lblEName.Text = "Required";
            }

            if (er > 0)
            {
                return;
            }

            DAL.Country c = new DAL.Country();
            c.Name = txtName.Text;
            if (c.Insert())
            {
                btnReset_Click(null, null);
                lblMessage.Text      = "Data Saved";
                lblMessage.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lblMessage.Text      = c.Error;
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }