protected void Button1_Click(object sender, EventArgs e) { string empName = TextBox1.Text; DateTime dob = Convert.ToDateTime(TextBox2.Text); string division = TextBox3.SelectedItem.ToString(); DateTime doj = Convert.ToDateTime(TextBox7.Text); string gender = RadioButtonList1.SelectedValue; float ctc = float.Parse(TextBox5.Text); string designation = TextBox6.SelectedItem.ToString(); int unitheadId = Convert.ToInt32(DropDownList1.SelectedValue); int projectId = Convert.ToInt32(DropDownList2.SelectedValue); bool ishr = false; bool isnew = true; IEmployeeManager empMngr = new EmployeeManagerFactory().CreateEmployeeManager(); int row = empMngr.AddEmployee(empName, dob, doj, gender, division, ctc, designation, unitheadId, projectId, ishr, isnew); if (row > 0) { IUsermanager umngr = new UserManagerFactory().CreateUserManager(); umngr.AddUser(row.ToString(), "tcshyd", Convert.ToInt32(isnew)); Response.Write("<script>alert('Added successfully - EmpID : " + row + "');window.location='Home_HR.aspx'</script>"); } else { Response.Write("<script>alert('Failed')</script>"); } }