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 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.º 3
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();
        }