예제 #1
0
        /// <summary>
        /// Type switch statement
        /// </summary>
        /// <param name="source">
        /// The object to perform type switch on
        /// </param>
        /// <param name="cases">
        /// The different cases of actions to perform. Note that
        /// more generic types should be put at the end of the case collection
        /// </param>
        public static void Switch(object source, params CaseInformation[] cases)
        {
            var             type         = source.GetType();
            CaseInformation defaultEntry = null;

            foreach (var entry in cases)
            {
                // Checks for the default case or whether the object is of the specific
                // type or inherited type
                if (entry.IsDefault)
                {
                    defaultEntry = entry;
                }
                else if (entry.Target.IsAssignableFrom(type))
                {
                    entry.Action(source);
                    break;
                }
            }

            if (defaultEntry != null)
            {
                defaultEntry.Action(source);
            }
        }
예제 #2
0
    // Function to return to main menu
    public void ReturnToMainMenu()
    {
        // Reset the static class's data so a new case can be fetched on the next entry
        CaseInformation.ResetCaseInformation();

        // Return Player to Main Menu
        SceneManager.LoadScene("MainMenu");
    }
    // Button handler functions
    #region ButtonHandlers

    // Function to return to main menu
    public void ContinueButtonHandler()
    {
        // Reset the static player data so the next entry into
        // the Play loop is a clean slate
        CaseInformation.ResetCaseInformation();

        SceneManager.LoadScene("MainMenu");
    }
    // Start is called before the first frame update
    void Start()
    {
        // Establish UI element Gameobject reference
        textObject  = GameObject.FindGameObjectWithTag("InitialDataText");
        initialText = textObject.GetComponent <Text>();

        // Get new record from Database
        CaseInformation.get_patient_data();

        // Display Initial Data on the Play page
        DisplayData();
    }
예제 #5
0
        private CaseInformation CreateCaseInformation(Guid caseId)
        {
            CaseInformation caseInformation = new CaseInformation();

            caseInformation.CaseId = caseId;
            int rnd = Random.Next(3);

            caseInformation.Priority   = (PriorityType)rnd;
            caseInformation.CreatedOn  = CreateRandomDate(3);
            caseInformation.ModifiedOn = CreateRandomDate(3);
            return(caseInformation);
        }
 public void DeleteCaseInformationByCaseId(Guid caseId)
 {
     try
     {
         List <CaseInformation> caseInformationList = this.CaseInformationRepository.Find(c => c.CaseId == caseId);
         if (caseInformationList?.Count != 0)
         {
             CaseInformation caseInformation = caseInformationList.First();
             this.CaseInformationRepository.Delete(caseInformation);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
 public CaseInformationDto EditCaseInformation(CaseInformationDto caseInformationDto)
 {
     try
     {
         if (caseInformationDto == null)
         {
             return(null);
         }
         CaseInformation caseInformation = this.CaseInformationMapper.DtoToModel(caseInformationDto);
         caseInformation = this.CaseInformationRepository.Update(caseInformation);
         return(this.CaseInformationMapper.ModelToDto(caseInformation));
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
 public CaseInformationDto AddNewCaseInformation(CaseInformationDto caseInformationDto, Guid caseId)
 {
     try
     {
         if (caseInformationDto == null)
         {
             return(null);
         }
         CaseInformation caseInformation = CaseInformationMapper.DtoToModel(caseInformationDto);
         caseInformation.CaseId = caseId;
         caseInformation        = this.CaseInformationRepository.Add(caseInformation);
         return(this.CaseInformationMapper.ModelToDto(caseInformation));
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
 public CaseInformationDto GetCaseInformationByCaseId(Guid caseId)
 {
     try
     {
         List <CaseInformation> caseInformationList = this.CaseInformationRepository.Find(c => c.CaseId == caseId);
         if (caseInformationList.Count != 0)
         {
             CaseInformation caseInformation = caseInformationList.First();
             return(this.CaseInformationMapper.ModelToDto(caseInformation));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }