Пример #1
0
        public List <TransitHoursRecordsDTO> GetTransitHoursRecordsByRiseId(int pIntRiseId)
        {
            List <TransitHoursRecordsDTO> lLstTransitHoursRecordsDTO = new List <TransitHoursRecordsDTO>();
            Recordset lObjRecordset = null;

            try
            {
                lObjRecordset = (Recordset)DIApplication.Company.GetBusinessObject(BoObjectTypes.BoRecordset);

                string lStrQuery = this.GetSQL("GetTransitHoursUDTByRiseId").InjectSingleValue("RiseId", pIntRiseId.ToString());

                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    for (int i = 0; i < lObjRecordset.RecordCount; i++)
                    {
                        TransitHoursRecordsDTO lObjTransitHoursRecordsDTO = new TransitHoursRecordsDTO
                        {
                            Code           = lObjRecordset.Fields.Item("Code").Value.ToString(),
                            Hrs            = double.Parse(lObjRecordset.Fields.Item("U_Hrs").Value.ToString()),
                            PrcCode        = lObjRecordset.Fields.Item("U_PrcCode").Value.ToString(),
                            IdRise         = int.Parse(lObjRecordset.Fields.Item("U_IdRise").Value.ToString()),
                            EcoNum         = lObjRecordset.Fields.Item("U_EcoNum").Value.ToString(),
                            OperatorId     = int.Parse(lObjRecordset.Fields.Item("U_Operator").Value.ToString()),
                            OperatorName   = lObjRecordset.Fields.Item("OperatorName").Value.ToString(),
                            SupervisorId   = int.Parse(lObjRecordset.Fields.Item("U_Supervisor").Value.ToString()),
                            SupervisorName = lObjRecordset.Fields.Item("SupervisorName").Value.ToString(),
                        };

                        lLstTransitHoursRecordsDTO.Add(lObjTransitHoursRecordsDTO);
                        lObjRecordset.MoveNext();
                    }
                }
            }
            catch (Exception lObjException)
            {
                LogService.WriteError(string.Format("[TransitHoursRecordsDAO - GetTransitHoursRecordsByRiseId: {0}]", lObjException.Message));
                throw new DAOException(lObjException.Message, lObjException);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }
            return(lLstTransitHoursRecordsDTO);
        }
        public List <TransitHoursRecordsDTO> DataTableToDTO(SAPbouiCOM.DataTable pObjDataTable)
        {
            List <TransitHoursRecordsDTO> lLstTransitHours = new List <TransitHoursRecordsDTO>();

            for (int i = 0; i < pObjDataTable.Rows.Count; i++)
            {
                TransitHoursRecordsDTO lObjHoursRecords = new TransitHoursRecordsDTO();

                lObjHoursRecords.Code         = pObjDataTable.GetValue("CodeTH", i).ToString();
                lObjHoursRecords.IdRise       = int.Parse(pObjDataTable.GetValue("IdRiTHrs", i).ToString());
                lObjHoursRecords.PrcCode      = pObjDataTable.GetValue("MaqTHrs", i).ToString();
                lObjHoursRecords.EcoNum       = pObjDataTable.GetValue("NumEcoTH", i).ToString();
                lObjHoursRecords.Hrs          = double.Parse(pObjDataTable.GetValue("HrsTH", i).ToString());
                lObjHoursRecords.OperatorId   = int.Parse(pObjDataTable.GetValue("OpdTH", i).ToString());
                lObjHoursRecords.OperatorName = pObjDataTable.GetValue("OpdNmTH", i).ToString();

                lLstTransitHours.Add(lObjHoursRecords);
            }

            return(lLstTransitHours);
        }