Ejemplo n.º 1
0
 public CustomerAppliance(int applianceId, string alias, int customerId, ApplianceType applianceType)
 {
     ApplianceId   = applianceId;
     Alias         = alias;
     CustomerId    = customerId;
     ApplianceType = applianceType;
 }
Ejemplo n.º 2
0
 public ApplianceInfo(ApplianceType type, Vector2 gridPosition, List <Modifier> modifiers, ApplianceData data)
 {
     ApplianceType = type;
     GridPosition  = gridPosition;
     Modifiers     = modifiers;
     Data          = data;
 }
Ejemplo n.º 3
0
 public Appliance(ApplianceType type, string n, int c, int kwh)
 {
     applianceType = type;
     name          = n;
     cost          = c;
     kwhPerMonth   = kwh;
 }
Ejemplo n.º 4
0
        public Appliance(ApplianceType type, ITime clock, Rating rating, bool isApplianceOn = ApplianceState.Off)
        {
            On = isApplianceOn;

            _id     = Guid.NewGuid().ToString();
            _type   = type;
            _rating = rating;

            clock.Ticked += UpdateUsage;
        }
Ejemplo n.º 5
0
    private void createAppliance(InfoPanel infoPanel, ApplianceType type, GameObject appliancePrefab, ApplianceSpriteDictionary spriteOfAppliance)
    {
        GameObject applianceGO = MonoBehaviour.Instantiate(appliancePrefab) as GameObject;

        applianceGO.transform.GetChild(0).GetComponent <Image>().sprite = spriteOfAppliance[type];
        applianceGO.transform.SetParent(infoPanel.applianceParent.transform);

        applianceGO.GetComponent <RectTransform>().localScale = Vector3.one;
        applianceGO.GetComponent <RectTransform>().offsetMin  = Vector2.zero;
        applianceGO.GetComponent <RectTransform>().offsetMax  = Vector2.zero;
        applianceGO.transform.localPosition = new Vector3(applianceGO.transform.localPosition.x, applianceGO.transform.localPosition.y, 0);
    }
Ejemplo n.º 6
0
 public Appliance(
     ApplianceType Type, 
     string FullName, 
     string Phrase,
     TimeSpan Time)
 {
     this.Name = "TimerTile" + Guid.NewGuid().ToString().Replace("-", "");
     this.FullName = FullName;
     this.Phrase = Phrase;
     this.mtsTime = Time;
     this.Type = Type;
 }
Ejemplo n.º 7
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ApplianceType applianceType = await db.ApplianceTypes.FindAsync(id);

            string comment = $"Id: {applianceType.Id} NameEN: {applianceType.NameEN} NameKZ: {applianceType.NameKZ} NameRU: {applianceType.NameRU}";

            SystemLog.New("ApplianceTypeDelete", comment, null, false);

            db.ApplianceTypes.Remove(applianceType);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 8
0
 public Appliance(int id, string name)
 {
     this.id   = id;
     this.Name = name;
     if (Enum.IsDefined(typeof(ApplianceType), this.Name))
     {
         applianceType = (ApplianceType)Enum.Parse(typeof(ApplianceType), this.Name);
     }
     else
     {
         applianceType = (ApplianceType)Enum.Parse(typeof(ApplianceType), "Other");
     }
 }
Ejemplo n.º 9
0
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApplianceType applianceType = await db.ApplianceTypes.FindAsync(id);

            if (applianceType == null)
            {
                return(HttpNotFound());
            }
            return(View(applianceType));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Sets the appliance type associated with this appliance.
        /// </summary>
        /// <param name="callSign">The callsign to change</param>
        /// <param name="type">The new appliance type</param>
        /// <returns>True if the change was successful, otherwise false.</returns>
        /// <remarks>
        /// Appliance types determine what incidents an appliance is mobilised to -
        /// if an incident requires 2 appliances of type 'Aerial', then this property is checked for all resources.
        /// If it contains a type called 'Aerial' then the appliance is considered for mobilisation.
        /// </remarks>
        public bool SetType(string callSign, ApplianceType type)
        {
            //build the SQL command
            string statement = "UPDATE Appliance " +
                               "SET ApplianceTypeName = @type " +
                               "WHERE CallSign = @callsign;";

            MySqlCommand command = new MySqlCommand(statement, connection);

            command.Parameters.AddWithValue("@callsign", callSign);
            command.Parameters.AddWithValue("@type", type);

            return(executeNonQuery(command));
        }
Ejemplo n.º 11
0
        public async Task <ActionResult> Create([Bind(Include = "Id,NameEN,NameKZ,NameRU")] ApplianceType applianceType)
        {
            if (ModelState.IsValid)
            {
                db.ApplianceTypes.Add(applianceType);
                await db.SaveChangesAsync();

                string comment = $"Id: {applianceType.Id} NameEN: {applianceType.NameEN} NameKZ: {applianceType.NameKZ} NameRU: {applianceType.NameRU}";
                SystemLog.New("ApplianceTypeCreate", comment, null, false);

                return(RedirectToAction("Index"));
            }

            return(View(applianceType));
        }
Ejemplo n.º 12
0
    public static GameObject GetAppliance(ApplianceType type)
    {
        switch (type)
        {
        case ApplianceType.PowerSwitch:
            return(GetPowerSwitch());

        case ApplianceType.Target:
            return(GetTarget());

        default:
            Debug.LogError("Appliance type not found: " + type);
            return(null);
        }
    }
Ejemplo n.º 13
0
        private void Reset(ApplianceType applianceType)
        {
            switch (applianceType)
            {
            case ApplianceType.HeatPump:
                _applianceManager = new HeatPumpManager();
                break;

            case ApplianceType.FanCoilUnit:
                _applianceManager = new FanCoilUnitManager();
                break;

            default:
                throw new InvalidOperationException("Appliance manager type not recognised");
            }
        }
        public void AddAppliance(int applianceCount, ApplianceType type)
        {
            int count = appliances.Count;

            for (int i = 0; i < applianceCount; i++)
            {
                Appliance appliance = type switch
                {
                    ApplianceType.FAN => new Fan(++count),
                    ApplianceType.AC => new AC(++count),
                    ApplianceType.BULB => new Bulb(++count),
                    _ => null,
                };
                appliances.Add(appliance);
                SwitchBoard.AddSwitch(appliance.Id);
            }
        }
Ejemplo n.º 15
0
        public Switch(ApplianceType type)
        {
            switch (type)
            {
            case ApplianceType.Fan:
                appliance = new Fan(random.Next());
                break;

            case ApplianceType.Light:
                appliance = new Light(random.Next());
                break;

            case ApplianceType.AC:
                appliance = new AC(random.Next());
                break;

            default:
                break;
            }
            InitializeLogs();
        }
Ejemplo n.º 16
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,NameEN,NameKZ,NameRU")] ApplianceType applianceType)
        {
            if (ModelState.IsValid)
            {
                ApplianceType at = null;
                using (var dblocal = new NpgsqlContext())
                {
                    at = dblocal.ApplianceTypes.Where(a => a.Id == applianceType.Id).FirstOrDefault();
                    dblocal.Dispose();
                    GC.Collect();
                }

                string comment = $"Id: {at.Id} NameEN: {at.NameEN} NameKZ: {at.NameKZ} NameRU: {at.NameRU}";
                comment += $" -> NameEN: {applianceType.NameEN} NameKZ: {applianceType.NameKZ} NameRU: {applianceType.NameRU}";
                SystemLog.New("ApplianceTypeEdit", comment, null, false);

                db.Entry(applianceType).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(applianceType));
        }
        public async Task GetAppliances_ValidRequest_Succeeds()
        {
            using (var context = _factory.GetKIOTContext())
            {
                var type = context.ApplianceTypes.SingleOrDefault(x => x.ApplianceTypeId == 1);
                if (type == null)
                {
                    type = new ApplianceType(1, "TestAppliance");
                    context.ApplianceTypes.Add(type);
                    context.SaveChanges();
                }
                context.CustomerAppliances.Add(new CustomerAppliance(20501, "TestAlias", -1, type));
                context.SaveChanges();
            }

            (await _client.AuthenticateUserAsync("mwilson", "password")).AddAuthorization(_httpClient);

            CustomerAppliancesDto response = null;

            Assert.Null(await Record.ExceptionAsync(async() => response = await _client.Customer_GetAppliancesAsync()));
            Assert.NotNull(response);
            Assert.NotEmpty(response.Appliances);
            Assert.Contains(response.Appliances, x => x.ApplianceId == 20501 && x.ApplianceName == "TestAlias");
        }
Ejemplo n.º 18
0
 public Appliance(ApplianceType type)
 {
     this.Type = type;
 }
Ejemplo n.º 19
0
 internal void SetApplianceType(ApplianceType applianceType)
 {
     this.applianceType = applianceType;
 }
Ejemplo n.º 20
0
 public RatedAppliance(ApplianceType applianceType, Rating rating)
 {
     ApplianceType = applianceType;
     Rating        = rating;
 }
        /// <summary>
        /// Retrieves a resource using its unique call sign
        /// </summary>
        /// <param name="callSign">The call sign to retrieve</param>
        /// <returns>An object representing the resource.
        /// Note that this is the abstract base class and the returned object should be cast to an Appliance or Officer object.</returns>
        public Appliance GetAppliance(string callSign)
        {
            string statement = "SELECT * FROM  resource, appliance, address_resource, address, resource_status, status, ApplianceType, Base" + Environment.NewLine +
                               "INNER JOIN address AS base_address ON base.Id = base_address.Id" + Environment.NewLine +
                               "WHERE resource.CallSign = appliance.CallSign" + Environment.NewLine +
                               "AND resource.CallSign = address_resource.ResourceCallSign" + Environment.NewLine +
                               "AND address_resource.DateTime = ((SELECT MAX(Address_Resource.DateTime) FROM Address_Resource WHERE Address_Resource.ResourceCallSign = resource.CallSign))" + Environment.NewLine +
                               "AND address_resource.AddressId = address.Id" + Environment.NewLine +
                               "AND resource.CallSign = resource_status.ResourceCallSign" + Environment.NewLine +
                               "AND resource_status.StatusCode = status.Code" + Environment.NewLine +
                               "AND resource_status.DateTime = (SELECT MAX(resource_status.DateTime) FROM resource_status WHERE resource_status.ResourceCallSign = resource.CallSign)" + Environment.NewLine +
                               "AND appliance.ApplianceTypeName = ApplianceType.Name" + Environment.NewLine +
                               "AND resource.BaseLocationId = base.Id" + Environment.NewLine +
                               "AND resource.CallSign = @callsign;";

            MySqlCommand command = new MySqlCommand(statement, connection);

            command.Parameters.AddWithValue("@callsign", callSign);

            //execute the query
            MySqlDataReader myReader = null;

            try
            {
                // open the connection only if it is currently closed
                if (command.Connection.State == System.Data.ConnectionState.Closed)
                {
                    command.Connection.Open();
                }

                //close the reader if it currently exists
                if (myReader != null && !myReader.IsClosed)
                {
                    myReader.Close();
                }

                myReader = command.ExecuteReader();

                //read the data sent back from MySQL server
                while (myReader.Read())
                {
                    string name = myReader.GetString(2);

                    string mobile = string.Empty;
                    if (!myReader.IsDBNull(3))
                    {
                        mobile = myReader.GetString(3);
                    }

                    int attachedIncident = -1;
                    if (!myReader.IsDBNull(4))
                    {
                        attachedIncident = myReader.GetInt32(4);
                    }

                    string oic = string.Empty;
                    if (!myReader.IsDBNull(7))
                    {
                        oic = myReader.GetString(7);
                    }

                    int crew = -1;
                    if (!myReader.IsDBNull(8))
                    {
                        crew = myReader.GetInt32(8);
                    }

                    int ba = -1;
                    if (!myReader.IsDBNull(9))
                    {
                        ba = myReader.GetInt32(9);
                    }

                    #region Address Data

                    int addressId = -1;
                    if (!myReader.IsDBNull(14))
                    {
                        addressId = myReader.GetInt32(14);
                    }

                    string building = string.Empty;
                    if (!myReader.IsDBNull(15))
                    {
                        building = myReader.GetString(15);
                    }

                    string number = string.Empty;
                    if (!myReader.IsDBNull(16))
                    {
                        number = myReader.GetString(16);
                    }

                    string street = string.Empty;
                    if (!myReader.IsDBNull(17))
                    {
                        street = myReader.GetString(17);
                    }

                    string town = string.Empty;
                    if (!myReader.IsDBNull(18))
                    {
                        town = myReader.GetString(18);
                    }

                    string postcode = string.Empty;
                    if (!myReader.IsDBNull(19))
                    {
                        postcode = myReader.GetString(19);
                    }

                    string county = string.Empty;
                    if (!myReader.IsDBNull(20))
                    {
                        county = myReader.GetString(20);
                    }

                    double latitude  = myReader.GetDouble(21);
                    double longitude = myReader.GetDouble(22);

                    Address address = new Address(addressId, building, number, street, town, postcode, county, longitude, latitude);

                    #endregion

                    #region Status Data

                    int code = -1;
                    if (!myReader.IsDBNull(27))
                    {
                        code = myReader.GetInt32(27);
                    }

                    string codeDescription = string.Empty;
                    if (!myReader.IsDBNull(28))
                    {
                        codeDescription = myReader.GetString(28);
                    }

                    bool isAvail = false;
                    if (!myReader.IsDBNull(29))
                    {
                        isAvail = myReader.GetBoolean(29);
                    }

                    bool isMob = false;
                    if (!myReader.IsDBNull(30))
                    {
                        isMob = myReader.GetBoolean(30);
                    }

                    ResourceLogTime log = ResourceLogTime.Ignore;
                    if (!myReader.IsDBNull(31))
                    {
                        log = (ResourceLogTime)myReader.GetInt32(31);
                    }

                    ResourceStatus status = new ResourceStatus(code, codeDescription, isAvail, isMob, log);

                    #endregion

                    #region Appliance Type Data

                    string typeName = string.Empty;
                    if (!myReader.IsDBNull(32))
                    {
                        typeName = myReader.GetString(32);
                    }

                    string typeDescription = string.Empty;
                    if (!myReader.IsDBNull(33))
                    {
                        typeDescription = myReader.GetString(33);
                    }

                    ApplianceType type = new ApplianceType(typeName, typeDescription);

                    #endregion

                    #region Base Data

                    int baseId = -1;
                    if (!myReader.IsDBNull(34))
                    {
                        baseId = myReader.GetInt32(34);
                    }

                    int baseAddressId = -1;
                    if (!myReader.IsDBNull(35))
                    {
                        baseAddressId = myReader.GetInt32(35);
                    }

                    string office = string.Empty;
                    if (!myReader.IsDBNull(36))
                    {
                        office = myReader.GetString(36);
                    }

                    string baseName = string.Empty;
                    if (!myReader.IsDBNull(37))
                    {
                        name = myReader.GetString(37);
                    }


                    string baseBuilding = string.Empty;
                    if (!myReader.IsDBNull(39))
                    {
                        building = myReader.GetString(39);
                    }

                    string baseNumber = string.Empty;
                    if (!myReader.IsDBNull(40))
                    {
                        number = myReader.GetString(40);
                    }

                    string baseStreet = string.Empty;
                    if (!myReader.IsDBNull(41))
                    {
                        street = myReader.GetString(41);
                    }

                    string baseTown = string.Empty;
                    if (!myReader.IsDBNull(42))
                    {
                        town = myReader.GetString(42);
                    }

                    string basePostcode = string.Empty;
                    if (!myReader.IsDBNull(43))
                    {
                        postcode = myReader.GetString(43);
                    }

                    string baseCounty = string.Empty;
                    if (!myReader.IsDBNull(44))
                    {
                        county = myReader.GetString(44);
                    }

                    double baseLatitude  = myReader.GetDouble(45);
                    double baseLongitude = myReader.GetDouble(46);

                    Address baseAddress  = new Address(baseId, baseBuilding, baseNumber, baseStreet, baseTown, basePostcode, baseCounty, baseLongitude, baseLatitude);
                    Base    baseLocation = new Base(baseId, office, baseAddress, baseName);

                    #endregion

                    ApplianceInfo info = new ApplianceInfo(name, mobile, baseLocation, address, status, oic, crew, ba, type, attachedIncident);
                    return(new Appliance(callSign, info));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                if (myReader != null)
                {
                    myReader.Close();
                }
                command.Connection.Close();
            }
            return(null);
        }
Ejemplo n.º 22
0
 public ApplianceItem(string description, int sku, decimal price, ApplianceType applianceType) : base(description, sku, price)
 {
     ApplianceType = applianceType;
 }
Ejemplo n.º 23
0
 public Appliance MakeAppliance(ApplianceType applianceType)
 {
     return(All.Single(appliance => appliance.ApplianceType == applianceType));
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Retrieves all appliance information from the database.
        /// </summary>
        /// <param name="callSign">The unique appliance call sign to retrieve the information for.</param>
        /// <returns>An container class that stores all the information</returns>
        public ApplianceInfo GetApplianceInfo(string callSign)
        {
            string statement = "SELECT resource.Name, resource.MobilePhoneNumber, " + Environment.NewLine +
                               "base.id, base.name, base.OfficePhoneNumber," + Environment.NewLine +
                               "base_address.id, base_address.building, base_address.number, base_address.street, base_address.town, base_address.postcode, base_address.county, base_address.longitude, base_address.latitude," + Environment.NewLine +
                               "current_address.id, current_address.building, current_address.number, current_address.street, current_address.town, current_address.postcode, current_address.county, current_address.longitude, current_address.latitude," + Environment.NewLine +
                               "status.code, status.Description, status.IsAvailable, status.IsMobile, status.ResourceLogEnumeration, resource_status.DateTime, resource_status.OperatorId," + Environment.NewLine +
                               "appliance.OfficerInCharge, appliance.CrewNumber, appliance.BaNumber," + Environment.NewLine +
                               "appliancetype.Name, appliancetype.Description, resource.AttachedIncidentNumber" + Environment.NewLine +
                               "FROM resource" + Environment.NewLine +
                               "INNER JOIN base ON resource.BaseLocationId = base.Id" + Environment.NewLine +
                               "INNER JOIN address AS base_address ON base.AddressId = base_address.Id" + Environment.NewLine +
                               "INNER JOIN Address_Resource ON Address_Resource.ResourceCallSign = resource.CallSign" + Environment.NewLine +
                               "INNER JOIN address AS current_address ON address_resource.AddressId = current_address.Id" + Environment.NewLine +
                               "INNER JOIN resource_status ON resource_status.ResourceCallSign = resource.CallSign" + Environment.NewLine +
                               "INNER JOIN status ON resource_status.StatusCode = status.Code" + Environment.NewLine +
                               "INNER JOIN appliance ON resource.CallSign = appliance.CallSign" + Environment.NewLine +
                               "INNER JOIN appliancetype ON appliance.ApplianceTypeName = appliancetype.Name" + Environment.NewLine +
                               "WHERE Address_Resource.DateTime = (SELECT MAX(DateTime) FROM Address_Resource WHERE ResourceCallSign = resource.CallSign)" + Environment.NewLine +
                               "AND resource_status.DateTime = (SELECT MAX(DateTime) FROM resource_status WHERE ResourceCallSign = resource.CallSign)" + Environment.NewLine +
                               "AND resource.CallSign = @callsign;";


            //object that will execute the query
            MySqlCommand command = new MySqlCommand(statement, connection);

            command.Parameters.AddWithValue("@callsign", callSign);

            //execute
            MySqlDataReader myReader = null; //reads the database data

            try
            {
                // open the connection only if it is currently closed
                if (command.Connection.State == System.Data.ConnectionState.Closed)
                {
                    command.Connection.Open();
                }

                //close the reader if it currently exists
                if (myReader != null && !myReader.IsClosed)
                {
                    myReader.Close();
                }

                myReader = command.ExecuteReader(); //execute the select statement

                //read the data sent back from MySQL server and create the Appliance objects
                while (myReader.Read())
                {
                    //read all the data returned from the database - each information area is split into a different region below

                    string resourceName = myReader.GetString(0);
                    string mobileNo     = myReader.GetString(1);

                    #region Base Address Data

                    int    baseId        = myReader.GetInt32(2);
                    string baseName      = myReader.GetString(3);
                    string officeNo      = myReader.GetString(4);
                    int    baseAddressId = myReader.GetInt32(5);

                    string baseBuilding = string.Empty;
                    if (!myReader.IsDBNull(6))
                    {
                        baseBuilding = myReader.GetString(6);
                    }

                    string baseNumber = string.Empty;
                    if (!myReader.IsDBNull(7))
                    {
                        baseNumber = myReader.GetString(7);
                    }

                    string baseStreet = string.Empty;
                    if (!myReader.IsDBNull(8))
                    {
                        baseStreet = myReader.GetString(8);
                    }

                    string baseTown = string.Empty;
                    if (!myReader.IsDBNull(9))
                    {
                        baseTown = myReader.GetString(9);
                    }

                    string basePostcode = string.Empty;
                    if (!myReader.IsDBNull(10))
                    {
                        basePostcode = myReader.GetString(10);
                    }

                    string baseCounty = string.Empty;
                    if (!myReader.IsDBNull(11))
                    {
                        baseCounty = myReader.GetString(11);
                    }

                    double baseLong = myReader.GetDouble(12);
                    double baseLat  = myReader.GetDouble(13);

                    Address baseAddress = new Address(baseAddressId, baseBuilding, baseNumber, baseStreet, baseTown, basePostcode, baseCounty, baseLong, baseLat);

                    Base baseLocation = new Base(baseId, officeNo, baseAddress, baseName);

                    #endregion


                    #region Current Address Data

                    int currentId = myReader.GetInt32(14);

                    string currentBuilding = string.Empty;
                    if (!myReader.IsDBNull(15))
                    {
                        currentBuilding = myReader.GetString(15);
                    }

                    string currentNumber = string.Empty;
                    if (!myReader.IsDBNull(16))
                    {
                        currentNumber = myReader.GetString(16);
                    }

                    string currentStreet = string.Empty;
                    if (!myReader.IsDBNull(17))
                    {
                        currentStreet = myReader.GetString(17);
                    }

                    string currentTown = string.Empty;
                    if (!myReader.IsDBNull(18))
                    {
                        currentTown = myReader.GetString(18);
                    }

                    string currentPostcode = string.Empty;
                    if (!myReader.IsDBNull(19))
                    {
                        currentPostcode = myReader.GetString(19);
                    }

                    string currentCounty = string.Empty;
                    if (!myReader.IsDBNull(20))
                    {
                        currentCounty = myReader.GetString(20);
                    }

                    double currentLong = myReader.GetDouble(21);
                    double currentLat  = myReader.GetDouble(22);

                    Address currentAddress = new Address(currentId, currentBuilding, currentNumber, currentStreet, currentTown, currentPostcode, currentCounty, currentLong, currentLat);

                    #endregion


                    #region Status Code Data

                    int statusCode = -1;
                    if (!myReader.IsDBNull(23))
                    {
                        statusCode = myReader.GetInt32(23);
                    }

                    string statusDescription = string.Empty;
                    if (!myReader.IsDBNull(24))
                    {
                        statusDescription = myReader.GetString(24);
                    }

                    bool isAvail = false;
                    if (!myReader.IsDBNull(25))
                    {
                        isAvail = myReader.GetBoolean(25);
                    }

                    bool isMobile = false;
                    if (!myReader.IsDBNull(26))
                    {
                        isMobile = myReader.GetBoolean(26);
                    }

                    int resourceLogEnumeration = -1;
                    if (!myReader.IsDBNull(27))
                    {
                        resourceLogEnumeration = myReader.GetInt32(27);
                    }

                    ResourceLogTime incidentLogAction = ResourceLogTime.Ignore;
                    if (Enum.IsDefined(typeof(ResourceLogTime), resourceLogEnumeration))
                    {
                        incidentLogAction = (ResourceLogTime)resourceLogEnumeration;
                    }

                    ResourceStatus status = new ResourceStatus(statusCode, statusDescription, isAvail, isMobile, incidentLogAction);

                    #endregion


                    #region Appliance Data

                    string oic = string.Empty;
                    if (!myReader.IsDBNull(30))
                    {
                        oic = myReader.GetString(30);
                    }

                    int crew = -1;
                    if (!myReader.IsDBNull(31))
                    {
                        crew = myReader.GetInt32(31);
                    }

                    int ba = -1;
                    if (!myReader.IsDBNull(32))
                    {
                        ba = myReader.GetInt32(32);
                    }

                    string applianceTypeName = string.Empty;
                    if (!myReader.IsDBNull(33))
                    {
                        applianceTypeName = myReader.GetString(33);
                    }

                    string applianceTypeDescription = string.Empty;
                    if (!myReader.IsDBNull(34))
                    {
                        applianceTypeDescription = myReader.GetString(34);
                    }

                    int assignedIncident = -1;
                    if (!myReader.IsDBNull(35))
                    {
                        assignedIncident = myReader.GetInt32(35);
                    }

                    ApplianceType type = new ApplianceType(applianceTypeName, applianceTypeDescription);

                    #endregion

                    return(new ApplianceInfo(resourceName, mobileNo, baseLocation, currentAddress, status, oic, crew, ba, type, assignedIncident));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show(statement);
            }
            finally
            {
                //close the connections
                if (myReader != null)
                {
                    myReader.Close();
                }
                command.Connection.Close();
            }

            return(null);
        }
Ejemplo n.º 25
0
 public ApplianceManagerBuilder(ApplianceType applianceType)
 {
     Reset(applianceType);
 }