コード例 #1
0
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Employers employers, 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.
            Employer 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(employers.ContainsType[0]) as Employer;
                // Let the instance set its own members
                newobj.SetMembers(ref dr);
                // Add the new object to the collection instance
                employers.Add(newobj);
            }
        }
コード例 #2
0
        private void AddEmployer(object parameter)
        {
            if (Employer != null &&
                Employer.Surname != null &&
                Employer.Name != null &&
                Employer.Patronymic != null)
            {
                EmployersTable ET = new EmployersTable();
                ET.Фамилия       = Employer.Surname;
                ET.Имя           = Employer.Name;
                ET.Отчество      = Employer.Patronymic;
                ET.Дата_рождения = Employer.Born;
                ET.Пол           = Employer.Gender.ToString();
                if (Employer.Unit != null)
                {
                    ET.Подразделение = Employer.Unit.ToString();
                }

                context.EmployersTable.Add(ET);
                context.SaveChanges();

                Employer.Id = ET.Сотрудник_ID;
                Employers.Add(Employer);
                Employer = null;
            }
        }
コード例 #3
0
        public NewJobViewModel()
        {
            JobData jobData = JobData.GetInstance();

            foreach (Employer field in jobData.Employers.ToList())
            {
                Employers.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            // TODO #4 - populate the other List<SelectListItem>
            // collections needed in the view

            foreach (Location field in jobData.Locations.ToList())
            {
                Locations.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (CoreCompetency field in jobData.CoreCompetencies.ToList())
            {
                CoreCompetencies.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
        }
コード例 #4
0
        //this gets the data to put in the list of SelectListItem
        public NewJobViewModel()
        {
            JobData jobData = JobData.GetInstance();

            foreach (Employer field in jobData.Employers.ToList())
            {
                Employers.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
            foreach (Location field in jobData.Locations.ToList())
            {
                Locations.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (CoreCompetency field in jobData.CoreCompetencies.ToList())
            {
                CoreCompetencies.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (PositionType field in jobData.PositionTypes.ToList())
            {
                PositionTypes.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
        }
コード例 #5
0
        public void AddNewEmployer(string n)
        {
            EmployerObject EO = new EmployerObject();

            //EO.OnPropertyChanged("-");
            EO.Id       = Employers.Count + 1;
            EO.FullName = n;
            Employers.Add(EO);

            SaveEmployers();
        }
コード例 #6
0
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Employers employers, System.Data.SqlClient.SqlDataReader data)
        {
            // Do nothing if we have nothing
            if (data == null) return;

            // Create a local variable for the new instance.
            Employer newobj = null;
            // Iterate through the data reader
            while (data.Read())
            {
                // Create a new object instance
                newobj = System.Activator.CreateInstance(employers.ContainsType[0]) as Employer;
                // Let the instance set its own members
                newobj.SetMembers(ref data);
                // Add the new object to the collection instance
                employers.Add(newobj);
            }
        }
コード例 #7
0
        public Employer GetEmployer(string identifier)
        {
            if (identifier == null)
            {
                return(Employer);
            }

            var employer = Employers.SingleOrDefault(x => x.Identifier == identifier);

            if (employer == null)
            {
                employer            = GenerateEmployer().Generate(1).First();
                employer.Identifier = identifier;
                Employers.Add(employer);
            }

            return(employer);
        }
コード例 #8
0
ファイル: NewJobViewModel.cs プロジェクト: DASHRC/TechJobsOO
        public NewJobViewModel()
        {
            JobData jobData = JobData.GetInstance();

            foreach (Employer field in jobData.Employers.ToList())
            {
                Employers.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
            //List <Select * Refer_to
            // TODO #4 CHECK - populate the other List<SelectListItem>
            // collections needed in the view
            //copied the employer one just replaced Employer or Employers with whichever field Uses another method in the jobdata file to make a list of all the options

            foreach (Location field in jobData.Locations.ToList())
            {
                Locations.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (CoreCompetency field in jobData.CoreCompetencies.ToList())
            {
                CoreCompetencies.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (PositionType field in jobData.PositionTypes.ToList())
            {
                PositionTypes.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
        }
コード例 #9
0
        public NewJobViewModel()
        {
            JobData jobData = JobData.GetInstance();


            //need to find employers[id]
            foreach (Employer field in jobData.Employers.ToList())
            {
                Employers.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
            // TODO #4 DONE - populate the other List<SelectListItem> collections needed in the view
            ///kaye start
            foreach (Location field in jobData.Locations.ToList())
            {
                Locations.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (CoreCompetency field in jobData.CoreCompetencies.ToList())
            {
                CoreCompetencies.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (PositionType field in jobData.PositionTypes.ToList())
            {
                PositionTypes.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
        }
コード例 #10
0
ファイル: NewJobViewModel.cs プロジェクト: ercx80/TechJobsOO
        public NewJobViewModel()// in this constructor we populate the select items with the IDs
        {
            JobData jobData = JobData.GetInstance();


            foreach (Employer field in jobData.Employers.ToList())
            {
                Employers.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
            foreach (Location field in jobData.Locations.ToList())
            {
                Locations.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
            foreach (CoreCompetency field in jobData.CoreCompetencies.ToList())
            {
                CoreCompetencies.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
            foreach (PositionType field in jobData.PositionTypes.ToList())
            {
                PositionTypes.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }



            // populate the other List<SelectListItem>
            // collections needed in the view
        }
コード例 #11
0
      //public List<SelectListItem> FirstName { get; set; } = new List<SelectListItem>();
      //public List<SelectListItem> LastName { get; set; } = new List<SelectListItem>();

        public NewJobViewModel()
        {

            JobData jobData = JobData.GetInstance();

            foreach (Employer field in jobData.Employers.ToList())
            {
                Employers.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text = field.Value
                });
            }

            foreach (Location field in jobData.Employers.ToList())
            {
}                Locations.Add(new SelectListItem {
                     Value = field.ID.ToString(),
                     Text = field.Value
               });
            }
コード例 #12
0
        public NewJobViewModel()
        {
            JobData jobData = JobData.GetInstance();

            foreach (Employer field in jobData.Employers.ToList())
            {
                Employers.Add(new SelectListItem {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            // TODO #4 - populate the other List<SelectListItem>
            // collections needed in the view
            foreach (Location field in jobData.Locations.ToList())//type is a list property in JobData.cs
            {
                Locations.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (PositionType field in jobData.PositionTypes.ToList())//jobData.PositionTypes.ToList() from the fields found in this NewJobViewModel.cs
            {
                PositionTypes.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }

            foreach (CoreCompetency field in jobData.CoreCompetencies.ToList())
            {
                CoreCompetencies.Add(new SelectListItem
                {
                    Value = field.ID.ToString(),
                    Text  = field.Value
                });
            }
        }
コード例 #13
0
        public NewJobViewModel()
        {
            JobData jobData = JobData.GetInstance();

            foreach (Employer employer in jobData.Employers.ToList())
            {
                Employers.Add(new SelectListItem {
                    Value = employer.ID.ToString(),
                    Text  = employer.Value
                });
            }

            // TODO #4 - populate the other List<SelectListItem>
            // collections needed in the view
            foreach (Location location in jobData.Locations.ToList())
            {
                Locations.Add(new SelectListItem
                {
                    Value = location.ID.ToString(),
                    Text  = location.Value
                });
            }

            foreach (CoreCompetency coreCompetency in jobData.CoreCompetencies.ToList())
            {
                CoreCompetencies.Add(new SelectListItem
                {
                    Value = coreCompetency.ID.ToString(),
                    Text  = coreCompetency.Value
                });
            }

            foreach (PositionType positionType in jobData.PositionTypes.ToList())
            {
                PositionTypes.Add(new SelectListItem
                {
                    Value = positionType.ID.ToString(),
                    Text  = positionType.Value
                });
            }
        }
コード例 #14
0
        public AddJobViewModel(List <Employer> employers, List <Skill> skills)
        {
            //Employers = new List<SelectListItem>();
            foreach (Employer employer in employers)
            {
                Employers.Add(new SelectListItem
                {
                    Value = employer.Id.ToString(),
                    Text  = employer.Name
                });
            }

            foreach (Skill skill in skills)
            {
                Skills.Add(new Skill
                {
                    Id          = skill.Id,
                    Name        = skill.Name,
                    Description = skill.Description
                });
            }
        }
コード例 #15
0
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Employers employers, System.Data.SqlClient.SqlDataReader data)
        {
            // Do nothing if we have nothing
            if (data == null)
            {
                return;
            }


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

            // Iterate through the data reader
            while (data.Read())
            {
                // Create a new object instance
                newobj = System.Activator.CreateInstance(employers.ContainsType[0]) as Employer;
                // Let the instance set its own members
                newobj.SetMembers(ref data);
                // Add the new object to the collection instance
                employers.Add(newobj);
            }
        }
コード例 #16
0
        public void addEmployerAndSkill(List <Employer> possibleEmployers, List <Skill> possibleSkills)
        {
            this.Employers = new List <SelectListItem>();

            foreach (var employer in possibleEmployers)
            {
                Employers.Add(new SelectListItem
                {
                    Value = employer.Id.ToString(),
                    Text  = employer.Name
                });
            }

            this.Skills = new List <SelectListItem>();

            foreach (var skill in possibleSkills)
            {
                Skills.Add(new SelectListItem
                {
                    Value = skill.Id.ToString(),
                    Text  = skill.Name
                });
            }
        }
コード例 #17
0
        public AddJobViewModel(List <Employer> listOfEmployers, List <Skill> listOfSkills)
        {
            this.Employers = new List <SelectListItem>();
            foreach (Employer employer in listOfEmployers)
            {
                SelectListItem item = new SelectListItem
                {
                    Value = employer.Id.ToString(),
                    Text  = employer.Name
                };
                Employers.Add(item);
            }

            this.Skills = new List <SelectListItem>();
            foreach (Skill skill in listOfSkills)
            {
                SelectListItem item = new SelectListItem
                {
                    Value = skill.Id.ToString(),
                    Text  = skill.Name
                };
                Skills.Add(item);
            }
        }
コード例 #18
0
 public void AddEmployer(Employer employer)
 {
     Employers.Add(employer);
 }
コード例 #19
0
        /// <summary>
        /// The object factory for a particular data collection instance.
        /// </summary>
        public virtual void CreateObjectsFromData(Employers employers, 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.
            Employer 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(employers.ContainsType[0]) as Employer;
                // Let the instance set its own members
                newobj.SetMembers(ref dr);
                // Add the new object to the collection instance
                employers.Add(newobj);
            }
        }