Exemplo n.º 1
0
        public void Data_Delete(int bandit_id)
        {
            InterpolContext context         = new InterpolContext();
            Spirit          spirit_remove   = context.Spirits.Where(c => c.person_id == bandit_id).FirstOrDefault();
            Parameter       par_remove      = context.Parameters.Where(c => c.person_id == bandit_id).FirstOrDefault();
            Passport        pass_remove     = context.Passports.Where(c => c.person_id == bandit_id).FirstOrDefault();
            Criminal        criminal_remove = context.Criminals.Where(c => c.person_id == bandit_id).FirstOrDefault();
            Permit          permit_remove   = context.Permits.Where(c => c.person_id == bandit_id).FirstOrDefault();

            context.Permits.Remove(permit_remove);
            context.Spirits.Remove(spirit_remove);
            context.Parameters.Remove(par_remove);
            context.Passports.Remove(pass_remove);
            context.Criminals.Remove(criminal_remove);
            context.SaveChanges();

            if (context.PSRelations.Any(c => c.person_id == bandit_id))
            {
                PSRelation rel = context.PSRelations.Where(c => c.person_id == bandit_id).FirstOrDefault();
                context.PSRelations.Remove(rel);
                context.SaveChanges();
            }
            context.SaveChanges();

            Person person_remove = context.Persons.Where(c => c.person_id == bandit_id).FirstOrDefault();

            context.Persons.Remove(person_remove);
            context.SaveChanges();



            GlobalTab.count_datarows--;
        }
Exemplo n.º 2
0
        public void Syndicate_Delete(int synd_id)
        {
            InterpolContext context = new InterpolContext();

            if (context.PSRelations.Any(c => c.sys_id == synd_id))
            {
                var relation_list = context.PSRelations.Where(c => c.sys_id == synd_id).ToList();
                context.PSRelations.RemoveRange(relation_list);
                context.SaveChanges();
            }
            context.SaveChanges();
            Syndicate syndicate = context.Syndicates.Where(c => c.syn_id == synd_id).FirstOrDefault();

            context.Syndicates.Remove(syndicate);
            context.SaveChanges();
        }
Exemplo n.º 3
0
        public void UpdatePerson_Language(int bandit_id, string new_bandit_language)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Spirits.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_language = new_bandit_language;
            context.SaveChanges();
        }
Exemplo n.º 4
0
        //---------------------------------
        // Spirits table                -
        //---------------------------------

        public void UpdatePerson_Religion(int bandit_id, string new_bandit_religion)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Spirits.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_religion = new_bandit_religion;
            context.SaveChanges();
        }
Exemplo n.º 5
0
        public void UpdatePerson_Birthday(int bandit_id, string new_bandit_birthday)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Persons.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_birthday = new_bandit_birthday;
            context.SaveChanges();
        }
Exemplo n.º 6
0
        //---------------------------------
        // Passports table                -
        //---------------------------------

        public void UpdatePerson_Citizenship(int bandit_id, string new_bandit_citizen)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Passports.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_citizenship = new_bandit_citizen;
            context.SaveChanges();
        }
Exemplo n.º 7
0
        public void UpdatePerson_Role(int bandit_id, string new_bandit_role)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Criminals.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_role = new_bandit_role;
            context.SaveChanges();
        }
Exemplo n.º 8
0
        //---------------------------------
        // Criminals table                -
        //---------------------------------

        public void UpdatePerson_Profession(int bandit_id, string new_bandit_profession)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Criminals.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_profession = new_bandit_profession;
            context.SaveChanges();
        }
Exemplo n.º 9
0
        public void UpdatePerson_Haircolor(int bandit_id, string new_bandit_haircolor)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Parameters.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_haircolor = new_bandit_haircolor;
            context.SaveChanges();
        }
Exemplo n.º 10
0
        public void UpdatePerson_Weight(int bandit_id, int new_bandit_Weight)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Parameters.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_weight = new_bandit_Weight;
            context.SaveChanges();
        }
Exemplo n.º 11
0
        public void UpdatePerson_Photo(int bandit_id, string new_bandit_photo)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Persons.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.photo_path = new_bandit_photo;
            context.SaveChanges();
        }
Exemplo n.º 12
0
        public void UpdatePerson_Status(int bandit_id, string new_bandit_status)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Persons.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_status = new_bandit_status;
            context.SaveChanges();
        }
Exemplo n.º 13
0
        public void UpdatePerson_Nationality(int bandit_id, string new_bandit_nationality)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Passports.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_nationality = new_bandit_nationality;
            context.SaveChanges();
        }
Exemplo n.º 14
0
        public void UpdatePerson_Nickname(int bandit_id, string new_bandit_nickname)
        {
            InterpolContext context = new InterpolContext();
            var             person  = context.Persons.Where(c => c.person_id == bandit_id).FirstOrDefault();

            person.person_nickname = new_bandit_nickname;
            context.SaveChanges();
        }
Exemplo n.º 15
0
        public void Delete_From_Syndicate(int bandit_id)
        {
            InterpolContext context          = new InterpolContext();
            PSRelation      syndicate_person = context.PSRelations.Where(c => c.person_id == bandit_id).FirstOrDefault();

            context.PSRelations.Remove(syndicate_person);
            context.SaveChanges();
        }
Exemplo n.º 16
0
        public void OpenPermit(int bandit_id)
        {
            InterpolContext context = new InterpolContext();
            var             permit  = context.Permits.Where(c => c.person_id == bandit_id).FirstOrDefault();

            permit.permit_value = "Свободна";
            context.SaveChanges();
        }
Exemplo n.º 17
0
        public void CreateSyndicate(string synd_name, string synd_date)
        {
            InterpolContext context = new InterpolContext();
            Syndicate       syn     = new Syndicate
            {
                syn_name = synd_name,
                syn_date = synd_date
            };

            context.Syndicates.Add(syn);
            context.SaveChanges();
        }
Exemplo n.º 18
0
        public void Add_To_Syndicate(int bandit_id, int syndicate_id, string bandit_date)
        {
            InterpolContext context = new InterpolContext();

            PSRelation rel = new PSRelation
            {
                person_id = bandit_id,
                sys_id    = syndicate_id,
                dateFrom  = bandit_date
            };

            context.PSRelations.Add(rel);
            context.SaveChanges();
        }
Exemplo n.º 19
0
        public void CreateDataRow(string bandit_name, string bandit_nickname, string bandit_birthday, string photo, string bandit_status,
                                  string bandit_religion, string bandit_language, string bandit_profession, string bandit_role, int bandit_rise, int bandit_weight,
                                  string bandit_eyecolor, string bandit_haircolor, string bandit_citizen, string bandit_nationality)
        {
            InterpolContext context = new InterpolContext();

            Person person = new Person
            {
                person_name     = bandit_name,
                person_nickname = bandit_nickname,
                person_birthday = bandit_birthday,
                person_status   = bandit_status,
                photo_path      = photo
            };

            context.Persons.Add(person);
            context.SaveChanges();

            int bandit_id = context.Persons.Where(c => c.person_nickname == bandit_nickname).Select(c => c.person_id).FirstOrDefault();

            Criminal crim = new Criminal
            {
                person_profession = bandit_profession,
                person_role       = bandit_role,
                person_id         = bandit_id
            };

            context.Criminals.Add(crim);
            context.SaveChanges();

            Passport pass = new Passport
            {
                person_citizenship = bandit_citizen,
                person_nationality = bandit_nationality,
                person_id          = bandit_id
            };

            context.Passports.Add(pass);
            context.SaveChanges();

            Spirit sp = new Spirit
            {
                person_language = bandit_language,
                person_religion = bandit_religion,
                person_id       = bandit_id
            };

            context.Spirits.Add(sp);
            context.SaveChanges();

            Parameter par = new Parameter
            {
                person_rise      = bandit_rise,
                person_weight    = bandit_weight,
                person_eyecolor  = bandit_eyecolor,
                person_haircolor = bandit_haircolor,
                person_id        = bandit_id
            };

            context.Parameters.Add(par);
            context.SaveChanges();

            Permit permit = new Permit
            {
                permit_value = "Свободна",
                person_id    = bandit_id
            };

            context.Permits.Add(permit);
            context.SaveChanges();
        }