Exemplo n.º 1
0
        public async Task <int> PostBj(Humen bj)
        {
            db.hu.Add(bj);
            int result = await db.SaveChangesAsync();

            return(result);
        }
Exemplo n.º 2
0
        public List <Humen> SelectHumenId(int id)
        {
            List <Humen> list    = new List <Humen>();
            var          persons = hrdb.hu.Where(p => p.human_id == id).AsNoTracking();

            foreach (var item in persons)
            {
                Humen bjm = new Humen()
                {
                    hfd_id               = item.hfd_id,
                    human_id             = item.human_id,
                    first_kind_id        = item.first_kind_id,
                    first_kind_name      = item.first_kind_name,
                    second_kind_id       = item.second_kind_id,
                    second_kind_name     = item.second_kind_name,
                    third_kind_id        = item.third_kind_id,
                    third_kind_name      = item.third_kind_name,
                    human_name           = item.human_name,
                    salary_standard_id   = item.salary_standard_id,
                    salary_standard_name = item.salary_standard_name,
                    salary_sum           = item.salary_sum,
                    demand_salaray_sum   = item.demand_salaray_sum,
                    paid_salary_sum      = item.paid_salary_sum,
                    statu = item.statu,
                };
                list.Add(bjm);
            }
            return(list);
        }
Exemplo n.º 3
0
        public async Task <int> PutBj(Humen bj)
        {
            db.Set <Humen>().Attach(bj);
            db.Entry(bj).State = System.Data.Entity.EntityState.Modified;
            int result = await db.SaveChangesAsync();

            return(result);
        }
Exemplo n.º 4
0
        public async Task <int> Deletehu(int id)
        {
            Humen bj = db.hu.FirstOrDefault(e => e.hfd_id == id);

            Console.WriteLine(db.Entry(bj).State);
            db.hu.Remove(bj);
            int result = await db.SaveChangesAsync();

            return(result);
        }
Exemplo n.º 5
0
        public ViewModel()
        {
            Humen.CollectionChanged += Any_CollectionChanged;
            Dogs.CollectionChanged  += Any_CollectionChanged;

            Humen.Add(new Human("Jake", Colors.Green));
            Humen.Add(new Human("Tim", Colors.Blue));
            Humen.Add(new Human("Lisa", Colors.Pink));

            Dogs.Add(new Dog("Rex", Colors.Blue));
            Dogs.Add(new Dog("Daisy", Colors.Pink));
            Dogs.Add(new Dog("Snoopy", Colors.AliceBlue));
        }
Exemplo n.º 6
0
        public HumenModel GetBj(int id)
        {
            Humen      bj  = db.hu.Find(id);
            HumenModel bjm = new HumenModel()
            {
                hfd_id               = bj.hfd_id,
                human_id             = bj.human_id,
                first_kind_name      = bj.first_kind_name,
                second_kind_id       = bj.second_kind_id,
                second_kind_name     = bj.second_kind_name,
                third_kind_id        = bj.third_kind_id,
                third_kind_name      = bj.third_kind_name,
                human_name           = bj.human_name,
                salary_standard_id   = bj.salary_standard_id,
                salary_standard_name = bj.salary_standard_name,
                salary_sum           = bj.salary_sum,
                demand_salaray_sum   = bj.demand_salaray_sum,
                paid_salary_sum      = bj.paid_salary_sum,
            };

            return(bjm);
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            /*
             * Humen person;
             * person.name = "Ivan";
             * person.age = 20;
             * person.sex = 'M';
             *
             * Console.WriteLine("{0} {1} {2} ",person.name, person.age, person.sex); */

            Humen[] persons;
            persons = new Humen[5];

            persons[0].name = "Ivan";
            persons[0].age  = 28;
            persons[0].sex  = 'M';

            persons[1].name = "Vladlen";
            persons[1].age  = 21;
            persons[1].sex  = 'M';

            persons[2].name = "Liliya";
            persons[2].age  = 22;
            persons[2].sex  = 'W';

            persons[3].name = "Slavon";
            persons[3].age  = 27;
            persons[3].sex  = 'M';

            persons[4].name = "Elena";
            persons[4].age  = 60;
            persons[4].sex  = 'W';

            foreach (Humen x in persons)
            {
                Console.WriteLine(x.name + " " + x.age + " " + x.sex);
            }

            // sorting

            int   minAge;
            int   numMinAge;
            Humen tmpHumen;

            for (int i = 0; i < persons.Length; i++)
            {
                numMinAge = i;
                minAge    = persons[i].age;

                for (int j = i; j < persons.Length; j++)
                {
                    if (minAge > persons[j].age)
                    {
                        minAge    = persons[j].age;
                        numMinAge = j;
                    }
                }

                tmpHumen           = persons[i];
                persons[i]         = persons[numMinAge];
                persons[numMinAge] = tmpHumen;
            }
            Console.WriteLine();
            foreach (Humen x in persons)
            {
                Console.WriteLine(x.age + " " + x.sex + " " + x.name);
            }
        }