コード例 #1
0
ファイル: WSServer.cs プロジェクト: BdGL3/CXPortal
        public override void UpdateCase(UpdateCaseMessage message)
        {
            if (caseList.AssignedId(message.CaseId) == message.WorkstationId)
            {
                if (message.Type == CaseUpdateEnum.ReleaseCase)
                {
                    try
                    {
                        m_CargoHostEndPoint.ReleaseCase(message.CaseId);
                        SetLoadBalancecaseRequestedCurrently(message.WorkstationId, false);

                        if (m_TIPManagerComm != null)
                        {
                            m_TIPManagerComm.ProcessedCase(message.CaseId);
                        }
                    }
                    catch (Exception exp)
                    {
                        throw new FaultException(new FaultReason(exp.Message));
                    }
                }
                else if (message.Type == CaseUpdateEnum.CloseCase && message.CaseType != L3.Cargo.Communications.Interfaces.CaseType.FTICase)
                {
                    lock (_updateCaseAssignmentLock)
                    {
                        base.ClearAssignment(message.CaseId);
                        CaseListUpdateEvent(message.CaseId, string.Empty, string.Empty, true);

                        if (message.CaseType == L3.Cargo.Communications.Interfaces.CaseType.CTICase)
                        {
                            m_TIPManagerComm.RemoveCTICaseAssignment(message.CaseId);
                            CaseListUpdateEvent(message.CaseId, String.Empty, String.Empty, false);
                            base.caseList.Delete(message.CaseId);
                        }
                    }
                }
                else if (message.Type == CaseUpdateEnum.CloseCase && message.CaseType == L3.Cargo.Communications.Interfaces.CaseType.FTICase)
                {
                    WorkstationResult result = new WorkstationResult();

                    TimeSpan analysisTime = DateTime.Now.Subtract(DateTime.Parse(message.CreateTime));

                    result.AnalysisTime = (uint)analysisTime.TotalSeconds;
                    result.CaseId = message.CaseId;
                    result.CaseType = message.CaseType;
                    result.Comment = string.Empty;
                    result.CreateTime = message.CreateTime;
                    result.Decision = WorkstationDecision.Unknown;
                    result.Reason = WorkstationReason.NotApplicable;
                    result.UserName = message.UserName;
                    result.WorkstationId = message.WorkstationId;
                    m_TIPManagerComm.TipResult(result);
                }
                else if (message.Type == CaseUpdateEnum.Result)
                {
                    try
                    {
                        if (message.CaseType == L3.Cargo.Communications.Interfaces.CaseType.CTICase ||
                            message.CaseType == L3.Cargo.Communications.Interfaces.CaseType.FTICase)
                        {
                            if (message.workstationResult.CaseType == L3.Cargo.Communications.Interfaces.CaseType.CTICase)
                            {
                                lock (_updateCaseAssignmentLock)
                                {
                                    CaseListUpdateEvent(message.CaseId, String.Empty, String.Empty, false);
                                    base.caseList.Delete(message.CaseId);
                                }
                            }

                            m_TIPManagerComm.TipResult(message.workstationResult);
                        }
                        else
                        {
                            l3.cargo.corba.Result result = new l3.cargo.corba.Result();
                            result.mAnalysisTime = message.workstationResult.AnalysisTime.ToString();
                            result.mComment = message.workstationResult.Comment;
                            result.mCreateTime = message.workstationResult.CreateTime;

                            if (message.workstationResult.Decision == WorkstationDecision.Unknown)
                                result.mDecision = l3.cargo.corba.ResultDecision.RESULT_UNKNOWN;
                            else if (message.workstationResult.Decision == WorkstationDecision.Reject)
                                result.mDecision = l3.cargo.corba.ResultDecision.REJECT;
                            else if (message.workstationResult.Decision == WorkstationDecision.Clear)
                                result.mDecision = l3.cargo.corba.ResultDecision.CLEAR;
                            else
                                result.mDecision = l3.cargo.corba.ResultDecision.CAUTION;

                            result.mReason = message.workstationResult.Reason.ToString();
                            result.mStationType = message.workstationResult.WorkstationType;
                            result.mUserName = message.workstationResult.UserName;

                            m_CargoHostEndPoint.SetResult(message.CaseId, result);
                        }
                    }
                    catch (Exception exp)
                    {
                        throw new FaultException(new FaultReason(exp.Message));
                    }
                }
                else if (message.CaseType == L3.Cargo.Communications.Interfaces.CaseType.FTICase || message.CaseType == L3.Cargo.Communications.Interfaces.CaseType.CTICase)
                {
                    //Do Nothing
                }
                else if (message.Type == CaseUpdateEnum.AttachFile)
                {
                    String TempDirectory = ConfigurationManager.AppSettings["hostTempDirectory"];
                    try
                    {
                        if (!Directory.Exists(TempDirectory))
                        {
                            Directory.CreateDirectory(TempDirectory);
                        }

                        using (FileStream stream = new FileStream(Path.Combine(TempDirectory, message.Filename), FileMode.OpenOrCreate))
                        {
                            message.File.CopyTo(stream);
                        }

                        m_CargoHostEndPoint.AddAttachment(message.CaseId, Path.Combine(TempDirectory, message.Filename),
                            message.AttachFileType.ToString(), message.UserName, message.CreateTime);
                    }
                    catch (Exception exp)
                    {
                        throw new FaultException(new FaultReason(exp.Message));
                    }
                }
                else if (message.Type == CaseUpdateEnum.ObjectID)
                {
                    try
                    {
                        m_CargoHostEndPoint.SetContainerID(message.CaseId, message.ObjectId);
                    }
                    catch (Exception exp)
                    {
                        throw new FaultException(new FaultReason(exp.Message));
                    }
                }
            }
        }
コード例 #2
0
ファイル: ACSServer.cs プロジェクト: BdGL3/CXPortal
        public override void UpdateCase(UpdateCaseMessage message)
        {

            if ((message.Type == CaseUpdateEnum.CloseCase) ||
                (message.Type == CaseUpdateEnum.ReleaseCase))
            {
                try
                {
                    if (EnableArchiveDecision)
                    {
                        //disassociate any cases assgined to this workstation requesting logout
                        base.ClearAssignment(message.CaseId);
                        CaseListUpdateEvent(message.CaseId, String.Empty, true);
                    }
                }
                catch (CargoException cex)
                {
                    throw new FaultException(new FaultReason(cex.error_msg));
                }
                catch (Exception ex)
                {
                    throw new FaultException(new FaultReason(ex.Message));
                }
            }            
            else
            {
                base.UpdateCase(message);
            }
            
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: BdGL3/CXPortal
 private void SetCaseRefBtn_Click(object sender, RoutedEventArgs e)
 {
     DataRowView selectedRow = (DataRowView)dataGrid1.SelectedItem;
     int caseIdColumnNum = caseList.List.CaseListTable.CaseIdColumn.Ordinal;
     String caseid = (String)selectedRow.Row.ItemArray[caseIdColumnNum];
     listBox1.Items.Clear();
     listBox1.Items.Add("Setting case as reference: " + caseid);
     
     UpdateCaseMessage updateMsg = new UpdateCaseMessage();
     updateMsg.CaseId = caseid;
     updateMsg.File = new MemoryStream();
     updateMsg.Type = CaseUpdateEnum.SetAsReference;//UpdatedCaseFile;
     //updateMsg.SetAsReference = true;
     ACSEndPoint.UpdateCase(updateMsg);
 }