public ActionResult Create(int CircuitID) { if (CurrentUser != null) { ViewData["SessionEnded"] = false; OpenRollViewModel OPenRoll = new OpenRollViewModel() { CircuitID = CircuitID, CourtID = CurrentUser.CourtID, CurentUserID = CurrentUser.ID }; OpenRollCreateViewModel _AllViewModel = PrepareViewModel(OPenRoll); _AllViewModel.ListCasesInRoll = PrepareOrder(_AllViewModel.ListCasesInRoll); //if (_AllViewModel.ListCasesInRoll.First().rollStatus == RollStatus.NotStarted) //{ // _AllViewModel.OPenRoll.CircuitID = _AllViewModel.ListCasesInRoll.First().CircuitID; // ViewBag.Saved = true; //} _AllViewModel = DayNameChange(_AllViewModel); return(PartialView(_AllViewModel)); } else { ViewData["SessionEnded"] = true; return(PartialView()); } }
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 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 دقيقة")); } }
public ActionResult Create(OpenRollViewModel OPenRoll) { if (CurrentUser != null) { ViewData["SessionEnded"] = false; if (ModelState.IsValid) { var OpenSessionRollResult = RollService.OpenSessionRoll(OPenRoll.prosecutorID, OPenRoll.HallID, OPenRoll.RollID); OPenRoll.rollStatus = OpenSessionRollResult; switch (OpenSessionRollResult) { case RollStatus.NotSorted: return(CPartialView(PrepareViewModel(OPenRoll)).WithErrorMessages("لا يمكن فتح رول الجلسة لأنه لم يتم ترتيب الرول")); case RollStatus.PreviousRollNotClosed: return(CPartialView(PrepareViewModel(OPenRoll)).WithErrorMessages("لا يمكن فتح رول الجلسة لأنه لم يتم غلق الرول السابق")); case RollStatus.InProgress: ViewBag.Saved = true; return(CPartialView(PrepareViewModel(OPenRoll)).WithSuccessMessages("تم فتح الرول")); case RollStatus.OtherRollOpenForSecretary: return(CPartialView(PrepareViewModel(OPenRoll)).WithErrorMessages("نفس الرول مفتوح من امين سر اخر ")); case RollStatus.EmptyRoll: return(CPartialView(PrepareViewModel(OPenRoll)).WithErrorMessages("لا يوجد قضايا فى الرول")); } } return(PartialView(PrepareViewModel(OPenRoll))); } else { ViewData["SessionEnded"] = true; return(PartialView()); } }