コード例 #1
0
    protected void btnYES_Click(object sender, EventArgs e)
    {
        Employee emp = new Employee();

        emp.LastName   = txtLName.Text;
        emp.FirstName  = txtFName.Text;
        emp.Address    = txtAddress.Text;
        emp.City       = txtCity.Text;
        emp.Country    = txtCountry.Text;
        emp.Region     = txtRegion.Text;
        emp.PostalCode = txtCode.Text;
        emp.Extension  = txtExtension.Text;
        emp.Title      = txtTitle.Text;

        EmployeeHandler empHandler = new EmployeeHandler();

        if (empHandler.AddNewEmployee(emp) == true)
        {
            Response.Redirect("Default.aspx");
        }
    }
コード例 #2
0
        private void AddEmployee()
        {
            Employee employee = new Employee();

            employee.LastName   = txtLName.Text;
            employee.FirstName  = txtFName.Text;
            employee.Title      = txtTitle.Text;
            employee.Address    = txtAddress.Text;
            employee.City       = txtCity.Text;
            employee.Region     = txtRegion.Text;
            employee.PostalCode = txtCode.Text;
            employee.Country    = txtCountry.Text;
            employee.Extension  = txtExtension.Text;

            bool result = empHandler.AddNewEmployee(employee);

            if (result == true)
            {
                Response.Redirect("Default.aspx");
            }
        }