/// <summary> /// Deletes the employeeType. /// </summary> /// <param name="employeeType">The employeeType.</param> /// <returns>System.String.</returns> public string DeleteEmployeeType(EmployeeTypeEntity employeeType) { const string sql = @"uspDelete_EmployeeType"; object[] parms = { "@EmployeeTypeID", employeeType.EmployeeTypeId }; return(Db.Delete(sql, true, parms)); }
private static EmployeeType ConstructEmployeeType(EmployeeTypeEntity employeeTypeEntity) { return(new EmployeeType( employeeTypeEntity.Id, employeeTypeEntity.Description )); }
/// <summary> /// Takes the specified employeeType. /// </summary> /// <param name="employeeType">The employeeType.</param> /// <returns></returns> private object[] Take(EmployeeTypeEntity employeeType) { return(new object[] { "@EmployeeTypeID", employeeType.EmployeeTypeId, "@EmployeeTypeName", employeeType.EmployeeTypeName, "@Description", employeeType.Description, "@EmployeeTypeCode", employeeType.EmployeeTypeCode, "@IsActive", employeeType.IsActive }); }
public EmployeeTypeResponse InsertEmployeeTypeConvert(EmployeeTypeEntity employeeTypeEntity) { var response = new EmployeeTypeResponse { Acknowledge = AcknowledgeType.Success }; try { if (!employeeTypeEntity.Validate()) { foreach (var error in employeeTypeEntity.ValidationErrors) { response.Message += error + Environment.NewLine; } response.Acknowledge = AcknowledgeType.Failure; return(response); } var result = EmployeeTypeDao.GetEmployeeType(employeeTypeEntity.EmployeeTypeId); if (result == null) { using (var scope = new TransactionScope()) { response.Message = EmployeeTypeDao.InsertEmployeeType(employeeTypeEntity); if (!string.IsNullOrEmpty(response.Message)) { response.Acknowledge = AcknowledgeType.Failure; return(response); } scope.Complete(); } } response.EmployeeTypeId = employeeTypeEntity.EmployeeTypeId; return(response); } catch (Exception ex) { response.Message = ex.Message; return(response); } }
/// <summary> /// Updates the employeeType. /// </summary> /// <param name="employeeType">The employeeType.</param> /// <returns></returns> public string UpdateEmployeeType(EmployeeTypeEntity employeeType) { const string sql = @"uspUpdate_EmployeeType"; return(Db.Update(sql, true, Take(employeeType))); }
/// <summary> /// Inserts the employeeType. /// </summary> /// <param name="employeeType">The employeeType.</param> /// <returns></returns> public string InsertEmployeeType(EmployeeTypeEntity employeeType) { const string sql = @"uspInsert_EmployeeType"; return(Db.Insert(sql, true, Take(employeeType))); }