Пример #1
0
        void Source_listBox_SelectionChanged(object sender, RoutedEventArgs e)
        {
            ListBox ListBox1 = sender as ListBox;

            try
            {
                Source_dataGrid.DataContext = null;

                SelectedCaseSource = ListBox1.SelectedItem as CaseSourcesObject;

                if (SelectedCaseSource != null && SelectedCaseSource.IsLoggedIn)
                {
                    string selectedItem = SelectedCaseSource.Name;

                    try
                    {
                        DataSet tempDataSet;
                        m_SysMgr.GetCaseList(selectedItem, out tempDataSet);
                        m_CaseList = (CaseListDataSet)tempDataSet;
                        var CaseListview = (ExtendedCollectionViewSource)FindResource("cvs");
                        CaseListview.Source           = m_CaseList.Tables[0].DefaultView;
                        Source_dataGrid.DataContext   = CaseListview;
                        Source_dataGrid.SelectedIndex = -1;

                        foreach (DataGridColumn column in Source_dataGrid.Columns)
                        {
                            string path = BindingOperations.GetBindingExpression(column, DataGridColumn.HeaderProperty).ParentBinding.Path.Path;
                            if (path == "UpdateTime")
                            {
                                ListSortDirection direction = ListSortDirection.Descending;
                                column.SortDirection = direction;
                                SortCaseList(direction, column);
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //TODO: Log error
                    }
                    if (selectedItem.Contains("AWSComm"))
                    {
                        m_SysConfigMgr.GetConfig(selectedItem);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void UpdateCaseAttachments(CaseObject caseObject)
        {
            foreach (DataAttachment attachment in caseObject.NewAttachments)
            {
                AttachFileTypeEnum fileEnum;

                switch (attachment.attachmentType)
                {
                case AttachmentType.Annotations:
                    fileEnum = AttachFileTypeEnum.Annotations;
                    break;

                case AttachmentType.EVENT_HISTORY:
                    fileEnum = AttachFileTypeEnum.EVENT_HISTORY;
                    break;

                case AttachmentType.History:
                    fileEnum = AttachFileTypeEnum.History;
                    break;

                case AttachmentType.Manifest:
                    fileEnum = AttachFileTypeEnum.Manifest;
                    break;

                case AttachmentType.NUC:
                    fileEnum = AttachFileTypeEnum.NUC;
                    break;

                case AttachmentType.OCR:
                    fileEnum = AttachFileTypeEnum.OCR;
                    break;

                case AttachmentType.SNM:
                    fileEnum = AttachFileTypeEnum.SNM;
                    break;

                case AttachmentType.TDSResultFile:
                    fileEnum = AttachFileTypeEnum.TDSResultFile;
                    break;

                case AttachmentType.XRayImage:
                    fileEnum = AttachFileTypeEnum.XRayImage;
                    break;

                default:
                    fileEnum = AttachFileTypeEnum.Unknown;
                    break;
                }

                SysConfiguration sysConfig = m_SysConfigMgrAccess.GetConfig(caseObject.SourceAlias);

                if (sysConfig == null)
                {
                    sysConfig = m_SysConfigMgrAccess.GetDefaultConfig();
                }

                attachment.attachmentData.Seek(0, SeekOrigin.Begin);

                string userName = "******";

                if (m_SysConfigMgrAccess.GetDefaultConfig().Profile != null &&
                    !String.IsNullOrWhiteSpace(m_SysConfigMgrAccess.GetDefaultConfig().Profile.UserName))
                {
                    userName = m_SysConfigMgrAccess.GetDefaultConfig().Profile.UserName;
                }

                m_dataSourceAccess.UpdateCase(caseObject.SourceAlias, caseObject.CaseId,
                                              CaseUpdateEnum.AttachFile, attachment.attachmentId, attachment.attachmentData, fileEnum, null, string.Empty, userName, CultureResources.ConvertDateTimeToStringForData(DateTime.Now), (Communications.Interfaces.CaseType)caseObject.caseType);
            }

            caseObject.NewAttachments.Clear();
        }