示例#1
0
 public bool AddCaseConfiguration(vw_CaseConfiguration caseConfigurationData)
 {
     try
     {
         return(CaseSessionsComponent.AddCaseConfiguration(caseConfigurationData));
     }
     catch (Exception ex)
     {
         HandleException(ex);
         return(false);
     }
 }
示例#2
0
 public bool EditCaseConfiguration(vw_CaseConfiguration caseConfigurationData)
 {
     try
     {
         return(CaseSessionsComponent.EditCaseConfiguration(caseConfigurationData));
     }
     catch (Exception ex)
     {
         HandleException(ex);
         return(false);
     }
     throw new NotImplementedException();
 }
 public bool EditCaseConfiguration(vw_CaseConfiguration caseConfigurationData)
 {
     if (caseConfigurationData.SessionID == null)
     {
         long rollID;
         var  result = CircuitRollsRepository.AddRoll(caseConfigurationData, out rollID);
         if (result == CircuitRollsSavestatus.Saved)
         {
             caseConfigurationData.SessionID = rollID;
         }
     }
     return(CaseSessionsRepository.EditCaseConfiguration(caseConfigurationData));
 }
示例#4
0
 public bool EditCaseConfiguration(vw_CaseConfiguration caseConfigurationData)
 {
     foreach (var item in caseConfigurationData.CasesIDs)
     {
         //var CaseSession = this.GetByID(item);
         Cases_CaseSessions CaseSession = DataContext.Cases_CaseSessions.Where(caseid => caseid.CaseID == item).Single();
         CaseSession.RollID = caseConfigurationData.SessionID.Value;
         CaseSession.DoneByDefaultCircuit = true;
         CaseSession.RollIndex            = 0;
         this.Update(CaseSession);
         this.Save();
     }
     return(true);
 }
示例#5
0
 public bool AddCaseConfiguration(vw_CaseConfiguration caseConfigurationData)
 {
     foreach (var item in caseConfigurationData.CasesIDs)
     {
         Cases_CaseSessions CaseSession = new Cases_CaseSessions();
         CaseSession.CaseID = item;
         CaseSession.RollID = caseConfigurationData.SessionID.Value;
         CaseSession.DoneByDefaultCircuit = true;
         CaseSession.RollIndex            = 0;
         this.Add(CaseSession);
         this.Save();
     }
     return(true);
 }
示例#6
0
 public bool UpdateRoll(vw_CaseConfiguration vw_CaseConfiguration)
 {
     try
     { foreach (var roll in vw_CaseConfiguration.CasesIDs)
       {
           CourtConfigurations_CircuitRolls Roll = DataContext.CourtConfigurations_CircuitRolls.Where(rollid => roll == vw_CaseConfiguration.SessionID).Single();
           Roll.CircuitID   = vw_CaseConfiguration.CircuitID;
           Roll.SessionDate = vw_CaseConfiguration.SessionDate;
           this.Update(Roll);
           this.Save();
       }
       return(true); }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#7
0
        public CircuitRollsSavestatus AddRoll(vw_CaseConfiguration caseConfigurationData, out long Roll_ID)
        {
            try
            {
                CourtConfigurations_CircuitRolls CircuitRollsObject = new CourtConfigurations_CircuitRolls();
                CircuitRollsObject.SessionDate  = caseConfigurationData.SessionDate;
                CircuitRollsObject.CircuitID    = caseConfigurationData.CircuitID;
                CircuitRollsObject.RollStatusID = (int)RollStatus.NotStarted;


                this.Add(CircuitRollsObject);
                this.Save();
                Roll_ID = CircuitRollsObject.ID;
                return(CircuitRollsSavestatus.Saved);
            }
            catch (Exception)
            {
                Roll_ID = 0;
                return(CircuitRollsSavestatus.Failed);
            }
        }
示例#8
0
        public CircuitRollsSavestatus AddRoll(vw_CaseConfiguration caseConfigurationData, out long Roll_ID)
        {
            CourtConfigurations_CircuitRolls CircuitRollsObject = GetAllQuery().Where(circuitRoll => circuitRoll.CaseTypeID == ((vw_FaultCaseConfiguration)caseConfigurationData).CaseTypeID &&
                                                                                      circuitRoll.CircuitID == caseConfigurationData.CircuitID &&
                                                                                      circuitRoll.SessionDate == caseConfigurationData.SessionDate)
                                                                  .FirstOrDefault();

            if (CircuitRollsObject == null)
            {
                CircuitRollsObject = new CourtConfigurations_CircuitRolls
                {
                    SessionDate  = caseConfigurationData.SessionDate,
                    CircuitID    = caseConfigurationData.CircuitID,
                    CaseTypeID   = ((vw_FaultCaseConfiguration)caseConfigurationData).CaseTypeID,
                    RollStatusID = (int)RollStatus.NotStarted
                };
                this.Add(CircuitRollsObject);
                this.Save();
            }
            Roll_ID = CircuitRollsObject.ID;
            return(CircuitRollsSavestatus.Saved);
        }
示例#9
0
 public bool UpdateRoll(vw_CaseConfiguration vw_CaseConfiguration)
 {
     return(RollsComp.UpdateRoll(vw_CaseConfiguration));
 }
示例#10
0
 public bool AddCaseConfiguration(vw_CaseConfiguration caseConfigurationData)
 {
     return(true);
 }
示例#11
0
 public bool UpdateRoll(vw_CaseConfiguration vw_CaseConfiguration)
 {
     throw new NotImplementedException();
 }
示例#12
0
 public bool UpdateRoll(vw_CaseConfiguration vw_CaseConfiguration)
 {
     return(CircuitRollsRepository.UpdateRoll(vw_CaseConfiguration));
 }
        public ActionResult EditSessions(CaseDataViewModels model)
        {
            if (CurrentUser != null)
            {
                try
                {
                    string[]   cases    = (string[])Session["Cases"];
                    List <int> CasesIDs = new List <int>();
                    if (cases != null)
                    {
                        foreach (var _case in cases)
                        {
                            CasesIDs.Add(Convert.ToInt32(_case));
                        }
                        model.caseConfigurationData.caseConfiguration.Cases = CasesIDs;
                    }
                    if (ModelState.IsValid)
                    {
                        List <vw_KeyValueLongID> Sessions = caseSessionsService.GetCircuitRolls(model.caseConfigurationData.caseConfiguration.CircuitID).Select(x =>
                                                                                                                                                                new vw_KeyValueLongID()
                        {
                            ID   = x.ID,
                            Name = x.Date.ToShortDateString()
                        }).ToList();

                        CaseConfigurationViewModel caseConfigurationViewModel = new CaseConfigurationViewModel();

                        caseConfigurationViewModel.CircuitID   = model.caseConfigurationData.caseConfiguration.CircuitID;
                        caseConfigurationViewModel.SessionID   = model.caseConfigurationData.caseConfiguration.SessionID;
                        caseConfigurationViewModel.SessionDate = Sessions.Where(x => x.ID == model.caseConfigurationData.caseConfiguration.SessionID).Select(z => Convert.ToDateTime(z.Name)).SingleOrDefault();
                        caseConfigurationViewModel.Cases       = CasesIDs;
                        int?rollid = RollService.GetRollID(caseConfigurationViewModel.CircuitID, caseConfigurationViewModel.SessionDate);

                        vw_CaseConfiguration caseConfiguration = GetConfigurationData(caseConfigurationViewModel);
                        caseConfiguration.SessionID = rollid;
                        if (caseSessionsService.EditCaseConfiguration(caseConfiguration))
                        {
                            return(JavaScript("$(document).trigger('Session:Saved')"));
                            //PartialView(FillLists());
                        }


                        else
                        {
                            return(CPartialView().WithSuccessMessages(JIC.Base.Resources.Messages.OperationCompletedSuccessfully));
                        }
                    }
                    model.caseConfigurationData.Circuits = circuitService.GetCircuitsByCourtID(CurrentUser.CourtID.Value).ToList();
                    if (Session["Sessions"] != null)
                    {
                        model.caseConfigurationData.Sessions = (List <vw_KeyValueLongID>)Session["Sessions"];
                    }
                    ViewData["SessionEnded"] = false;
                    return(CPartialView(model));
                }
                catch (Exception ex)
                {
                    return(ErrorPage(ex));
                }
            }

            else
            {
                ViewData["SessionEnded"] = true;
                return(CPartialView());
            }
        }