public EmployeeObject GetEmployeeByEmail(string email) { EmployeeObject employee = new EmployeeObject(); QueryBuilder builder; try { builder = new QueryBuilder(); builder.Append(this.BaseQuery(false, 0)); builder.AppendWhereString(EmployeeObject.EMAIL, email, QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST_LAST); DataSet result = this.ExecuteDataSet(builder.Query, false); if (result.Tables[0].Rows.Count > 0) { employee = EmployeeConvertor.EmployeeRowToObject(result.Tables[0].Rows[0], ""); } else { return(null); } } catch (System.Exception exception1) { throw new Exception(MethodBase.GetCurrentMethod().Name, exception1); } return(employee); }
public static TaskPeopleObject TaskPeopleRowToObject(DataRow taskPeople) { TaskPeopleObject obj = new TaskPeopleObject(); try { if (taskPeople != null) { obj.TpeopID = RowFunctions.GetValueFromRowToGuid(taskPeople, TaskPeopleObject.TPEOP_ID, true, DataRowVersion.Current); obj.Employee = EmployeeConvertor.EmployeeRowToObject(taskPeople, EmployeeObject.TABLE); obj.Supplier = SupplierConvertor.SupplierRowToObject(taskPeople); obj.Customer = CustomerConvertor.CustomerRowToObject(taskPeople); obj.Unknown = UnknownConvertor.UnknownRowToObject(taskPeople); obj.Assignee = RowFunctions.GetValueFromRowToBoolean(taskPeople, TaskPeopleObject.ASSIGNEE, true, DataRowVersion.Current); obj.Reporter = RowFunctions.GetValueFromRowToBoolean(taskPeople, TaskPeopleObject.REPORTER, true, DataRowVersion.Current); obj.Task = TaskConvertor.TaskRowToObject(taskPeople); return(obj); } obj = null; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return(obj); }
public static MaintenanceObject MaintenanceRowToObject(DataRow Maintenance) { MaintenanceObject obj = new MaintenanceObject(); try { if (Maintenance != null) { if (RowFunctions.GetValueFromRowToGuid(Maintenance, MaintenanceObject.MAINT_ID, false, DataRowVersion.Current) != Guid.Empty) { obj.MaintID = RowFunctions.GetValueFromRowToGuid(Maintenance, MaintenanceObject.MAINT_ID, true, DataRowVersion.Current); //obj.Material = MaterialConvertor.MaterialRowToObject(Maintenance); //obj.MaintenanceVehicle = TIS.DL.Internal.MaintenanceVehicle.MaintenanceVehicleConvertor.MaintenanceVehicleRowToObject(Maintenance); obj.Executor = EmployeeConvertor.EmployeeRowToObject(Maintenance, ""); obj.StartMaintenance = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Maintenance, MaintenanceObject.START_MAINTENANCE, false, DataRowVersion.Current), false); obj.Remark = RowFunctions.GetValueFromRowToString(Maintenance, MaintenanceObject.REMARK, false, DataRowVersion.Current); } return(obj); } obj = null; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return(obj); }
public IEnumerable <Employee> ListEmployeesByPosition(String position) { Dictionary <String, String> dict = new Dictionary <String, String> { { ConstOfStoreProcedures.PARAM_POS_FOR_PROC_GET_EMPLOYEES_BY_POSITION, position } }; var param = SqlParametrHelper.FillSqlParametrs(dict); return(EmployeeConvertor.FromDTO(dataSetExecutor.Get(ConstOfStoreProcedures.PROC_GET_EMPLOYEES_BY_POSITION, param))); }
public void DeleteEmployee(Employee employee) { var employeeDTO = EmployeeConvertor.ToDTO(employee); Dictionary <String, Int32> dictParams = new Dictionary <String, Int32> { { ConstOfStoreProcedures.PARAM_IDEMPLOYEE_FOR_DELETE_EMPLOYEE, employeeDTO.EmployeeId }, { ConstOfStoreProcedures.PARAM_IDPOSITION_FOR_DELETE_EMPLOYEE, employeeDTO.PositionId }, { ConstOfStoreProcedures.PARAM_IDSALARY_FOR_DELETE_EMPLOYEE, employeeDTO.SalaryId } }; var param = SqlParametrHelper.FillSqlParametrs(dictParams); dataSetExecutor.InsertDelete(ConstOfStoreProcedures.PROC_DELETE_EMPLOYEE, param); }
public void InsertEmployee(Employee employee) { var employeeDTO = EmployeeConvertor.ToDTO(employee); Dictionary <String, String> dictParams = new Dictionary <String, String> { { ConstOfStoreProcedures.PARAM_NAME_FOR_PROC_INSERT_EMPLOYEE, employeeDTO.FirstName }, { ConstOfStoreProcedures.PARAM_LASTNAME_FOR_PROC_INSERT_EMPLOYEE, employeeDTO.LastName }, { ConstOfStoreProcedures.PARAM_BIRTHDAY_FOR_PROC_INSERT_EMPLOYEE, employeeDTO.Birthday }, { ConstOfStoreProcedures.PARAM_POSITION_FOR_PROC_INSERT_EMPLOYEE, employeeDTO.PositionName }, { ConstOfStoreProcedures.PARAM_SALARY_FOR_PROC_INSERT_EMPLOYEE, employeeDTO.Salary.ToString() } }; var param = SqlParametrHelper.FillSqlParametrs(dictParams); dataSetExecutor.InsertDelete(ConstOfStoreProcedures.PROC_INSERT_EMPLOYEE, param); }
public EmployeeObjectCollection GetAll() { EmployeeObjectCollection employees = new EmployeeObjectCollection(); QueryBuilder builder; try { builder = new QueryBuilder(); builder.Append(this.BaseQuery(false, 0)); builder.AppendWhereBoolean(EmployeeObject.ARCHIVE, false, QueryBuilder.ParameterLocation.FIRST_LAST); builder.AppendOrderBy(EmployeeObject.NAME, QueryBuilder.OrderByType.ASC, QueryBuilder.ParameterLocation.FIRST_LAST); employees = EmployeeConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0], ""); } catch (System.Exception exception1) { throw new Exception(MethodBase.GetCurrentMethod().Name, exception1); } return(employees); }
public static MaterialObject MaterialRowToObject(DataRow Material) { MaterialObject obj = new MaterialObject(); try { if (Material != null) { if (RowFunctions.GetValueFromRowToGuid(Material, MaterialObject.MAT_ID, false, DataRowVersion.Current) != Guid.Empty) { obj.MatID = RowFunctions.GetValueFromRowToGuid(Material, MaterialObject.MAT_ID, true, DataRowVersion.Current); obj.MaterialCategory = MaterialCategoryConvertor.MaterialCategoryRowToObject(Material, ""); obj.MaterialType = MaterialTypeConvertor.MaterialTypeRowToObject(Material, ""); obj.MaterialSubType = MaterialSubTypeConvertor.MaterialSubTypeRowToObject(Material, ""); obj.EmployeeCreator = EmployeeConvertor.EmployeeRowToObject(Material, "Creator"); obj.EmployeeResponsable = EmployeeConvertor.EmployeeRowToObject(Material, "Responsable"); obj.Vehicle = VehicleConvertor.VehicleRowToObject(Material); obj.Supplier = SupplierConvertor.SupplierRowToObject(Material); obj.Name = RowFunctions.GetValueFromRowToString(Material, MaterialObject.NAME, false, DataRowVersion.Current); obj.Description = RowFunctions.GetValueFromRowToString(Material, MaterialObject.DESCRIPTION, false, DataRowVersion.Current); obj.Type = (TIS.Framework.Common.Enumeration.Material.Type)RowFunctions.GetValueFromRowToInteger(Material, MaterialObject.TYPE, false, DataRowVersion.Current); obj.SerieNumber = RowFunctions.GetValueFromRowToString(Material, MaterialObject.SERIE_NUMBER, false, DataRowVersion.Current); obj.InternalNumber = RowFunctions.GetValueFromRowToString(Material, MaterialObject.INTERNAL_NUMBER, false, DataRowVersion.Current); obj.PurchasedOn = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Material, MaterialObject.PURCHASEDON, false, DataRowVersion.Current), false); obj.Price = RowFunctions.GetValueFromRowToDecimal(Material, MaterialObject.PRICE, false, DataRowVersion.Current); obj.NextMaintenance = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Material, MaterialObject.NEXT_MAINTENANCE, false, DataRowVersion.Current), false); obj.MaintenanceFrequency = RowFunctions.GetValueFromRowToInteger(Material, MaterialObject.MAINTENANCE_FREQUENCY, false, DataRowVersion.Current); obj.Broken = RowFunctions.GetValueFromRowToBoolean(Material, MaterialObject.BROKEN, false, DataRowVersion.Current); obj.Active = RowFunctions.GetValueFromRowToBoolean(Material, MaterialObject.ACTIVE, false, DataRowVersion.Current); } return(obj); } obj = null; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return(obj); }
public IEnumerable <Employee> ListEmployees() { return(EmployeeConvertor.FromDTO(dataSetExecutor.Get(ConstOfStoreProcedures.PROC_GET_ALL_EMPLOYEES))); }