Exemplo n.º 1
0
        private void Tab1RequestCaseButton_Click(object sender, RoutedEventArgs e)
        {

            String caseId = String.Empty;

            try
            {
                caseId = Tab1CaseListBox.SelectedItem.ToString();
            }
            catch
            {
            }

            CaseMessage message = new CaseMessage();
            message.CaseId = caseId;
            message.WorkstationId = m_AWSId;

            //make case directory
            if (!Directory.Exists("C:\\Reena"))
                Directory.CreateDirectory("C:\\Reena");

            String DirName = "C:\\Reena\\" + caseId;
            if (!Directory.Exists(DirName))
                Directory.CreateDirectory(DirName);

            try
            {
                //get case xml file
                CaseRequestMessageResponse response = m_AWSCommEndPoint1.RequestCase(message);

                FileStream casexml = new FileStream(DirName + "\\case.xml", FileMode.Create);
                response.file.CopyTo(casexml);
                casexml.Close();
                response.file.Close();
                //GetCaseFiles(DirName, caseid);
                m_ActiveCase = caseId;
            }
            catch (FaultException exp)
            {
                Tab1LogListBox.Items.Add(exp.Message);
            }
        }
Exemplo n.º 2
0
        public override CaseRequestMessageResponse RequestCase(CaseMessage message)
        {
            try
            {
                Boolean caseAvailable = false;
                String caseArea = String.Empty;

                if (!String.IsNullOrWhiteSpace(message.CaseId))
                {
                    lock (m_CaseListLock)
                    {
                        try
                        {
                            if (EnableArchiveDecision && message.IsCaseEditable)
                            {
                                caseAvailable = base.IsCaseAvailable(message.CaseId, message.WorkstationId);

                                if (caseAvailable)
                                {
                                    base.AssignId(message.CaseId, message.WorkstationId);
                                }
                            }
                            else
                            {
                                caseAvailable = true;
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }

                    if (caseAvailable)
                    {
                        if(EnableArchiveDecision && message.IsCaseEditable)
                            CaseListUpdateEvent(message.CaseId, message.WorkstationId.ToString(), true);

                        try
                        {
                            return base.RequestCase(message);
                        }
                        catch (Exception ex)
                        {
                            throw new FaultException(new FaultReason(ex.Message));
                        }
                    }
                    else
                    {
                        throw new FaultException(new FaultReason(ErrorMessages.CASE_CURRENTLY_IN_USE));
                    }
                }

                throw new FaultException(new FaultReason(ErrorMessages.CASE_ID_INVALID));
            }
            catch (Exception ex)
            {
                //throw ex;
                throw new FaultException(new FaultReason(ex.Message));
            }
        }
Exemplo n.º 3
0
        public override CaseRequestMessageResponse RequestCase(CaseMessage message)
        {
            try
            {
                lock (m_CaseListLock)
                {
                    //if caseId is empty then auto select a case for this workstation
                    if (String.IsNullOrWhiteSpace(message.CaseId))
                    {
                        //for load balancing figure out whether this workstation should get the requested case
                        string workstation = GetNextLoadBalanceWorkstationId(message.WorkstationId);

                        //string[] caseIdList = null;// string.Empty;//GetAssignedCaseID(workstation);

                        //if (caseIdList == null || caseIdList.Length == 0)
                        //{

                            //select next available case from the case list that matches the workstation mode(Analyst or ManualCodig)
                            message.CaseId = GetUnassignedCaseId(message.WorkstationMode);
                        //}
                        //else
                        //{
                        //    message.CaseId = caseIdList[0];
                        //}

                        //case id is empty there are currently no live cases
                        if (String.IsNullOrWhiteSpace(message.CaseId))
                        {
                            throw new FaultException(new FaultReason(ErrorMessages.NO_LIVE_CASE));
                        }
                        else if (workstation != message.WorkstationId)
                        {
                            throw new FaultException(new FaultReason(ErrorMessages.LOAD_BALANCE_DELAY_CASE_REQUEST));
                        }                        
                    }

                    if (IsCaseAvailable(message.CaseId, message.WorkstationId))
                    {
                        CaseRequestMessageResponse response = base.RequestCase(message);

                        string ftiFile = string.Empty;

                        if (m_TIPManagerComm != null)
                        {
                            ftiFile = m_TIPManagerComm.RequestFTIFile(message.WorkstationId);
                        }

                        if (!String.IsNullOrWhiteSpace(ftiFile))
                        {
                            response.AdditionalFiles.Add(FileType.FTIFile, ftiFile);
                            response.caseType = L3.Cargo.Communications.Interfaces.CaseType.FTICase;
                            ClearAssignment(message.CaseId);
                        }
                        else
                        {
                            string caseArea = string.Empty;

                            if (caseList.IsCTI(message.CaseId))
                            {
                                m_TIPManagerComm.AssignCTICase(message.CaseId, message.WorkstationId);
                                response.caseType = L3.Cargo.Communications.Interfaces.CaseType.CTICase;
                                caseArea = l3.cargo.corba.WorkstationArea.AWS.ToString();
                            }
                            else
                            {
                                caseArea = m_CargoHostEndPoint.GetCase(message.CaseId).getCurrentArea();
                                response.caseType = L3.Cargo.Communications.Interfaces.CaseType.LiveCase;
                            }

                            lock (_updateCaseAssignmentLock)
                            {
                                base.AssignId(message.CaseId, message.WorkstationId);
                                CaseListUpdateEvent(message.CaseId, message.WorkstationId, caseArea, true);
                                //Set this workstation has currently requested case and increment number of cases requested                         
                                IncrementLoadBalanceNumRequestedCases(message.WorkstationId, true);
                            }
                        }

                        return response;
                    }
                    else
                    {
                        throw new FaultException(new FaultReason(ErrorMessages.CASE_CURRENTLY_IN_USE));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new FaultException(new FaultReason(ex.Message));
            }            
        }