private static void AddDefendants(List <Defendant> defendants, Defendant newDefendant)
        {
            if (defendants.Any(l => l.ID == newDefendant.ID))
            {
                throw new ArgumentException(GlobalConstants.InvalidAdding);
            }

            defendants.Add(newDefendant);
        }
Пример #2
0
 public FormViewModel()
 {
     BailBondInfo     = new BailBondInfo();
     ProvidingAgency  = new ProvidingAgency();
     Jail             = new Jail();
     BondTransfer     = new BondTransfer();
     RequestingAgency = new RequestingAgency();
     Defendant        = new Defendant();
     Indemnitor       = new Indemnitor();
     AdditionalInfo   = new AdditionalInfo();
 }
        private static void GenerateDefendants(List <Defendant> defendants, List <Lawyer> lawyers)
        {
            Defendant claimantPopov    = new Defendant("4511098050", "Strahil Popov", "Sofia, German", 45);
            Defendant claimantPashov   = new Defendant("6602089950", "Georgi Pashov", "Sofia, Mladost", 22);
            Defendant claimantSlavchev = new Defendant("9912174015", "Simeon Slavchev", "Sofia, bul. Malinov 44", 66);
            Defendant claimantDimitrov = new Defendant("8809085030", "Nikola Dimitrov", "Sofia, Lulin", 22);
            Defendant claimantDespodov = new Defendant("6409014550", "Kiril Despodov", "Sofia, Lulin", 41);

            AddDefendants(defendants, claimantPopov);
            AddDefendants(defendants, claimantPashov);
            AddDefendants(defendants, claimantSlavchev);
            AddDefendants(defendants, claimantDimitrov);
            AddDefendants(defendants, claimantDespodov);

            AddLawyersToDefendants(defendants, lawyers);
        }
Пример #4
0
        public object AddLitigant(int caseId, [FromBody] LitigantViewModel model)
        {
            if (model == null)
            {
                return(BadRequest("No litigant to add"));
            }

            var @case = _unitOfWork.Cases.GetById(caseId);

            if (@case == null)
            {
                return(NotFound("Case not found"));
            }

            //TODO: Code smell
            switch (model.Type)
            {
            case LitigantType.Defendant:
                var defendant = new Defendant()
                {
                    Name     = model.Name,
                    FilingId = caseId
                };
                _unitOfWork.Litigants.AddDefendant(defendant);
                _unitOfWork.Complete();
                return(Ok(defendant));

            case LitigantType.Plaintiff:
                var plaintiff = new Plaintiff()
                {
                    Name     = model.Name,
                    FilingId = caseId
                };
                _unitOfWork.Litigants.AddPlaintiff(plaintiff);
                _unitOfWork.Complete();

                return(Ok(plaintiff));

            default:
                return(Ok());
            }
            ;
        }
        public bool CreateDefendant(DefendantCreate model)
        {
            var entity = new Defendant()
            {
                DefendantID   = model.DefendantID,
                FirstName     = model.FirstName,
                LastName      = model.LastName,
                StreetAddress = model.StreetAddress,
                City          = model.City,
                County        = model.County,
                State         = model.State,
                Zipcode       = model.Zipcode,
                Prosecuted    = model.Prosecuted,
                Arrested      = model.Arrested,
                //CourtHearingID = model.CourtHearingID,
                //ConvictionID = model.ConvictionID
            };

            using (var dft = new ApplicationDbContext())
            {
                dft.Defendants.Add(entity);
                return(dft.SaveChanges() == 1);
            }
        }
 public Lawsuit(Defendant defendant, Judge judge, List <Witness> witnesses)
 {
     this.Defendant = defendant;
     this.Witnesses = witnesses;
     this.Judge     = judge;
 }
Пример #7
0
 public CriminalCase(Defendant defendant, Judge judge, List <Witness> witnesses, List <JudicialAssessor> judicialAssessors, Prosecutor prosecutor)
     : base(defendant, judge, witnesses)
 {
     this.JudicialAssessors = judicialAssessors;
     this.Prosecutor        = prosecutor;
 }
 public CivilCase(Defendant defendant, Judge judge, List <Witness> witnesses, List <JudicialAssessor> judicialAssessors, Claimant claimant)
     : base(defendant, judge, witnesses)
 {
     this.Claimant          = claimant;
     this.JudicialAssessors = judicialAssessors;
 }
Пример #9
0
 public void AddDefendant(Defendant defendant)
 {
     _context.Defendants.Add(defendant);
 }
Пример #10
0
 public void AddToDefendants(Defendant defendant)
 {
     base.AddObject("Defendants", defendant);
 }
Пример #11
0
 public static Defendant CreateDefendant(int ID, byte[] rowVersion, string firstName, string middleName, string lastName, string gender, string race, string createBy, global::System.DateTime createTime, string createOffice, string modifyBy, global::System.DateTime modifyTime, string modifyOffice, int workSheet_Defendant)
 {
     Defendant defendant = new Defendant();
     defendant.Id = ID;
     defendant.RowVersion = rowVersion;
     defendant.FirstName = firstName;
     defendant.MiddleName = middleName;
     defendant.LastName = lastName;
     defendant.Gender = gender;
     defendant.Race = race;
     defendant.CreateBy = createBy;
     defendant.CreateTime = createTime;
     defendant.CreateOffice = createOffice;
     defendant.ModifyBy = modifyBy;
     defendant.ModifyTime = modifyTime;
     defendant.ModifyOffice = modifyOffice;
     defendant.WorkSheet_Defendant = workSheet_Defendant;
     return defendant;
 }