예제 #1
0
            public static UnitsType getUnitsElement(int unitsID, VariablesDataset ds)
            {
                DataRow[] dr = ds.Tables["units"].Select("unitsID = " + unitsID);

                if (dr.Length > 0)
                {
                    VariablesDataset.UnitsRow row = (VariablesDataset.UnitsRow)dr[0];
                    string uID        = row.UnitsID.ToString();
                    string unitType   = row.UnitsType;
                    string unitAbbrev = row.UnitsAbbreviation;
                    string unitName   = row.UnitsName;

                    UnitsType u = CuahsiBuilder.CreateUnitsElement(unitType, uID, unitAbbrev, unitName);

                    return(u);
                }
                else
                {
                    return(null);
                }
            }
        public static units getUnitsElement(int unitsID, VariablesDataset ds)
        {
            DataRow[] dr = ds.Tables["units"].Select("unitsID = " + unitsID);

            if (dr.Length > 0)
            {
                VariablesDataset.UnitsRow row = (VariablesDataset.UnitsRow)dr[0];
                string uID        = row.UnitsID.ToString();
                string unitType   = String.IsNullOrEmpty(row.UnitsType) ? null : row.UnitsType;
                string unitAbbrev = String.IsNullOrEmpty(row.UnitsAbbreviation) ? null : row.UnitsAbbreviation;
                string unitName   = String.IsNullOrEmpty(row.UnitsName) ? null : row.UnitsName;

                units u = CuahsiBuilder.CreateUnitsElement(null, uID, unitAbbrev, unitName);
                CuahsiBuilder.SetEnumFromText(u, row, "unitsType", typeof(UnitsTypeEnum));
                return(u);
            }
            else
            {
                return(null);
            }
        }