protected void btnSave_Click(object sender, EventArgs e) { EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient(); EmployeeService.EmployeeEntity employee = null; if (((EmployeeService.EmployeeType)Convert.ToInt32(ddlEmployeeType.SelectedValue)) == EmployeeService.EmployeeType.FullTimeEmployee) { employee = new EmployeeService.FullTimeEmployeeEntity() { ID = Convert.ToInt32(txtID.Text), Name = txtName.Text, Gender = txtGender.Text, DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text), Type = EmployeeService.EmployeeType.FullTimeEmployee, AnnualSalary = Convert.ToInt32(txtAnnualSalary.Text) }; client.SaveEmployee(employee); lblMessage.Text = "Employee saved"; } else if (((EmployeeService.EmployeeType)Convert.ToInt32(ddlEmployeeType.SelectedValue)) == EmployeeService.EmployeeType.PartTimeEmployee) { employee = new EmployeeService.PartTimeEmployeeEntity() { ID = Convert.ToInt32(txtID.Text), Name = txtName.Text, Gender = txtGender.Text, DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text), Type = EmployeeService.EmployeeType.PartTimeEmployee, HourlyPay = Convert.ToInt32(txtHourlyPay.Text), HoursWorked = Convert.ToInt32(txtHoursWorked.Text) }; client.SaveEmployee(employee); lblMessage.Text = "Employee saved"; } else { lblMessage.Text = "Please select Employee Type"; } }
protected void saveEmployee(object sender, EventArgs e) { EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient(); EmployeeService.Employee employee = new EmployeeService.Employee(); employee.Id = Convert.ToInt32(txtId.Text); employee.Name = txtName.Text; employee.Gender = txtGender.Text; employee.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text); client.SaveEmployee(employee); }
protected void btnSave_Click(object sender, EventArgs e) { EmployeeService.Employee employee = new EmployeeService.Employee(); employee.Id = Convert.ToInt32(txtID.Text); employee.Name = txtName.Text; EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient(); client.SaveEmployee(employee); lblMessage.Text = "Employee saved"; }
protected void btnSave_Click(object sender, EventArgs e) { EmployeeService.IEmployeeService client = new EmployeeService.EmployeeServiceClient(); if (ddlEmployeeType.SelectedValue == "-1") { lblMessage.Text = "Please select Employee Type"; } else { EmployeeService.EmployeeInfo employee = new EmployeeService.EmployeeInfo() { ID = Convert.ToInt32(txtID.Text), Name = txtName.Text, Gender = txtGender.Text, DOB = Convert.ToDateTime(txtDateOfBirth.Text), }; if (((EmployeeService.EmployeeType)Convert.ToInt32(ddlEmployeeType.SelectedValue)) == EmployeeService.EmployeeType.FullTimeEmployee) { employee.Type = EmployeeService.EmployeeType.FullTimeEmployee; employee.AnnualSalary = Convert.ToInt32(txtAnnualSalary.Text); client.SaveEmployee(employee); lblMessage.Text = "Employee saved"; } else { employee.Type = EmployeeService.EmployeeType.PartTimeEmployee; employee.HourlyPay = Convert.ToInt32(txtHourlyPay.Text); employee.HoursWorked = Convert.ToInt32(txtHoursWorked.Text); client.SaveEmployee(employee); lblMessage.Text = "Employee saved"; } } }
protected void btnSave_Click(object sender, EventArgs e) { EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient(); EmployeeService.EmployeeEntity employee = new EmployeeService.EmployeeEntity(); employee.ID = Convert.ToInt32(txtID.Text); employee.Name = txtName.Text; employee.Gender = txtGender.Text; employee.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text); client.SaveEmployee(employee); lblMessage.Text = "Employee saved"; }