Exemple #1
0
        /// <summary>Processes a client request.</summary>
        /// <param name="clientRequest">The client request to process.</param>
        protected virtual void Process(ClientRequest clientRequest)
        {
            if (clientRequest is null)
            {
                throw new ArgumentNullException(nameof(clientRequest));
            }
            try
            {
                switch (clientRequest.RequestedAction)
                {
                case RequestedAction.GetAllCases:
                    CasesDataAccess  caseDataAccess = new CasesDataAccess();
                    List <Case>      cases          = new List <Case>();
                    Case[]           caseArray      = cases.ToArray();
                    TransmissionData transmission   = new TransmissionData(caseArray);
                    RespondToClient(transmission);
                    break;

                case RequestedAction.GetAllSummerysById:
                    SummeryDataAccess     summeryDataAccess = new SummeryDataAccess();
                    List <MettingSummery> summery           = summeryDataAccess.GetAllSummerysById();
                    TransmissionData      transmissionSum   = new TransmissionData(summery);
                    RespondToClient(transmissionSum);
                    break;

                case RequestedAction.GetAllCaseKinds:
                    break;

                case RequestedAction.SaveNewSummery:
                    SummeryDataAccess summeryData = new SummeryDataAccess();
                    foreach (MettingSummery item in clientRequest.Data.Entities)
                    {
                        summeryData.SafeSummery(item);
                    }

                    break;

                case RequestedAction.SaveNewCase:
                    CasesDataAccess caseData = new CasesDataAccess();
                    foreach (Case item in clientRequest.Data.Entities)
                    {
                        caseData.AddCase(item);
                    }
                    break;

                case RequestedAction.GetAllSecretaries:
                    break;

                case RequestedAction.GetAllCommands:
                    break;

                default:
                    break;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public void SecretaryAddCaseToDB()
        {
            //assert
            Case            tempCase           = new Case("test", CaseKind.kriminal, new Lawyer("something"), new Client("something", 1), new MettingSummery("something", new Secretary("something")));
            CasesDataAccess tempCaseDataAccess = new CasesDataAccess();
            //act
            List <Case> cases = tempCaseDataAccess.GetCases();

            tempCaseDataAccess.AddCase(tempCase);
            List <Case> result = tempCaseDataAccess.GetCases();

            //arange
            Assert.AreNotEqual(result.Count, cases.Count);
        }