Example #1
0
        public void UpdateCaseFields(CaseListDataSet.CaseListTableRow row)
        {
            try
            {
                string ImageStr = "0x" + BitConverter.ToString(row.Image).Replace("-", string.Empty);

                string updateString = "UPDATE ArchiveData SET " +
                                      "[CaseId]= '" + row.CaseId + "'" +
                                      ", [ReferenceImage]= " + Convert.ToInt32(row.ReferenceImage) +
                                      ", [ObjectId]= '" + row.ObjectId + "'" +
                                      ", [AnalystComment]= '" + row.AnalystComment + "'" +
                                      ", [FlightNumber]= '" + row.FlightNumber + " '" +
                                      ", [Analyst]= '" + row.Analyst + "'" +
                                      ", [CaseDirectory]= '" + row.CaseDirectory + "'" +
                                      ", [Result]= " + row.Result +
                                      ", [UpdateTime]= '" + row.UpdateTime.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss'.'fff") + "'" +
                                      ", [Archived]= " + Convert.ToInt32(row.Archived) +
                                      ", [AnalysisTime]= " + row.AnalysisTime +
                                      ", [DFCMatch]= " + Convert.ToInt32(row.DFCMatch) +
                                      ", [CreateTime]= '" + row.CreateTime.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss'.'fff") + "'" +
                                      ", [Image] = " + ImageStr +
                                      " WHERE CaseId='" + row.CaseId + "' AND ReferenceImage= " + Convert.ToInt32(row.ReferenceImage);

                base.UpdateDatabasePartialEntry(updateString);
            }
            catch
            {
                throw;
            }
        }
Example #2
0
        public void UpdatedCaseList(CaseListUpdate listUpdate)
        {
            if (listUpdate.state == CaseListUpdateState.Add)
            {
                //m_CaseList.Merge(listUpdate.dsCaseList);
                foreach (CaseListDataSet.CaseListTableRow row in listUpdate.dsCaseList.CaseListTable.Rows)
                {
                    try
                    {
                        lock (m_CaseListLock)
                        {
                            m_CaseList.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);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            else if (listUpdate.state == CaseListUpdateState.Delete)
            {
                foreach (DataRow row in listUpdate.dsCaseList.CaseListTable.Rows)
                {
                    String  caseId      = row[listUpdate.dsCaseList.CaseListTable.CaseIdColumn, DataRowVersion.Original].ToString();
                    Boolean IsReference = (Boolean)row[listUpdate.dsCaseList.CaseListTable.ReferenceImageColumn, DataRowVersion.Original];
                    DataRow foundRow    = m_CaseList.CaseListTable.FindByCaseIdReferenceImage(caseId, IsReference);
                    if (foundRow != null)
                    {
                        foundRow.Delete();
                    }
                }
            }
            else if (listUpdate.state == CaseListUpdateState.Modify)
            {
                foreach (CaseListDataSet.CaseListTableRow row in listUpdate.dsCaseList.CaseListTable.Rows)
                {
                    String  caseId      = row[listUpdate.dsCaseList.CaseListTable.CaseIdColumn].ToString();
                    Boolean IsReference = (Boolean)row[listUpdate.dsCaseList.CaseListTable.ReferenceImageColumn];
                    CaseListDataSet.CaseListTableRow foundRow = m_CaseList.CaseListTable.FindByCaseIdReferenceImage(caseId, IsReference);
                    if (foundRow != null)
                    {
                        foundRow.BeginEdit();

                        if (foundRow.ObjectId != row.ObjectId && !String.IsNullOrWhiteSpace(row.ObjectId))
                        {
                            foundRow.ObjectId = row.ObjectId;
                        }

                        if (foundRow.FlightNumber != row.FlightNumber && !String.IsNullOrWhiteSpace(row.FlightNumber))
                        {
                            foundRow.FlightNumber = row.FlightNumber;
                        }

                        if (foundRow.Analyst != row.Analyst && !String.IsNullOrWhiteSpace(row.Analyst))
                        {
                            foundRow.Analyst = row.Analyst;
                        }

                        if (foundRow.AnalystComment != row.AnalystComment && !String.IsNullOrWhiteSpace(row.AnalystComment))
                        {
                            foundRow.AnalystComment = row.AnalystComment;
                        }

                        if (foundRow.AnalysisTime != row.AnalysisTime)
                        {
                            foundRow.AnalysisTime = row.AnalysisTime;
                        }

                        if (foundRow.CaseDirectory != row.CaseDirectory && !String.IsNullOrWhiteSpace(row.CaseDirectory))
                        {
                            foundRow.CaseDirectory = row.CaseDirectory;
                        }

                        if (foundRow.Result != row.Result)
                        {
                            foundRow.Result = row.Result;
                        }

                        if (foundRow.UpdateTime != row.UpdateTime && row.UpdateTime != null)
                        {
                            foundRow.UpdateTime = row.UpdateTime;
                        }

                        if (foundRow.Archived != row.Archived)
                        {
                            foundRow.Archived = row.Archived;
                        }

                        if (foundRow.Image != row.Image && row.Image != null)
                        {
                            foundRow.Image = row.Image;
                        }

                        if (foundRow.CreateTime != row.CreateTime)
                        {
                            foundRow.CreateTime = row.CreateTime;
                        }

                        if (foundRow.Area != row.Area && !String.IsNullOrWhiteSpace(row.Area))
                        {
                            foundRow.Area = row.Area;
                        }

                        if (foundRow.CTI != row.CTI)
                        {
                            foundRow.CTI = row.CTI;
                        }

                        if (foundRow.AssignedId != row.AssignedId && row.AssignedId != null)
                        {
                            foundRow.AssignedId = row.AssignedId;
                        }

                        if (foundRow.DFCMatch != row.DFCMatch)
                        {
                            foundRow.DFCMatch = row.DFCMatch;
                        }

                        foundRow.EndEdit();
                    }
                }
            }
        }
Example #3
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.");
            }
        }