/// <summary> /// This method saves the employee cdetails in the database. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSave_Click(object sender, EventArgs e) { IEmployee objEmployee = EmployeeBOFactory.CreateEmployeeObject(); IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject(); ILogin objLogin = LoginBOFactory.CreateLoginObject(); try { objEmployee.FirstName = txtFirstName.Text; objEmployee.LastName = txtLastName.Text; objEmployee.RoleId = Convert.ToInt32(ddlRole.SelectedValue); objEmployee.Dob = Convert.ToDateTime(txtDOB.Text); objEmployee.Doj = Convert.ToDateTime(txtDOJ.Text); objEmployee.Address = (txtAddress.Text); objEmployee.State = Convert.ToString(ddlState.SelectedItem); objEmployee.City = Convert.ToString(ddlCity.SelectedItem); objEmployee.MobileNumber = Convert.ToInt64(txtContact.Text); bool IsAdded = objBLL.AddEmployeeDetails(objEmployee); lblMessage.Text = "Employee details saved successfully. The Employee Id is : " + objEmployee.EmployeeId; } catch (Exception ex) { lblMessage.Text = "An error occurred while saving Employee details"; } finally { objEmployee = null; objBLL = null; } clearInput(Page.Controls); }