/// <summary>
 /// Updates the Customer Details to DB
 /// </summary>
 /// <param name="UpdatedCustomer">Customer Model with updated fields</param>
 public void SetClaimDetails(Customer UpdatedCustomer)
 {
     UpdatedCustomer.SetCustomerDetails();
 }
 /// <summary>
 /// Loads the Customer Details and required Titles from DB 
 /// </summary>
 /// <param name="CustomerID">CustomerID</param>
 public void GetClaimDetails(int CustomerID)
 {
     Customers = new Customer();
     Customers.GetAllTitles();
     Customers.GetCustomerDetails(CustomerID);
 }
 /// <summary>
 /// Search the Claim by LeadID and returns CustomerID to be used by the SDK
 /// </summary>
 /// <param name="LeadID">LeadID</param>
 /// <returns>CustomerID</returns>
 public int SearchClaim(int LeadID)
 {
     int CustomerID = 0;
     Customer tempCustomer = new Customer();
     CustomerID = tempCustomer.GetCustomerID(LeadID);
     return CustomerID;
 }
        //create a top level SDK object can use for everything
        //
        // GET: /TestEvent/
        public ActionResult Main()
        {
            AquariumEventManagement.EventManagementSoapClient theEventSDKClient = new AquariumEventManagement.EventManagementSoapClient();
            AquariumEventManagement.SessionDetails sd = SDKHelper.GetSessionDetails<AquariumEventManagement.SessionDetails>("User");

            Customer testCustomer = new Customer();
            int CustomerID = testCustomer.GetCustomerID(975033);

            Case testCase = new Case();
            int TestCaseID = testCase.GetCaseID(CustomerID);
            DiaryEvent theTopLevelEvent_AvailableThreadsContainer = new DiaryEvent();
            theTopLevelEvent_AvailableThreadsContainer.theAvailableEventsAndTheirThreads = new List<DiaryEvent>();

            AquariumEventManagement.EventResult AllowedCaseThreads = theEventSDKClient.GetAllowedCaseEventThreads(sd, TestCaseID);
            //get all the in process

            if(AllowedCaseThreads.AllowedCaseEventThreads.Count() >= 1)
            {

                //add a default event that does f**k all for the drop down list

                string[] EventAndThread;

                for (int i = 0; i < AllowedCaseThreads.AllowedCaseEventThreads.Count(); i++)
                {

                    //split the array
                    EventAndThread = AllowedCaseThreads.AllowedCaseEventThreads[i].Value.Split('|');
                    //get erm....the LeadEventID
                    AquariumEventManagement.EventResult theLeadEvent = theEventSDKClient.GetLeadEvent(sd, Convert.ToInt32(EventAndThread[0]));

                    theTopLevelEvent_AvailableThreadsContainer.theAvailableEventsAndTheirThreads.Add(new DiaryEvent
                    {
                           EventName = AllowedCaseThreads.AllowedCaseEventThreads[i].Text,
                           LeadEventID = Convert.ToInt32(EventAndThread[0]),
                           EventThread = Convert.ToInt32(EventAndThread[1]),
                           LeadEventIDThreadComposite = AllowedCaseThreads.AllowedCaseEventThreads[i].Value,
                           ParentSDKResult = AllowedCaseThreads,
                           EventTypeID = Convert.ToInt32(theLeadEvent.LeadEvent.EventTypeID),
                           WhenCreated = theLeadEvent.LeadEvent.WhenCreated,
                           WhoCreated = Convert.ToInt32(theLeadEvent.LeadEvent.WhoCreated),
                           LeadDocumentID = Convert.ToInt32(theLeadEvent.LeadEvent.LeadDocumentID)

                    });

                }

                //NOW WE WANT TO GET THE NEXT EVENTS, MAYBE?? OR ARE THESE THE NEXT EVENTS??
                for (int i = 0; i < theTopLevelEvent_AvailableThreadsContainer.theAvailableEventsAndTheirThreads.Count(); i++)
                {
                    List<DiaryEvent> NextEvents = GetNextEventsForAllowedEventsThreads(theTopLevelEvent_AvailableThreadsContainer.theAvailableEventsAndTheirThreads.ElementAt(i));

                    theTopLevelEvent_AvailableThreadsContainer.theAvailableEventsAndTheirThreads.ElementAt(0).theNextEventsAfterThisEvent = NextEvents;
                }

                //NOW GET THE LOADED EVENTS, INCLUDING MANDATORY AND HELPER FIELDS
                //GetLoadedNextEventsForLeadEvent(theTopLevelEvent_AvailableThreadsContainer.theAvailableEventsAndTheirThreads.ElementAt(0).theNextEventsAfterThisEvent.ElementAt(0));

                //get the oop events

                //get the note types

                List<DiaryEvent> oopEvents = DiaryEvent.GetOOPEvents(261);

                //List<DiaryEvent> noteTypes = DiaryEvent.GetNoteTypes();

            List<DiaryDetailField> aListOfFields = new List<DiaryDetailField>();
            //aListOfFields = DiaryEvent.GetMandatoryFieldsForLeadEvent(65685, 975033, 1038013);

            }

            return View();
        }