Exemple #1
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);
            }
        }
Exemple #2
0
 public bool IsPersonInCase(long personID, int caseID)
 {
     return(DefentantsComponent.IsPersonInCase(personID, caseID) || VictimsComponent.IsPersonInCase(personID, caseID));
 }