public static int SaveQuickEmployee(EmployeeRegistartion employeeresgitration, string user) { int result; try { using (var conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { using (var cmd = new SqlCommand("sp_insert_quickEmployee", conn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("first_name", employeeresgitration.first_name); cmd.Parameters.AddWithValue("middle_name", employeeresgitration.middle_name); cmd.Parameters.AddWithValue("last_name", employeeresgitration.last_name); cmd.Parameters.AddWithValue("department_id", employeeresgitration.department_id); cmd.Parameters.AddWithValue("user_name", employeeresgitration.username); cmd.Parameters.AddWithValue("password", employeeresgitration.password); cmd.Parameters.AddWithValue("confirm_password", employeeresgitration.confirmpassword); cmd.Parameters.AddWithValue("created_by", user); cmd.Parameters.AddWithValue("dob", employeeresgitration.date_of_birth); conn.Open(); result = cmd.ExecuteNonQuery(); conn.Close(); } } return(result); }catch (Exception ex) { } return(0); }
public static bool SaveEmployeeRegistration(EmployeeRegistartion employeeRegistartion, string user) { int result = EmployeeRepository.SaveQuickEmployee(employeeRegistartion, user); if (result < 0) { return(false); } return(true); }
public static EmployeeRegistartion ConverToDomainModel(EmployeeRegistrationViewModel model) { EmployeeRegistartion employeeRegistartion = new EmployeeRegistartion(); employeeRegistartion.first_name = model.FirstName; employeeRegistartion.middle_name = model.MiddleName; employeeRegistartion.last_name = model.LastName; employeeRegistartion.username = model.UserName; employeeRegistartion.password = model.Password; employeeRegistartion.confirmpassword = model.ConfirmPassword; employeeRegistartion.department_id = model.Department; employeeRegistartion.date_of_birth = model.DateOfBirth; return(employeeRegistartion); }