/// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Residences residences, System.Data.DataSet data)
        {
            // Do nothing if we have nothing
            if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0)
            {
                return;
            }


            // Create a local variable for the new instance.
            Residence newobj = null;

            // Create a local variable for the data row instance.
            System.Data.DataRow dr = null;


            // Iterate through the table rows
            for (int i = 0; i < data.Tables[0].Rows.Count; i++)
            {
                // Get a reference to the data row
                dr = data.Tables[0].Rows[i];
                // Create a new object instance
                newobj = System.Activator.CreateInstance(residences.ContainsType[0]) as Residence;
                // Let the instance set its own members
                newobj.SetMembers(ref dr);
                // Add the new object to the collection instance
                residences.Add(newobj);
            }
        }
    /// <summary>
    /// Instantiate Residence Node, with the given parameters. If no TiledArea is specified, a new TiledArea is created and added to the region. Default rotation is identity. See overload including rotation
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="residencePrefab"></param>
    /// <param name="position"></param>
    /// <param name="rotation"></param>
    /// <param name="parentTiledArea"></param>
    /// <param name="residenceName"></param>
    /// <returns></returns>
    public T CreateResidence <T>(GameObject residencePrefab, Vector3 position, Quaternion rotation, TiledArea parentTiledArea = null, string residenceName = "defaultResidence") where T : MonoBehaviour, INode, IResidence, IArea
    {
        GameObject newResidence = Instantiate(residencePrefab, position, rotation);

        UtilityFunctions.PutObjectOnGround(newResidence.transform);

        T residenceNode = newResidence.AddComponent <T>();

        residenceNode.SetUp(residenceName);
        residenceNode.transform.parent = transform;

        residenceNode.SetUpResidence(this, new List <INode>());
        // TODO: Generalise hut dimensions using data of the hut prefab itself
        residenceNode.SetUpArea(residenceNode.transform, hutDimensions);
        AddLink(residenceNode);
        Residences.Add(residenceNode);
        Areas.Add(residenceNode);
        VillageData.SetHutCount(VillageData.HutCount + 1);
        // If tiled area was not provided, then create a new one
        if (parentTiledArea is null)
        {
            var newTiledArea = new TiledArea(residenceNode);
            TiledAreas.Add(newTiledArea);
        }
        else
        {
            parentTiledArea.AddArea(residenceNode);
        }

        return(residenceNode);
    }
        private void ContentDialog_Loaded(object sender, RoutedEventArgs e)
        {
            var data = DataService.GetAllDistinctResidencesAsync().Result;

            foreach (var item in data)
            {
                Residences.Add(item);
            }
        }
 public void AddResidence(Residence r)
 {
     if (Residences == null)
     {
         Residences = new List <Residence>();
     }
     if (!Residences.Contains(r))
     {
         Residences.Add(r);
     }
 }
 public void SetResidences(List <Residence> r)
 {
     if (Residences == null)
     {
         Residences = new List <Residence>();
     }
     foreach (Residence rs in r)
     {
         Residences.Add(rs);
     }
 }
        private void BtnResidenceNew_Click(object sender, RoutedEventArgs e)
        {
            WinResidences residenceWindow = new WinResidences();

            residenceWindow.ShowDialog();
            if (residenceWindow.Residence != null)
            {
                residences.Add(residenceWindow.Residence);
            }
            UpdateResidences();
        }
Example #7
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            RentalContract = await _context.RentalContract.FirstOrDefaultAsync(m => m.RentalContractId == id);

            if (RentalContract == null)
            {
                return(NotFound());
            }

            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Unknown", Value = "Unknown"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Single", Value = "Single"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Widdow", Value = "Widdow"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Married", Value = "Married"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Divorced", Value = "Divorced"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Separated", Value = "Separated"
            });

            ViewData["MaritalStatus"] = MaritalsStatus;

            foreach (Employee staff in _context.Employee.ToList())
            {
                StaffMembers.Add(staff.EmployeeId, staff.Identification); // new SelectListItem() { Text = staff.Identification, Value = staff.Identification });
            }

            foreach (Apartment aprt in _context.Apartment.ToList())
            {
                Residences.Add(aprt.ApartmentId, aprt.Residence);
            }

            return(Page());
        }
Example #8
0
        public IActionResult OnGet()
        {
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Unknown", Value = "Unknown"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Single", Value = "Single"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Widdow", Value = "Widdow"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Married", Value = "Married"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Divorced", Value = "Divorced"
            });
            MaritalsStatus.Add(new SelectListItem()
            {
                Text = "Separated", Value = "Separated"
            });

            ViewData["MaritalStatus"] = MaritalsStatus;

            foreach (Employee staff in _context.Employee.ToList())
            {
                StaffMembers.Add(staff.EmployeeId, staff.Identification);
            }

            foreach (Apartment aprt in _context.Apartment.ToList())
            {
                Residences.Add(aprt.ApartmentId, aprt.Residence);
            }

            return(Page());
        }
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Residences residences, System.Data.SqlClient.SqlDataReader data)
        {
            // Do nothing if we have nothing
            if (data == null)
            {
                return;
            }


            // Create a local variable for the new instance.
            Residence newobj = null;

            // Iterate through the data reader
            while (data.Read())
            {
                // Create a new object instance
                newobj = System.Activator.CreateInstance(residences.ContainsType[0]) as Residence;
                // Let the instance set its own members
                newobj.SetMembers(ref data);
                // Add the new object to the collection instance
                residences.Add(newobj);
            }
        }