private GasEndPoint MakeInstalledCylinder(IDataReader reader, DataAccessOrdinals ordinals, DataAccessTransaction trx)
        {
            short  position   = SqlSafeGetShort(reader, ordinals["POSITION"]);
            string partNumber = SqlSafeGetString(reader, ordinals["PARTNUMBER"]);

            // Try and get the Factory Cylinder information for the part number.
            // Note that there may not be any factory cylinder info available if the
            // part number is for a new cylinder type that's unknown to to iNet.
            FactoryCylinder factoryCylinder = null;

            if (partNumber != string.Empty)
            {
                factoryCylinder = new FactoryCylinderDataAccess().FindByPartNumber(partNumber, trx);
            }

            Cylinder cylinder;

            if (factoryCylinder != null)
            {
                cylinder = new Cylinder(factoryCylinder);
            }
            else
            {
                cylinder            = new Cylinder();
                cylinder.PartNumber = partNumber;
            }

            string installationTypeString = SqlSafeGetString(reader, ordinals["INSTALLATIONTYPE"]);

            GasEndPoint.Type installationType = (GasEndPoint.Type)Enum.Parse(typeof(GasEndPoint.Type), installationTypeString, true);

            GasEndPoint gep = new GasEndPoint(cylinder, position, installationType);

            gep.Cylinder.FactoryId      = SqlSafeGetString(reader, ordinals["FACTORYID"]);
            gep.Cylinder.ExpirationDate = SqlSafeGetDate(reader, ordinals["EXPIRATIONDATE"]);
            gep.Cylinder.RefillDate     = SqlSafeGetDate(reader, ordinals["REFILLDATE"]);
            string pressure = SqlSafeGetString(reader, ordinals["PRESSURE"]);

            gep.Cylinder.Pressure = (PressureLevel)Enum.Parse(typeof(PressureLevel), pressure, true);

            return(gep);
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new instance of InstalledCylinder class when cylinder, position and install time is provided.
 /// </summary>
 /// <param name="cylinder">Cylinder</param>
 /// <param name="position">Position in which cylinder is located</param>
 /// <param name="cylinderType">Type of installation (iGas versus manifold, etc.)</param>
 public GasEndPoint(Cylinder cylinder, int position, GasEndPoint.Type installationType)
 {
     Cylinder         = cylinder;
     Position         = position;
     InstallationType = installationType;
 }