// GET: ALLMinutesOfSession public ActionResult Index(int id, int SessionID, int CircuitID) { if (CurrentUser != null) { vw_SessionData Session = SessionService.GetSessionData(SessionID); MinutesOfSessionViewModel model = new MinutesOfSessionViewModel() { CaseID = id, SessionID = SessionID, CircuitID = CircuitID, CourtID = CurrentUser.CourtID, CurentUserID = CurrentUser.UserTypeID , RollID = Session.RollID, }; if (DefectsService.IsPresenceSaved(SessionID)) { model.SaveAttendance = true; } else { model.SaveAttendance = false; } if (SessionService.IsSessionMinutesSaved(SessionID)) { model.SaveMinutes = true; } else { model.SaveMinutes = false; } if (decisionService.IsDecisionSaved(id, SessionID)) { model.SavedDecisions = true; } else { model.SavedDecisions = false; } if (SessionService.IsSessionSentToJudge(SessionID)) { model.SentToJudge = true; } else { model.SentToJudge = false; } return(View(model)); } else { return(RedirectTo(Url.Action("login", "User", new { returnUrl = "/" })).WithErrorMessages("تم الخروج بشكل تلقائى لعدم التفاعل اكثر من 15 دقيقة")); } }
private OpenRollCreateViewModel PrepareViewModel(OpenRollViewModel OPenRoll = null) { if (OPenRoll == null) { OPenRoll = new OpenRollViewModel(); } OpenRollCreateViewModel model = new OpenRollCreateViewModel() { ListCasesInRoll = RollService.GetRollCasesForOpening(OPenRoll.CircuitID, CurrentUser.ID) .Select(roll => new OpenRollViewModel { SessionID = roll.SessionID, Order = roll.Order, CaseID = roll.CaseID, CaseStatus = roll.CaseStatus, OverAllNumber = roll.OverAllNumber, FirstLevelNumber = roll.FirstLevelNumber, SecondLevelNumber = roll.SecondLevelNumber, MainCrime = roll.MainCrime, SecretaryID = roll.SecretaryID, RollID = roll.RollID, //CircuitID=roll.CircuitID, // rollStatus=roll.rollStatus, }).ToList(), // SessionData = SessionService.GetSessionData(OPenRoll.CircuitID), Circuits = CircuitService.GetCircuitsBySecretairyID(CurrentUser.ID, CurrentUser.CourtID), OPenRoll = OPenRoll, Prosecutors = ProsecutorService.GetProsecutor(CurrentUser.CourtID) .Select(pros => new ProsecutorViewModels { ID = pros.ID, ProcecutoerName = pros.ProcecutoerName, }).ToList(), Halls = LookupService.GetCourtHalls(IsAuthenticatied ? CurrentUser.CourtID : null), }; if (model.ListCasesInRoll.Count() != 0) { model.OPenRoll.RollID = model.ListCasesInRoll.Select(e => e.RollID).FirstOrDefault(); } if (model.ListCasesInRoll.Any(e => e.Order == 0)) { model.OPenRoll.rollStatus = RollStatus.NotSorted; } model.ListCasesInRoll = PrepareOrder(model.ListCasesInRoll); vw_SessionData SessionDate = new vw_SessionData(); SessionDate.SessionDate = DateTime.Now; model.SessionData = SessionDate; model.OPenRoll.CourtID = CurrentUser.CourtID; model.OPenRoll.CurentUserID = CurrentUser.ID; return(model); }
public void AddSession(vw_SessionData SessionData) { Cases_CaseSessions SessionObj = new Cases_CaseSessions(); Add(new Cases_CaseSessions { CaseID = SessionData.CaseID, RollID = SessionData.RollID, DoneByDefaultCircuit = SessionData.DoneByDefaultCircuit, ApprovedByJudge = SessionData.ApprovedByJudge, RollIndex = SessionData.RollIndex }); }
public ActionResult OPenRoll(int CircuitID) { if (CurrentUser != null) { ViewData["SessionEnded"] = false; OpenRollViewModel OPenRoll = new OpenRollViewModel() { CircuitID = CircuitID, CourtID = CurrentUser.CourtID, CurentUserID = CurrentUser.ID }; OpenRollCreateViewModel _AllViewModel = new OpenRollCreateViewModel(); _AllViewModel.OPenRoll = OPenRoll; vw_SessionData SessionDate = new vw_SessionData(); SessionDate.SessionDate = RollService.GetOpenedRolls(CurrentUser.ID).Select(e => e.RollDate).First(); _AllViewModel.SessionData = SessionDate; _AllViewModel.ListCasesInRoll = RollService.GetOpenedRolls(CurrentUser.ID) .Select(roll => new OpenRollViewModel { SessionID = roll.SessionID, Order = roll.Order, CaseID = roll.CaseID, CaseStatus = roll.CaseStatus, OverAllNumber = roll.OverAllNumber, FirstLevelNumber = roll.FirstLevelNumber, SecondLevelNumber = roll.SecondLevelNumber, MainCrime = roll.MainCrime, SecretaryID = roll.SecretaryID, }).ToList(); _AllViewModel.ListCasesInRoll = PrepareOrder(_AllViewModel.ListCasesInRoll); _AllViewModel = DayNameChange(_AllViewModel); return(PartialView(_AllViewModel)); } else { ViewData["SessionEnded"] = true; return(PartialView()); } }
public ActionResult CompleteOPenRoll(int SessionID) { if (CurrentUser != null) { OpenRollViewModel OPenRoll = new OpenRollViewModel() { SessionID = SessionID, }; OpenRollCreateViewModel _AllViewModel = new OpenRollCreateViewModel(); _AllViewModel.OPenRoll = OPenRoll; vw_SessionData SessionDate = new vw_SessionData(); SessionDate.SessionDate = RollService.GetCasesINRoll(SessionID).Select(e => e.RollDate).FirstOrDefault(); _AllViewModel.SessionData = SessionDate; _AllViewModel.ListCasesInRoll = RollService.GetCasesINRoll(SessionID) .Select(roll => new OpenRollViewModel { SessionID = roll.SessionID, Order = roll.Order, CaseID = roll.CaseID, CaseStatus = roll.CaseStatus, OverAllNumber = roll.OverAllNumber, FirstLevelNumber = roll.FirstLevelNumber, SecondLevelNumber = roll.SecondLevelNumber, MainCrime = roll.MainCrime, SecretaryID = roll.SecretaryID, CircuitID = roll.CircuitID, }).ToList(); _AllViewModel.ListCasesInRoll = PrepareOrder(_AllViewModel.ListCasesInRoll); _AllViewModel = DayNameChange(_AllViewModel); return(View(_AllViewModel)); } else { return(RedirectTo(Url.Action("login", "User", new { returnUrl = "/" })).WithErrorMessages("تم الخروج بشكل تلقائى لعدم التفاعل اكثر من 15 دقيقة")); } }
///////// check ApprovedByJudge from CaseSessions in case of editing Decision public SaveDecisionStatus SaveDecision(vw_CaseDecision DecisionData) { try { // From SessionID get CaseID & RollID to set old rollID DecisionData.RollID = SessionsComp.GetRollID(DecisionData.CaseSessionID); DecisionData.OldCircuitID = SessionsComp.GetCircuitID(DecisionData.CaseSessionID); // check RollStatusID from CircuitRolls before Saving data if (!RollsComp.IsRollOpened((int)DecisionData.RollID)) { return(SaveDecisionStatus.RollNotOpenedYet); } if (SessionsComp.IsSentToJudge(DecisionData.CaseSessionID)) { return(SaveDecisionStatus.SessionSentToJudge); } if (RollsComp.IsApprovedByJudge((int)DecisionData.RollID)) { return(SaveDecisionStatus.SentToJudge); } DeleteIfSavedBefore(DecisionData); // override saved before decision if (DecisionData.DecisionLevel == DecisionLevels.Post || (DecisionData.DecisionLevel == DecisionLevels.Decision && DecisionData.DecisionType == DecisionTypes.L3_Postponed)) { //check if new roll exist, if not create it DecisionData.RollID = SetNewRollID((int)DecisionData.CycleRollID, (int)DecisionData.OldCircuitID, (DateTime)DecisionData.NextSessionDate); vw_SessionData SessionData; SessionData = new vw_SessionData { CaseID = DecisionData.CaseID, RollID = (int)DecisionData.RollID, DoneByDefaultCircuit = true, ApprovedByJudge = false, RollIndex = 0 }; // add session for the created roll SessionsComp.AddSession(SessionData); } // Save Decision DecisionsComp.SaveDecision(DecisionData); Event(new CaseDessionSaved { CaseID = DecisionData.CaseID, DecisionLevel = DecisionData.DecisionLevel, ReservedForJudgement = DecisionData.ReservedForJudgement, DecisionType = DecisionData.DecisionType }); if (DecisionData.DecisionLevel == DecisionLevels.Final) { foreach (vw_DefendantsDecisionData Def in DecisionData.DefendantsListJudges) { if (Def.DecisionType == (int)DecisionTypes.L1_Guilty) { Def.IsGuilty = true; } else if (Def.DecisionType == (int)DecisionTypes.L1_NotGuilty) { Def.IsGuilty = false; } Def.SessionDessionId = DecisionData.CaseSessionID; DefentantsComp.AddDefendantDecision(Def); } } return(SaveDecisionStatus.Saved); } catch (DbEntityValidationException ex) { HandleException(ex); return(SaveDecisionStatus.Failed_To_Save); } }
public void AddSession(vw_SessionData SessionData) { sessionsRepository.AddSession(SessionData); }