/// <summary>
        /// Returns the data that should be placed in the JTable at the given row and column. </summary>
        /// <param name="row"> the row for which to return data. </param>
        /// <param name="col"> the column for which to return data. </param>
        /// <returns> the data that should be placed in the JTable at the given row and col. </returns>
        public virtual object getValueAt(int row, int col)
        {
            if (_sortOrder != null)
            {
                row = _sortOrder[row];
            }

            StateMod_WellRight wellr = (StateMod_WellRight)_data.get(row);

            // necessary for table models that display rights for 1+ wells so that
            // the -1st column (ID) can also be displayed.  By doing it this way,
            // code can be shared between the two kinds of table models and less
            // maintenance is necessary.
            if (!__singleWell)
            {
                col--;
            }

            switch (col)
            {
            case COL_WELL_ID:
                return(wellr.getCgoto());

            case COL_RIGHT_ID:
                return(wellr.getID());

            case COL_RIGHT_NAME:
                return(wellr.getName());

            case COL_STRUCT_ID:
                return(wellr.getCgoto());

            case COL_ADMIN_NUM:
                return(wellr.getIrtem());

            case COL_DCR_AMT:
                return(new double?(wellr.getDcrdivw()));

            case COL_ON_OFF:
                return(new int?(wellr.getSwitch()));

            case COL_PARCEL_YEAR:
                return(new int?(wellr.getParcelYear()));

            case COL_PARCEL_CLASS:
                return(new int?(wellr.getParcelMatchClass()));

            case COL_PARCEL_ID:
                return(Convert.ToInt32(wellr.getParcelID()));

            case COL_COLLECTION_TYPE:
                return(wellr.getCollectionType());

            case COL_COLLECTION_PART_TYPE:
                return(wellr.getCollectionPartType());

            case COL_COLLECTION_PART_ID:
                return(wellr.getCollectionPartId());

            case COL_COLLECTION_PART_ID_TYPE:
                return(wellr.getCollectionPartIdType());

            case COL_X_RIGHT_WDID:
                return(wellr.getXWDID());

            case COL_X_RIGHT_APPROPRIATION_DATE:
                if (wellr.getXApproDate() == null)
                {
                    return(null);
                }
                else
                {
                    DateTime dt = new DateTime(wellr.getXApproDate());
                    return(dt.ToString());
                }

            case COL_X_RIGHT_ADMIN_NUMBER:
                return(wellr.getXApproDateAdminNumber());

            case COL_X_PERMIT_RECEIPT:
                return(wellr.getXPermitReceipt());

            case COL_X_PERMIT_DATE:
                if (wellr.getXPermitDate() == null)
                {
                    return(null);
                }
                else
                {
                    DateTime dt = new DateTime(wellr.getXPermitDate());
                    return(dt.ToString());
                }

            case COL_X_PERMIT_ADMIN_NUMBER:
                return(wellr.getXPermitDateAdminNumber());

            case COL_X_WELL_YIELD_GPM:
                return(wellr.getXYieldGPM());

            case COL_X_WELL_YIELD_CFS:
                return(wellr.getXYieldGPM() * .002228);

            case COL_X_APEX_GPM:
                return(wellr.getXYieldApexGPM());

            case COL_X_APEX_CFS:
                return(wellr.getXYieldApexGPM() * .002228);

            case COL_X_WELL_FRACTION:
                return(wellr.getXFractionYield());

            case COL_X_DITCH_FRACTION:
                return(wellr.getXDitchFraction());

            case COL_X_YIELD_PRORATED_GPM:
                return(new double?(wellr.getDcrdivw() / .002228));

            default:
                return("");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Checks the data to make sure that all the data are valid. </summary>
        /// <returns> 0 if the data are valid, 1 if errors exist and -1 if non-fatal errors
        /// exist. </returns>
        private int checkInput()
        {
            string routine = "StateMod_Well_Right_JFrame.checkInput";
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_WellRight> v = (java.util.List<StateMod_WellRight>)__worksheet.getAllData();
            IList <StateMod_WellRight> v = (IList <StateMod_WellRight>)__worksheet.getAllData();

            int size = v.Count;
            StateMod_WellRight right   = null;
            string             warning = "";
            string             id;
            string             name;
            string             wellID;
            string             adminNum;
            int fatalCount = 0;

            for (int i = 0; i < size; i++)
            {
                right = (StateMod_WellRight)(v[i]);

                id       = right.getID();
                name     = right.getName();
                wellID   = right.getCgoto();
                adminNum = right.getIrtem();

                if (id.Length > 12)
                {
                    warning += "\nWell right ID (" + id + ") is "
                               + "longer than 12 characters.";
                    fatalCount++;
                }

                if (id.IndexOf(" ", StringComparison.Ordinal) > -1 || id.IndexOf("-", StringComparison.Ordinal) > -1)
                {
                    warning += "\nWell right ID (" + id + ") cannot "
                               + "contain spaces or dashes.";
                    fatalCount++;
                }

                if (name.Length > 24)
                {
                    warning += "\nWell name (" + name + ") is "
                               + "longer than 24 characters.";
                    fatalCount++;
                }

                if (wellID.Length > 12)
                {
                    warning += "\nWell ID associated with right ("
                               + wellID + ") is longer than 12 characters.";
                }

                if (!StringUtil.isDouble(adminNum))
                {
                    warning += "\nAdministration number (" + adminNum + ") is not a number.";
                    fatalCount++;
                }

                // the rest are handled by the worksheet
            }
            // REVISIT - if daily time series are supplied, check for time series
            // and allow creation if not available.
            if (warning.Length > 0)
            {
                warning += "\nCorrect or Cancel.";
                Message.printWarning(1, routine, warning, this);
                if (fatalCount > 0)
                {
                    // Fatal errors...
                    Message.printStatus(1, routine, "Returning 1 from checkInput()");
                    return(1);
                }
                else
                {         // Nonfatal errors...
                    Message.printStatus(1, routine, "Returning -1 from checkInput()");
                    return(-1);
                }
            }
            else
            {     // No errors...
                Message.printStatus(1, routine, "Returning 0 from checkInput()");
                return(0);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Returns the data that should be placed in the JTable
        /// at the given row and column. </summary>
        /// <param name="row"> the row for which to return data. </param>
        /// <param name="col"> the column for which to return data. </param>
        /// <returns> the data that should be placed in the JTable at the given row and col. </returns>
        public virtual object getValueAt(int row, int col)
        {
            if (_sortOrder != null)
            {
                row = _sortOrder[row];
            }

            StateMod_WellRight wellr = (StateMod_WellRight)_data.get(row);

            switch (col)
            {
            case COL_RIGHT_ID:
                return(wellr.getID());

            case COL_RIGHT_NAME:
                return(wellr.getName());

            case COL_STRUCT_ID:
                return(wellr.getCgoto());

            case COL_ADMIN_NUM:
                return(wellr.getIrtem());

            case COL_DCR_AMT:
                return(new double?(wellr.getDcrdivw()));

            case COL_ON_OFF:
                return(new int?(wellr.getSwitch()));

            case COL_PARCEL_YEAR:
                return(new int?(wellr.getParcelYear()));

            case COL_PARCEL_CLASS:
                return(new int?(wellr.getParcelMatchClass()));

            case COL_PARCEL_ID:
                return(wellr.getParcelID());

            case COL_COLLECTION_TYPE:
                return(wellr.getCollectionType());

            case COL_COLLECTION_PART_TYPE:
                return(wellr.getCollectionPartType());

            case COL_COLLECTION_PART_ID:
                return(wellr.getCollectionPartId());

            case COL_COLLECTION_PART_ID_TYPE:
                return(wellr.getCollectionPartIdType());

            case COL_X_RIGHT_WDID:
                return(wellr.getXWDID());

            case COL_X_RIGHT_APPROPRIATION_DATE:
                if (wellr.getXApproDate() == null)
                {
                    return(null);
                }
                else
                {
                    DateTime dt = new DateTime(wellr.getXApproDate());
                    return(dt.ToString());
                }

            case COL_X_RIGHT_ADMIN_NUMBER:
                return(wellr.getXApproDateAdminNumber());

            case COL_X_RIGHT_USE:
                return(wellr.getXUse());

            case COL_X_PERMIT_RECEIPT:
                return(wellr.getXPermitReceipt());

            case COL_X_PERMIT_DATE:
                if (wellr.getXPermitDate() == null)
                {
                    return(null);
                }
                else
                {
                    DateTime dt = new DateTime(wellr.getXPermitDate());
                    return(dt.ToString());
                }

            case COL_X_PERMIT_ADMIN_NUMBER:
                return(wellr.getXPermitDateAdminNumber());

            case COL_X_WELL_YIELD_GPM:
                return(wellr.getXYieldGPM());

            case COL_X_WELL_YIELD_CFS:
                return(wellr.getXYieldGPM() * .002228);

            case COL_X_APEX_GPM:
                return(wellr.getXYieldApexGPM());

            case COL_X_APEX_CFS:
                return(wellr.getXYieldApexGPM() * .002228);

            case COL_X_WELL_FRACTION:
                return(wellr.getXFractionYield());

            case COL_X_DITCH_FRACTION:
                return(wellr.getXDitchFraction());

            case COL_X_YIELD_PRORATED_GPM:
                return(new double?(wellr.getDcrdivw() / .002228));

            default:
                return("");
            }
        }