Пример #1
0
 public virtual void UpdateCaseList(CaseListUpdate listupdate)
 {
     try
     {
         lock (m_UpdateCaseListLock)
         {
             foreach (String awsId in connectionList.Keys)
             {
                 ICaseRequestManagerCallback callback = connectionList[awsId];
                 try
                 {
                     callback.UpdatedCaseList(listupdate);
                 }
                 catch (Exception)
                 {
                     connectionList.Remove(awsId);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Пример #2
0
        public void SendCaseList(String awsID, CaseList caselist)
        {
            int CaseListCount = caselist.List.CaseListTable.Count;

            int currentRowIndex = 0;

            CaseListDataSet.CaseListTableRow CurrentRow = null;

            if (CaseListCount > 0)
            {
                CurrentRow = (CaseListDataSet.CaseListTableRow)caselist.List.CaseListTable.Rows[currentRowIndex];
            }

            while (CaseListCount > 0)
            {
                CaseListDataSet dataset = new CaseListDataSet();
                int             MaxIndexValue;

                //lock caselist
                lock (caselist.CaseListLock)
                {
                    currentRowIndex = caselist.List.CaseListTable.Rows.IndexOf(CurrentRow);

                    if (CaseListCount > MaxNumCasesPerBatch)
                    {
                        MaxIndexValue = currentRowIndex + MaxNumCasesPerBatch;
                    }
                    else
                    {
                        MaxIndexValue = currentRowIndex + CaseListCount;
                    }

                    for (int i = currentRowIndex; i < MaxIndexValue; i++)
                    {
                        CaseListDataSet.CaseListTableRow row = (CaseListDataSet.CaseListTableRow)caselist.List.CaseListTable.Rows[i];

                        dataset.CaseListTable.AddCaseListTableRow(row.CaseId, row.AnalystComment, row.ObjectId, row.FlightNumber,
                                                                  row.Analyst, row.CaseDirectory, row.ReferenceImage, row.Result,
                                                                  row.UpdateTime, row.Archived, row.AnalysisTime, row.CreateTime, row.Area, row.Image, row.CTI, row.AssignedId, row.DFCMatch);
                    }

                    if (CaseListCount > MaxNumCasesPerBatch)
                    {
                        CaseListCount   = CaseListCount - MaxNumCasesPerBatch;
                        currentRowIndex = currentRowIndex + MaxNumCasesPerBatch;
                        CurrentRow      = (CaseListDataSet.CaseListTableRow)caselist.List.CaseListTable.Rows[currentRowIndex];
                    }
                    else
                    {
                        CaseListCount = CaseListCount - CaseListCount;
                    }

                    //unlock caselist
                }

                try
                {
                    CaseListUpdate listupdate            = new CaseListUpdate(dataset, CaseListUpdateState.Add);
                    ICaseRequestManagerCallback callback = connectionList[awsID];

                    lock (m_UpdateCaseListLock)
                    {
                        callback.UpdatedCaseList(listupdate);
                    }
                }
                catch (Exception exp)
                {
                    if (logger != null)
                    {
                        logger.PrintLine("SendCaseList exp: " + exp);
                    }
                    connectionList.Remove(awsID);
                    break;
                }
            }

            if (logger != null)
            {
                logger.PrintInfoLine("SendCaseList in chunks to " + awsID + " Done.");
            }
        }