Exemplo n.º 1
0
        public static DataSet GetData
        (
            int rowId,
            int maxRows,
            string providingOrganizationName,
            string projectOrganizationName,
            string projectName,
            Utility.MinMaxDate dateProject,
            string responsibleOrganizationName,
            Utility.LatLong ll,
            string locationDescriptorContext,
            string locationDescriptorName,
            string stationType,
            string stationName,
            string samplingOrganizationName,
            Utility.MinMaxDate dateFieldEvent,
            string sampledMedia,
            string analyteName,
            string sampledTaxon,
            Common.PNWWQDXIdentity identType
        )
        {
            SqlParameter[] arParms = new SqlParameter[23];

            arParms[0]       = new SqlParameter("@rowId", SqlDbType.Int);
            arParms[0].Value = rowId;

            arParms[1]       = new SqlParameter("@maxRows", SqlDbType.Int);
            arParms[1].Value = maxRows;

            arParms[2]       = new SqlParameter("@providingOrganizationName", SqlDbType.VarChar, 80);
            arParms[2].Value = string.IsNullOrEmpty(providingOrganizationName) ? null : providingOrganizationName;

            arParms[3]       = new SqlParameter("@projectOrganizationName", SqlDbType.VarChar, 80);
            arParms[3].Value = string.IsNullOrEmpty(projectOrganizationName) ? null : projectOrganizationName;

            arParms[4]       = new SqlParameter("@projectName", SqlDbType.VarChar, 255);
            arParms[4].Value = string.IsNullOrEmpty(projectName) ? null : projectName;

            arParms[5]       = new SqlParameter("@projectStartDate", SqlDbType.DateTime);
            arParms[5].Value = dateProject.minDate.HasValue ? (object)dateProject.minDate.Value : null;

            arParms[6]       = new SqlParameter("@projectEndDate", SqlDbType.DateTime);
            arParms[6].Value = dateProject.maxDate.HasValue ? (object)dateProject.maxDate.Value : null;

            arParms[7]       = new SqlParameter("@responsibleOrganizationName", SqlDbType.VarChar, 80);
            arParms[7].Value = string.IsNullOrEmpty(responsibleOrganizationName) ? null : responsibleOrganizationName;

            arParms[8]       = new SqlParameter("@maximumLocationLatitude", SqlDbType.Decimal, 8);
            arParms[8].Value = ll.maxLat.HasValue ? (object)ll.maxLat.Value : null;

            arParms[9]       = new SqlParameter("@maximumLocationLongitude", SqlDbType.Decimal, 8);
            arParms[9].Value = ll.maxLong.HasValue ? (object)ll.maxLong.Value : null;

            arParms[10]       = new SqlParameter("@minimumLocationLatitude", SqlDbType.Decimal, 8);
            arParms[10].Value = ll.minLat.HasValue ? (object)ll.minLat.Value : null;

            arParms[11]       = new SqlParameter("@minimumLocationLongitude", SqlDbType.Decimal, 8);
            arParms[11].Value = ll.minLong.HasValue ? (object)ll.minLong.Value : null;

            arParms[12]       = new SqlParameter("@locationDescriptorContext", SqlDbType.VarChar, 100);
            arParms[12].Value = string.IsNullOrEmpty(locationDescriptorContext) ? null : locationDescriptorContext;

            arParms[13]       = new SqlParameter("@locationDescriptorName", SqlDbType.VarChar, 100);
            arParms[13].Value = string.IsNullOrEmpty(locationDescriptorName) ? null : locationDescriptorName;

            arParms[14]       = new SqlParameter("@stationType", SqlDbType.VarChar, 4000);
            arParms[14].Value = string.IsNullOrEmpty(stationType) ? null : stationType;

            arParms[15]       = new SqlParameter("@stationName", SqlDbType.VarChar, 255);
            arParms[15].Value = string.IsNullOrEmpty(stationName) ? null : stationName;

            arParms[16]       = new SqlParameter("@samplingOrganizationName", SqlDbType.VarChar, 80);
            arParms[16].Value = string.IsNullOrEmpty(samplingOrganizationName) ? null : samplingOrganizationName;

            arParms[17]       = new SqlParameter("@fieldEventStartDate", SqlDbType.DateTime);
            arParms[17].Value = dateFieldEvent.minDate.HasValue ? (object)dateFieldEvent.minDate.Value : null;

            arParms[18]       = new SqlParameter("@fieldEventEndDate", SqlDbType.DateTime);
            arParms[18].Value = dateFieldEvent.maxDate.HasValue ? (object)dateFieldEvent.maxDate.Value : null;

            arParms[19]       = new SqlParameter("@sampledMedia", SqlDbType.VarChar, 4000);
            arParms[19].Value = string.IsNullOrEmpty(sampledMedia) ? null : sampledMedia;

            arParms[20]       = new SqlParameter("@analyteName", SqlDbType.VarChar, 4000);
            arParms[20].Value = string.IsNullOrEmpty(analyteName) ? null : analyteName;

            arParms[21]       = new SqlParameter("@sampledTaxon", SqlDbType.VarChar, 4000);
            arParms[21].Value = string.IsNullOrEmpty(sampledTaxon) ? null : sampledTaxon;

            arParms[22]       = new SqlParameter("@Deliminator", SqlDbType.Char, 1);
            arParms[22].Value = Config.SQL_ARR_DELIMINATOR;

            switch (identType)
            {
            case Common.PNWWQDXIdentity.Measurements:
                return(SqlHelper.ExecuteDataset(
                           Config.connectionString,
                           CommandType.StoredProcedure,
                           "PNWWQX_GetMeasurementsData",
                           arParms));

            case Common.PNWWQDXIdentity.Project:
                return(SqlHelper.ExecuteDataset(
                           Config.connectionString,
                           CommandType.StoredProcedure,
                           "PNWWQX_GetProjectsData",
                           arParms));

            case Common.PNWWQDXIdentity.Station:
                return(SqlHelper.ExecuteDataset(
                           Config.connectionString,
                           CommandType.StoredProcedure,
                           "PNWWQX_GetStationsData",
                           arParms));

            default:
                throw new Exception("methodName not found.");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// getStations
        /// </summary>
        /// <param name="rowId"></param>
        /// <param name="maxRows"></param>
        /// <param name="responsibleOrganizationName"></param>
        /// <param name="providingOrganizationName"></param>
        /// <param name="projectName"></param>
        /// <param name="fieldEventStartDate"></param>
        /// <param name="fieldEventEndDate"></param>
        /// <param name="maximumLocationLatitude"></param>
        /// <param name="maximumLocationLongitude"></param>
        /// <param name="minimumLocationLatitude"></param>
        /// <param name="minimumLocationLongitude"></param>
        /// <param name="locationDescriptorContext"></param>
        /// <param name="locationDescriptorName"></param>
        /// <param name="stationType"></param>
        /// <param name="analyteName"></param>
        /// <returns>PNWWQXStations</returns>
        public static PNWWQXStations GetStations
        (
            int rowId,
            int maxRows,
            string providingOrganizationName,
            string projectOrganizationName,
            string projectName,
            string projectStartDate,
            string projectEndDate,
            string responsibleOrganizationName,
            string maximumLocationLatitude,
            string maximumLocationLongitude,
            string minimumLocationLatitude,
            string minimumLocationLongitude,
            string locationDescriptorContext,
            string[] locationDescriptorName,
            string[] stationType,
            string stationName,
            string samplingOrganizationName,
            string fieldEventStartDate,
            string fieldEventEndDate,
            string[] sampledMedia,
            string[] analyteName,
            string[] sampledTaxon
        )
        {
            PNWWQXStations station = new PNWWQXStations();

            //Validate Lat long
            //Do not wrap in try,catch -- validation logic build in
            Utility.LatLong ll = new Utility.LatLong(
                minimumLocationLatitude,
                minimumLocationLongitude,
                maximumLocationLatitude,
                maximumLocationLongitude);

            Utility.MinMaxDate dateProject = new Utility.MinMaxDate(
                projectStartDate,
                projectEndDate);

            Utility.MinMaxDate dateFieldEvent = new Utility.MinMaxDate(
                fieldEventStartDate,
                fieldEventEndDate);

            ArrayList returnStations = new ArrayList();

            //Get Data
            DataSet ds = PNWWQXData.GetData
                         (
                rowId,
                maxRows,
                providingOrganizationName,
                projectOrganizationName,
                projectName,
                dateProject,
                responsibleOrganizationName,
                ll,
                locationDescriptorContext,
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), locationDescriptorName),
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), stationType),
                stationName,
                samplingOrganizationName,
                dateFieldEvent,
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), sampledMedia),
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), analyteName),
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), sampledTaxon),
                Common.PNWWQDXIdentity.Station
                         );

            if ((ds == null) || (ds.Tables == null) || (ds.Tables[0] == null) || (ds.Tables[0].Rows.Count < 1))
            {
                throw new ApplicationException("Query did not return any results. Please adjust your query.");
            }

#if DEBUG
            System.Diagnostics.Debug.WriteLine("Provider Row Count: " + ds.Tables[0].Rows.Count);
            System.Diagnostics.Debug.WriteLine("Project Row Count: " + ds.Tables[1].Rows.Count);
            System.Diagnostics.Debug.WriteLine("Organization Row Count: " + ds.Tables[2].Rows.Count);
            System.Diagnostics.Debug.WriteLine("Analyte Row Count: " + ds.Tables[3].Rows.Count);
            System.Diagnostics.Debug.WriteLine("Binaries Row Count: " + ds.Tables[4].Rows.Count);
#endif

            //Load Stations
            Stations.loadStationsValues(ref returnStations, ref ds);

            //Return cased array
            station.PNWWQXStationsList = (PNWWQXStationsList[])returnStations.ToArray(typeof(PNWWQXStationsList));


            return(station);
        }
Exemplo n.º 3
0
        public static PNWWQXMeasurements GetMeasurements(
            int rowId,
            int maxRows,
            string providingOrganizationName,
            string projectOrganizationName,
            string projectName,
            string projectStartDate,
            string projectEndDate,
            string responsibleOrganizationName,
            string maximumLocationLatitude,
            string maximumLocationLongitude,
            string minimumLocationLatitude,
            string minimumLocationLongitude,
            string locationDescriptorContext,
            string[] locationDescriptorName,
            string[] stationType,
            string stationName,
            string samplingOrganizationName,
            string fieldEventStartDate,
            string fieldEventEndDate,
            string[] sampledMedia,
            string[] analyteName,
            string[] sampledTaxon
            )
        {
            PNWWQXMeasurements measurments = new PNWWQXMeasurements();

            //Validate Lat long
            //Do not wrap in try,catch -- validation logic build in
            Utility.LatLong ll = new Utility.LatLong(
                minimumLocationLatitude,
                minimumLocationLongitude,
                maximumLocationLatitude,
                maximumLocationLongitude);

            Utility.MinMaxDate dateProject = new Utility.MinMaxDate(
                projectStartDate,
                projectEndDate);

            Utility.MinMaxDate dateFieldEvent = new Utility.MinMaxDate(
                fieldEventStartDate,
                fieldEventEndDate);


            //Array Used to buld the return array
            ArrayList returnMeasurments = new ArrayList();

            //Get Data
            DataSet ds = PNWWQXData.GetData
                         (
                rowId,
                maxRows,
                providingOrganizationName,
                projectOrganizationName,
                projectName,
                dateProject,
                responsibleOrganizationName,
                ll,
                locationDescriptorContext,
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), locationDescriptorName),
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), stationType),
                stationName,
                samplingOrganizationName,
                dateFieldEvent,
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), sampledMedia),
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), analyteName),
                string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), sampledTaxon),
                Common.PNWWQDXIdentity.Measurements
                         );

#if DEBUG
            foreach (DataTable dt in ds.Tables)
            {
                System.Diagnostics.Debug.WriteLine("Table " + dt.TableName + ": " + dt.Rows.Count);
            }
#endif

            //Load Measurments
            Measurements.LoadMeasurementsValues(ref returnMeasurments, ref ds);

            //Return cased array
            measurments.PNWWQXMeasurementsList = (PNWWQXMeasurementsList[])returnMeasurments.ToArray(typeof(PNWWQXMeasurementsList));


            return(measurments);
        }
Exemplo n.º 4
0
        /// <summary>
        /// getProjects
        /// </summary>
        /// <param name="rowId"></param>
        /// <param name="maxRows"></param>
        /// <param name="providingOrganizationName"></param>
        /// <param name="projectOrganizationName"></param>
        /// <param name="samplingOrganizationName"></param>
        /// <param name="projectStartDate"></param>
        /// <param name="projectEndDate"></param>
        /// <param name="maximumLocationLatitude"></param>
        /// <param name="maximumLocationLongitude"></param>
        /// <param name="minimumLocationLatitude"></param>
        /// <param name="minimumLocationLongitude"></param>
        /// <param name="locationDescriptorContext"></param>
        /// <param name="locationDescriptorName"></param>
        /// <param name="analyteName"></param>
        /// <returns>PNWWQXProjects</returns>
        public static PNWWQXProjects GetProjects
        (
            int rowId,
            int maxRows,
            string providingOrganizationName,
            string projectOrganizationName,
            string projectName,
            string projectStartDate,
            string projectEndDate,
            string responsibleOrganizationName,
            string maximumLocationLatitude,
            string maximumLocationLongitude,
            string minimumLocationLatitude,
            string minimumLocationLongitude,
            string locationDescriptorContext,
            string[] locationDescriptorName,
            string[] stationType,
            string stationName,
            string samplingOrganizationName,
            string fieldEventStartDate,
            string fieldEventEndDate,
            string[] sampledMedia,
            string[] analyteName,
            string[] sampledTaxon
        )
        {
            try
            {
                //begin test raising user exceptions
                //SoapException SoapExcept = CreateSoapException();
                //throw SoapExcept;
                //throw new Exception("E_InvalidSQL");
                //end test

                PNWWQXProjects projects = new PNWWQXProjects();

                //Validate Lat long
                //Do not wrap in try,catch -- validation logic build in
                Utility.LatLong ll = new Utility.LatLong(
                    minimumLocationLatitude,
                    minimumLocationLongitude,
                    maximumLocationLatitude,
                    maximumLocationLongitude);

                Utility.MinMaxDate dateProject = new Utility.MinMaxDate(
                    projectStartDate,
                    projectEndDate);

                Utility.MinMaxDate dateFieldEvent = new Utility.MinMaxDate(
                    fieldEventStartDate,
                    fieldEventEndDate);

                //Array Used to buld the return array
                ArrayList returnProject = new ArrayList();

                //Get Data
                DataSet ds = PNWWQXData.GetData
                             (
                    rowId,
                    maxRows,
                    providingOrganizationName,
                    projectOrganizationName,
                    projectName,
                    dateProject,
                    responsibleOrganizationName,
                    ll,
                    locationDescriptorContext,
                    string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), locationDescriptorName),
                    string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), stationType),
                    stationName,
                    samplingOrganizationName,
                    dateFieldEvent,
                    string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), sampledMedia),
                    string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), analyteName),
                    string.Join(Config.SQL_ARR_DELIMINATOR.ToString(), sampledTaxon),
                    Common.PNWWQDXIdentity.Project
                             );

#if DEBUG
                System.Diagnostics.Debug.WriteLine("Provider Row Count: " + ds.Tables[0].Rows.Count);
                System.Diagnostics.Debug.WriteLine("Project Row Count: " + ds.Tables[1].Rows.Count);
                System.Diagnostics.Debug.WriteLine("Organization Row Count: " + ds.Tables[2].Rows.Count);
                System.Diagnostics.Debug.WriteLine("Analyte Row Count: " + ds.Tables[3].Rows.Count);
                System.Diagnostics.Debug.WriteLine("Binaries Row Count: " + ds.Tables[4].Rows.Count);
#endif

                //Load Projects
                Project.loadProjectValues(ref returnProject, ref ds);

                //Return cased array
                projects.PNWWQXProjectsList = (PNWWQXProjectsList[])returnProject.ToArray(typeof(PNWWQXProjectsList));


                return(projects);
            }
            catch (Exception)
            {
                throw;
            }
        }