Beispiel #1
0
        private MinutesOfSessionCreateViewModel PrepareViewModel(MinutesOfSessionViewModel MinutesOfSession = null)
        {
            if (MinutesOfSession == null)
            {
                MinutesOfSession = new MinutesOfSessionViewModel();
            }
            //   var attendanctype = LookupService.GetLookupsByCategory(Base.LookupsCategories.PresenceStatuses);
            var defendents = DefectsService.GetDefectsByCaseID(MinutesOfSession.CaseID, MinutesOfSession.SessionID);
            var result     = new MinutesOfSessionCreateViewModel()
            {
                AutoCompleteText = GetTextPrediction(MinutesOfSession.CircuitID),
                MinutesOfSession = MinutesOfSession,
                SessionData      = SessionService.GetSessionData(MinutesOfSession.SessionID),
                CaseBasicData    = CaseService.GetCaseBasicData(MinutesOfSession.CaseID),
                vw_CircuitsGrid  = CircuitMembersService.GetCircuitMembersByCircuitID(MinutesOfSession.CircuitID),
                CaseDefectsData  = defendents
                                   .Select(def => new CaseDefectsDataViewModel
                {
                    ID                     = def.ID,
                    Address                = def.Address,
                    Age                    = CalculateAge(def.Birthdate.Value),
                    Birthdate              = def.Birthdate,
                    CaseID                 = def.CaseID,
                    DefectID               = def.ID,
                    DefectType             = def.DefectType,
                    IsCivilRightProsecutor = def.IsCivilRightProsecutor,
                    JobName                = def.JobName,
                    Name                   = def.Name,
                    NationalID             = def.NationalID,
                    NationalityType        = def.NationalityType,
                    Nationality            = def.Nationality,
                    Order                  = def.Order,
                    PassportNumber         = def.PassportNumber,
                    PersonID               = def.PersonID,
                    Presence               = def.Presence,
                    Status                 = def.Status,
                }).Where(e => e.DefectType == PartyTypes.Defendant).OrderBy(defect => defect.Order).ToList(),
            };

            foreach (var defent in result.CaseDefectsData)
            {
                string[] li = Regex.Split(defent.Address, "/");
                if (li[0] != null)
                {
                    defent.Address = li[0];
                }
            }

            result.MinutesOfSession.Text         = SessionService.GetMinutesOfSession(MinutesOfSession.SessionID);
            result.MinutesOfSession.CourtID      = CurrentUser.CourtID;
            result.MinutesOfSession.CurentUserID = CurrentUser.ID;
            return(result);
        }
 public ActionResult CircuitMember(int CircuitID)
 {
     if (CurrentUser != null)
     {
         ViewData["SessionEnded"] = false;
         List <vw_CircuitsJudges> vw_CircuitsGrid = CircuitMembersService.GetCircuitMembersByCircuitID(CircuitID);
         RollOrderCaseViewModel   members         = new RollOrderCaseViewModel();
         members.JudgeCount = vw_CircuitsGrid.Count();
         foreach (var member in vw_CircuitsGrid)
         {
             if (member.JudgePodiumType == (int)JudgePodiumType.HeadJudge)
             {
                 members.HeadJudge = member.JudgeName;
             }
             if (member.JudgePodiumType == (int)JudgePodiumType.LeftJudge)
             {
                 members.FirstJudge = member.JudgeName;
             }
             if (member.JudgePodiumType == (int)JudgePodiumType.LeftLeftJudge)
             {
                 members.ThirdJudge = member.JudgeName;
             }
             if (member.JudgePodiumType == (int)JudgePodiumType.LeftLeftLeftJudge)
             {
                 members.FourthJudge = member.JudgeName;
             }
             if (member.JudgePodiumType == (int)JudgePodiumType.LeftLeftLeftLeftJudge)
             {
                 members.FifthJudge = member.JudgeName;
             }
             if (member.JudgePodiumType == (int)JudgePodiumType.LeftLeftLeftLeftLeftJudge)
             {
                 members.SixthJudge = member.JudgeName;
             }
             if (member.JudgePodiumType == (int)JudgePodiumType.OptionalJudge)
             {
                 members.alternativeJudge = member.JudgeName;
             }
             if (member.JudgePodiumType == (int)JudgePodiumType.RightJudge)
             {
                 members.SecondJudge = member.JudgeName;
             }
         }
         return(PartialView(members));
     }
     else
     {
         ViewData["SessionEnded"] = true;
         return(PartialView());
     }
 }