프로젝트

일반

사용자정보

개정판 4314b3f3

ID4314b3f3169bbd4c3520cf67a87e11773ae4d53a
상위 53d3326b
하위 cfda1fed

gaqhf 이(가) 5년 이상 전에 추가함

dev issue #000 : edit form logic

Change-Id: I26bc35cbc010c858b907441e9554335b31223417

차이점 보기:

DTI_PID/SPPIDConverter/ConverterForm.Designer.cs
194 194
            this.gridViewConverter.Name = "gridViewConverter";
195 195
            this.gridViewConverter.OptionsView.ShowGroupPanel = false;
196 196
            this.gridViewConverter.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(this.gridViewConverter_RowCellClick);
197
            this.gridViewConverter.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(this.gridViewConverter_SelectionChanged);
197 198
            // 
198 199
            // btnID2Project
199 200
            // 
DTI_PID/SPPIDConverter/ConverterForm.cs
26 26
    public partial class ConverterForm : DevExpress.XtraBars.Ribbon.RibbonForm
27 27
    {
28 28
        private Dictionary<string, SPPID_Document> _DicDocuments = new Dictionary<string, SPPID_Document>();
29
        public List< SPPID_Document> Documents { get { return _DicDocuments.Select(x => x.Value).ToList(); } }
29
        private List<SPPID_Document> _Documents = new List<SPPID_Document>();
30
        public List<SPPID_Document> Documents { get { return _Documents; } }
30 31
        private DataTable _ConverterDT = new DataTable();
31 32
        private DataTable _SPPIDSymbolPathDT = new DataTable();
32 33
        private DataTable _SPPIDUnitDT = new DataTable();
......
396 397
                {
397 398
                    SPPID_Document document = new SPPID_Document(fileName);
398 399
                    document.SymbolMappings = symbolMappings;
400
                    document.LineMappings = lineMappings;
401
                    document.LineNumberMappings = lineNumberMappings;
402
                    document.AssociationMappings = associationMappings;
403

  
399 404
                    DataRow[] rows = _ConverterDT.Select(string.Format("colDrawingFilePath = '{0}'", fileName));
400 405
                    DataRow row;
401 406
                    if (rows.Length == 0)
......
422 427

  
423 428
        private void btnRun_Click(object sender, EventArgs e)
424 429
        {
430
            _Documents.Clear();
431

  
432
            foreach (int rowHandle in gridViewConverter.GetSelectedRows())
433
            {
434
                string _FilePath = gridViewConverter.GetRowCellDisplayText(rowHandle, "colDrawingFilePath");
435
                string _Unit = gridViewConverter.GetRowCellDisplayText(rowHandle, "colUnit");
436
                string _Template = gridViewConverter.GetRowCellDisplayText(rowHandle, "colTemplate");
437
                string _DrawingNumber = gridViewConverter.GetRowCellDisplayText(rowHandle, "colDrawingNumber");
438
                string _DrawingName = gridViewConverter.GetRowCellDisplayText(rowHandle, "colDrawingName");
439
                SPPID_Document document = _DicDocuments[_FilePath];
440
                document.Unit = _Unit;
441
                document.Template = _Template;
442
                document.DrawingNumber = _DrawingNumber;
443
                document.DrawingName = _DrawingName;
444
                _Documents.Add(document);
445
            }
446

  
425 447
            DialogResult = DialogResult.OK;
426 448
        }
427 449

  
......
445 467
            form.ShowDialog();
446 468
            InitMapping();
447 469
        }
470
        private List<int> prevSelectedList = new List<int>();
471

  
472
        private void gridViewConverter_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
473
        {
474
            if (e.Action == CollectionChangeAction.Add)
475
            {
476
                string _Unit = gridViewConverter.GetRowCellDisplayText(e.ControllerRow, "colUnit");
477
                string _Template = gridViewConverter.GetRowCellDisplayText(e.ControllerRow, "colTemplate");
478

  
479
                if (string.IsNullOrEmpty(_Unit) || string.IsNullOrEmpty(_Template))
480
                    gridViewConverter.UnselectRow(e.ControllerRow);
481
            }
482
            else if (e.Action == CollectionChangeAction.Refresh)
483
            {
484
                foreach (int rowHandle in gridViewConverter.GetSelectedRows())
485
                {
486
                    string _Unit = gridViewConverter.GetRowCellDisplayText(rowHandle, "colUnit");
487
                    string _Template = gridViewConverter.GetRowCellDisplayText(rowHandle, "colTemplate");
488

  
489
                    if (string.IsNullOrEmpty(_Unit) || string.IsNullOrEmpty(_Template))
490
                        gridViewConverter.UnselectRow(rowHandle);
491
                }
492

  
493
                List<int> selectedRowHandleList = gridViewConverter.GetSelectedRows().ToList();
494
                var firstNotSecond = prevSelectedList.Except(selectedRowHandleList).ToList();
495
                var secondNotFirst = selectedRowHandleList.Except(prevSelectedList).ToList();
448 496

  
497
                if (!firstNotSecond.Any() && !secondNotFirst.Any())
498
                {
499
                    this.gridViewConverter.SelectionChanged -= new DevExpress.Data.SelectionChangedEventHandler(this.gridViewConverter_SelectionChanged);
500
                    gridViewConverter.ClearSelection();
501
                    this.gridViewConverter.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(this.gridViewConverter_SelectionChanged);
502
                }
503
            }
504

  
505
            prevSelectedList = gridViewConverter.GetSelectedRows().ToList();
506
        }
449 507
    }
450 508
}
DTI_PID/SPPIDConverter/Model/SPPID_Document.cs
22 22
        public string DrawingName { get; set; }
23 23
        public string DrawingNumber { get; set; }
24 24
        public string Unit { get; set; }
25
        public string Template { get; set; }
25 26
    }
26 27
}
DTI_PID/SPPIDConverter/SPPIDConverter.csproj
5 5
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6 6
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7 7
    <ProjectGuid>{B6757E78-6B59-40A3-A7BB-E73E8F81B6C3}</ProjectGuid>
8
    <OutputType>Library</OutputType>
8
    <OutputType>WinExe</OutputType>
9 9
    <AppDesignerFolder>Properties</AppDesignerFolder>
10 10
    <RootNamespace>Converter.SPPID</RootNamespace>
11 11
    <AssemblyName>SPPIDConverter</AssemblyName>
......
96 96
    <Reference Include="System.Xml" />
97 97
  </ItemGroup>
98 98
  <ItemGroup>
99
    <Compile Include="AutoModeling\AutoModeling.cs" />
100
    <Compile Include="AutoModeling\CloseOPCForm.cs" />
99 101
    <Compile Include="DB\SPPID_DB.cs" />
100 102
    <Compile Include="DB\SPPID_DBInfo.cs" />
101 103
    <Compile Include="ConverterForm.cs">
......
283 285
  <ItemGroup>
284 286
    <None Include="Resources\pencolor_16x16.png" />
285 287
  </ItemGroup>
286
  <ItemGroup>
287
    <Folder Include="AutoModeling\" />
288
  </ItemGroup>
288
  <ItemGroup />
289 289
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
290 290
</Project>
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs
44 44
            }
45 45
            return true;
46 46
        }
47

  
48 47
        public static bool ConvertToETCSetting(string jsonString)
49 48
        {
50 49
            ETCSetting _ETCSetting = ETCSetting.GetInstance();

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)