/// <summary> /// Selects all records from the Sol_Employees table. /// </summary> public virtual List <Sol_Employee> SelectAll() { using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "Sol_Employees_SelectAll")) { List <Sol_Employee> sol_EmployeeList = new List <Sol_Employee>(); while (dataReader.Read()) { Sol_Employee sol_Employee = MakeSol_Employee(dataReader); sol_EmployeeList.Add(sol_Employee); } return(sol_EmployeeList); } }
/// <summary> /// Selects all records from the Sol_Employees table by a foreign key. /// </summary> public virtual List <Sol_Employee> _SelectAllByUserId(Guid userId) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@UserId", userId) }; using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "Sol_Employees_SelectAllByUserId", parameters)) { List <Sol_Employee> sol_EmployeeList = new List <Sol_Employee>(); while (dataReader.Read()) { Sol_Employee sol_Employee = MakeSol_Employee(dataReader); sol_EmployeeList.Add(sol_Employee); } return(sol_EmployeeList); } }
/// <summary> /// Creates a new instance of the Sol_Employees class and populates it with data from the specified SqlDataReader. /// </summary> protected virtual Sol_Employee MakeSol_Employee(SqlDataReader dataReader) { Sol_Employee sol_Employee = new Sol_Employee(); sol_Employee.UserId = SqlClientUtility.GetGuid(dataReader, "UserId", Guid.Empty); sol_Employee.FirstName = SqlClientUtility.GetString(dataReader, "FirstName", String.Empty); sol_Employee.LastName = SqlClientUtility.GetString(dataReader, "LastName", String.Empty); sol_Employee.MiddleName = SqlClientUtility.GetString(dataReader, "MiddleName", String.Empty); sol_Employee.BirthDate = SqlClientUtility.GetDateTime(dataReader, "BirthDate", new DateTime(0)); sol_Employee.HireDate = SqlClientUtility.GetDateTime(dataReader, "HireDate", new DateTime(0)); sol_Employee.EmployeeNotes = SqlClientUtility.GetString(dataReader, "EmployeeNotes", String.Empty); sol_Employee.SIN = SqlClientUtility.GetString(dataReader, "SIN", String.Empty); sol_Employee.Gender = SqlClientUtility.GetByte(dataReader, "Gender", 0x00); sol_Employee.EmployeeNumber = SqlClientUtility.GetString(dataReader, "EmployeeNumber", String.Empty); sol_Employee.PayrollNumber = SqlClientUtility.GetString(dataReader, "PayrollNumber", String.Empty); sol_Employee.CompensationAmount = SqlClientUtility.GetDecimal(dataReader, "CompensationAmount", Decimal.Zero); sol_Employee.CompensationType = SqlClientUtility.GetByte(dataReader, "CompensationType", 0x00); return(sol_Employee); }
/// <summary> /// Updates a record in the Sol_Employees table. /// </summary> public virtual void Update(Sol_Employee sol_Employee) { ValidationUtility.ValidateArgument("sol_Employee", sol_Employee); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@UserId", sol_Employee.UserId), new SqlParameter("@FirstName", sol_Employee.FirstName), new SqlParameter("@LastName", sol_Employee.LastName), new SqlParameter("@MiddleName", sol_Employee.MiddleName), new SqlParameter("@BirthDate", sol_Employee.BirthDate), new SqlParameter("@HireDate", sol_Employee.HireDate), new SqlParameter("@EmployeeNotes", sol_Employee.EmployeeNotes), new SqlParameter("@SIN", sol_Employee.SIN), new SqlParameter("@Gender", sol_Employee.Gender), new SqlParameter("@EmployeeNumber", sol_Employee.EmployeeNumber), new SqlParameter("@PayrollNumber", sol_Employee.PayrollNumber), new SqlParameter("@CompensationAmount", sol_Employee.CompensationAmount), new SqlParameter("@CompensationType", sol_Employee.CompensationType) }; SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "Sol_Employees_Update", parameters); }
private void Employees_Load(object sender, EventArgs e) { if (Properties.Settings.Default.TouchOriented && !formCreated) { //toolStripButtonVirtualKb.Visible = true; OK.Height = OK.Height * 2; Cancel.Height = Cancel.Height * 2; formCreated = true; } //MessageBox.Show(); if (SirLib.Usuarios.callerModule == "Usuarios") { userName = SirLib.Usuarios.userName; userId = SirLib.Usuarios.userId; } else { userName = SirLib.UsuariosCrear.userName; userId = SirLib.UsuariosCrear.userId; } userNameTextBox.Text = userName; //sINTextBox.Text = SirLib.Usuarios.userId.ToString(); sol_Employee_Sp = new Sol_Employee_Sp(Properties.Settings.Default.WsirConnectionString); sol_Employee = sol_Employee_Sp.Select(userId); if (sol_Employee == null) { newUser = true; sol_Employee = new Sol_Employee(); firstNameTextBox.Text = String.Empty; lastNameTextBox.Text = String.Empty; middleNameTextBox.Text = String.Empty; birthDateDateTimePicker.Value = Main.rc.FechaActual; hireDateDateTimePicker.Value = Main.rc.FechaActual; employeeNotesTextBox.Text = String.Empty; sINTextBox.Text = String.Empty; employeeNumberTextBox.Text = String.Empty; payrollNumberTextBox.Text = String.Empty; compensationAmountTextBox.Text = String.Empty; compensationTypeComboBox.SelectedIndex = 0; genderComboBox.SelectedIndex = 0; } else { newUser = false; //userIdTextBox; firstNameTextBox.Text = sol_Employee.FirstName; lastNameTextBox.Text = sol_Employee.LastName; middleNameTextBox.Text = sol_Employee.MiddleName; birthDateDateTimePicker.Value = sol_Employee.BirthDate; hireDateDateTimePicker.Value = sol_Employee.HireDate; employeeNotesTextBox.Text = sol_Employee.EmployeeNotes; sINTextBox.Text = sol_Employee.SIN; employeeNumberTextBox.Text = sol_Employee.EmployeeNumber; payrollNumberTextBox.Text = sol_Employee.PayrollNumber; compensationAmountTextBox.Text = sol_Employee.CompensationAmount.ToString(); compensationTypeComboBox.SelectedIndex = sol_Employee.CompensationType; genderComboBox.SelectedIndex = sol_Employee.Gender; } }