Esempio n. 1
0
        public List <vw_CaseDefectsData> GetDefectsByCaseID(int CaseID)
        {
            List <vw_CaseDefectsData> DefectsList = new List <vw_CaseDefectsData>();

            DefectsList.AddRange(DefentantsComponent.GetDefendantsByCaseID(CaseID));
            DefectsList.AddRange(VictimsComponent.GetVictimsByCaseID(CaseID));
            return(DefectsList);
        }
Esempio n. 2
0
 private SaveDefectsStatus AddVictimDefect(vw_CaseDefectData CaseDefect)
 {
     return(VictimsComponent.AddVictim(CaseDefect.CaseID, new vw_VictimData
     {
         PersonID = CaseDefect.PersonID,
         IsCivilRights = CaseDefect.IsCivilRightProsecutor,
         Order = (VictimsComponent.GetLatestVictimOrder(CaseDefect.CaseID) + 1)
     }));
 }
Esempio n. 3
0
        public AddWitnessStatus AddNewWitness(vw_PersonData WitnessData, int CaseID, int SessionID, byte[] FileData, int UserID, SystemUserTypes UserType)
        {
            if (UserType == SystemUserTypes.Secretary)
            {
                // check if person is not from the circuit members
                if (CM.IsPersonIsCircuitMember((int)WitnessData.ID, CaseID))
                {
                    return(AddWitnessStatus.IsCircuitMemeber);
                }
                // check if the session is not sent to judge
                if (SessionsComp.IsSentToJudge(SessionID))
                {
                    return(AddWitnessStatus.IsSentToJudge);
                }
            }


            // check if the person is not a victim
            if (VictimsComponent.IsPersonInCase(WitnessData.ID, CaseID))
            {
                return(AddWitnessStatus.IsVictim);
            }
            // check if the person is not a defendant
            if (DefentantsComponent.IsPersonInCase(WitnessData.ID, CaseID))
            {
                return(AddWitnessStatus.IsDefendant);
            }
            // Check if person didn't connected to the case before
            if (WitnessesComponent.IsConnectedToTheCase((int)WitnessData.ID, CaseID))
            {
                return(AddWitnessStatus.SavedBefore);
            }

            //ToDo: check if the person is not a lawyer in the case


            long PersonID = WitnessData.ID;

            // if the person isn't in the database , add it
            if (WitnessData.ID == 0)
            {
                PersonComp.AddPerson(WitnessData, out PersonID);
            }


            try
            {
                WitnessesComponent.AddNewWitness((int)PersonID, CaseID, FileData, UserID);
                return(AddWitnessStatus.AddedSuccessfully);
            }
            catch (Exception e)
            {
                HandleException(e);
                return(AddWitnessStatus.FailedToAdd);
            }
        }
Esempio n. 4
0
        public List <vw_CaseDefectsData> GetDefectsByCaseID(int CaseID, int SessionID)
        {
            List <vw_CaseDefectsData> DefectsList = new List <vw_CaseDefectsData>();

            DefectsList.AddRange(DefentantsComponent.GetDefendantsByCaseID(CaseID, SessionID));
            DefectsList.AddRange(VictimsComponent.GetVictimsByCaseID(CaseID, SessionID));

            DefectsList = DefectsList.GroupBy(e => new { e.PersonID, e.DefectType }).Select(e => e.OrderBy(d => d.PersonID).ThenBy(c => c.DefectType).LastOrDefault()).Distinct().ToList();
            return(DefectsList);
        }
Esempio n. 5
0
 private SaveDefectsStatus EditVictimDefect(vw_CaseDefectData CaseDefect)
 {
     return(VictimsComponent.EditVictim(CaseDefect.CaseID, new vw_VictimData
     {
         VictimID = CaseDefect.ID,
         PersonID = CaseDefect.PersonID,
         IsCivilRights = CaseDefect.IsCivilRightProsecutor,
         Order = CaseDefect.Order
     }));
 }
Esempio n. 6
0
        public vw_CaseDefectsData GetCaseDefect(int caseID, long partyID, PartyTypes?partyType)
        {
            switch (partyType)
            {
            case PartyTypes.Victim:
                return(VictimsComponent.GetCaseDefect(caseID, partyID));

            case PartyTypes.Defendant:
                return(DefentantsComponent.GetCaseDefect(caseID, partyID));
            }
            return(null);
        }
Esempio n. 7
0
        internal bool DeleteCaseDefects(int caseID)
        {
            var Defendants = DefentantsComponent.GetDefendantsByCaseID(caseID);

            foreach (var Defendant in Defendants)
            {
                if (DefentantsComponent.DeleteDefendant(caseID, Defendant.ID) == DeleteDefectStatus.NotDeleted)
                {
                    return(false);
                }
            }
            var Victims = VictimsComponent.GetVictimsByCaseID(caseID);

            foreach (var Victim in Victims)
            {
                if (VictimsComponent.DeleteVictim(caseID, Victim.ID) == DeleteDefectStatus.NotDeleted)
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 8
0
 public bool IsPersonInCase(long personID, int caseID)
 {
     return(DefentantsComponent.IsPersonInCase(personID, caseID) || VictimsComponent.IsPersonInCase(personID, caseID));
 }
Esempio n. 9
0
 private DeleteDefectStatus DeleteVictimDefect(int CaseID, long VictimID)
 {
     return(VictimsComponent.DeleteVictim(CaseID, VictimID));
 }
Esempio n. 10
0
 private SavePartSOrder SaveOrderVictim(vw_CaseDefectData party)
 {
     return(VictimsComponent.SaveOrderVictim(party));
 }