-
Notifications
You must be signed in to change notification settings - Fork 0
/
FGMMain.aspx.cs
1727 lines (1476 loc) · 78.5 KB
/
FGMMain.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using DevExpress.Web;
using DevExpress.Web.ASPxGridView;
using DevExpress.Web.ASPxGridView.Export;
using DevExpress.Web.ASPxEditors;
using DevExpress.Web.ASPxFormLayout;
using DevExpress.Web.ASPxClasses;
using DevExpress.Web.Data;
using System.Collections;
using Aspose.Cells;
using System.IO;
using System.Drawing;
namespace EDISON
{
public partial class FGMMain : System.Web.UI.Page
{
FGMModule fgm_moduler;
XmlDocument env_config;
DataSet ds;
DataView dv;
DataTable dynamic_table;
DataTable dynamic_table_detector;
DataTable dynamic_table_effect;
string module_Name = "FDM";
string group_Name = "";
string tag_type = "";
string zone = "";
string issue_state = "";
string Detector_obid = "";
string Detector_type = "";
string Detector_unit = "";
string Detector_loc = "";
string Detector_cnt = "";
//string Detector_desc = "";
public string conn_string = "";
protected void Page_Load(object sender, EventArgs e)
{
fgm_moduler = new FGMModule("FDM", SessionInfo.ProjectName, "TagGroupDetector");
tag_type = Request.QueryString["tagType"];
tagType_HiddenField.Value = tag_type;
hidden_prj_name.Value = SessionInfo.ProjectName;
GridGroupDetector.JSProperties["cpConfirmationMessage"] = "";
GridGroupDetail.JSProperties["cpConfirmationMessage"] = "";
GridDetector.JSProperties["cpConfirmationMessage"] = "";
env_config = new XmlDocument();
env_config.Load(fgm_moduler.func_Class.get_EnvFilePath());
if (!IsPostBack)
{
Setup_Zone();
}
zone = ddl_zone.SelectedValue;
Session["zone"] = zone;
if (tag_type == "GroupDetector")
{
btn_Issue.Visible = true;
btn_Import.Visible = true;
btn_add.Visible = true;
btn_delete.Visible = true;
btn_save.Visible = true;
btn_Export.Visible = true;
btn_Export1.Visible = false;
makeViewGridGroupDetector();
//if (Page.IsCallback || !Page.IsPostBack)
//{
if (GridGroupDetector.FocusedRowIndex > -1)
{
int focusedRowIndex = GridGroupDetector.FocusedRowIndex;
if (GridGroupDetector.GetRowValues(GridGroupDetector.FocusedRowIndex, "OBID") == null)
{
focusedRowIndex = 0;
}
Detector_obid = (string)GridGroupDetector.GetRowValues(focusedRowIndex, "OBID");
tagName.Value = (string)GridGroupDetector.GetRowValues(focusedRowIndex, "TagNo");
makeViewGridGroupDetail(Detector_obid);
Session["S_DB_NAME"] = GridGroupDetail.GetRowValues(GridGroupDetail.FocusedRowIndex, "DB_NAME");
makeViewGridEffect(Detector_obid);
makeViewGridDetectorDetail(Detector_obid);
//gv1temp.Templates.EditForm = new EditFormTemplate();
//EditFormTemplate editform_template = new EditFormTemplate();
//editform_template.dynamic_effect = dynamic_table_effect;
//gv1temp.Templates.EditForm = editform_template;
}
//}
}
else if (tag_type == "Detector")
{
taglist.Style["width"] = "50%";
taglist2.Style["width"] = "47%";
btn_Issue.Visible = false;
btn_Import.Visible = false;
btn_add.Visible = false;
btn_delete.Visible = false;
btn_save.Visible = false;
btn_Export.Visible = false;
btn_Export1.Visible = true;
makeViewGridDetectorList();
if (GridGroupDetector.FocusedRowIndex > -1)
{
Detector_obid = GridGroupDetector.GetRowValues(GridGroupDetector.FocusedRowIndex, "GROUP_OBID").ToString();
makeViewGridGroupDetail(Detector_obid);
makeViewGridEffect(Detector_obid);
//makeViewGridDetectorDetail(Detector_obid);
GridDetector.Visible = false;
}
GridGroupDetail.SettingsEditing.Mode = GridViewEditingMode.Inline;
gv1temp.Columns["Command"].Visible = false;
//gv1temp.Templates.EditForm = new EditFormTemplate();
}
}
protected void makeViewGridGroupDetector()
{
//ds = fgm_moduler.Load_GroupDetectorData(fgm_moduler.func_Class.conn, "TagGroupDetector", "GroupDetector");
ds = fgm_moduler.Load_GroupDetectorData(fgm_moduler.func_Class.conn, "TagGroupDetector", zone);
DataColumn row_index = new DataColumn();
row_index.ColumnName = "No.";
ds.Tables[0].Columns.Add(row_index);
ds.Tables[0].Columns["No."].SetOrdinal(0);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
ds.Tables[0].Rows[i]["No."] = i + 1;
}
GridGroupDetector.DataSource = ds;
GridGroupDetector.DataBind();
GridGroupDetector.Columns["OBID"].Visible = false;
GridGroupDetector.Columns["Count"].Visible = false;
GridGroupDetector.Columns["N1ISSUESTATE"].Visible = false;
GridGroupDetector.Columns["No."].Width = 30;
GridGroupDetector.Columns["No."].CellStyle.Font.Bold = true;
//GridGroupDetector.Columns["No."].CellStyle.BackColor = Color.LightGray;
GridGroupDetector.Columns["Rev"].Width = 30;
GridGroupDetector.Columns["Type"].Width = 50;
GridGroupDetector.Columns["Unit"].Width = 50;
GridGroupDetector.KeyFieldName = "OBID";
GroupDetectorEditFormTemplate edit_template = new GroupDetectorEditFormTemplate();
GridGroupDetector.Templates.EditForm = edit_template;
edit_template.datafield = Srch_DataField("FDM");
}
protected void makeViewGridDetectorList()
{
ds = fgm_moduler.Load_DetectorData(fgm_moduler.func_Class.conn, "TagDetector", zone);
GridGroupDetector.DataSource = ds;
GridGroupDetector.DataBind();
GridGroupDetector.Columns["OBID"].Visible = false;
GridGroupDetector.Columns["GROUP_OBID"].Visible = false;
GridGroupDetector.Columns["N1ISSUESTATE"].Visible = false;
GridGroupDetector.KeyFieldName = "OBID";
}
protected void makeViewGridGroupDetail(string obid)
{
dynamic_table = Srch_DataField("FDM");
Fill_Record(ref dynamic_table, obid);
//DataView dv = ds.Tables[0].DefaultView;
//dv.RowFilter = "OBID = '" + GridGroupDetector.GetRowValues(GridGroupDetector.FocusedRowIndex, "OBID").ToString() + "'";
//GridGroupDetail.DataSource = dv;
//GridGroupDetail.DataBind();
}
protected void makeViewGridDetectorDetail(string obid)
{
//string load_qry;
//SqlDataAdapter data_adapter;
//DataSet data_DataSet = new DataSet();
//data_DataSet.Tables.Add(Srch_DataField("FDMDetector"));
dynamic_table_detector = Srch_DataField_Detector("FDMDetector");
Fill_Record_Detector(ref dynamic_table_detector, obid);
//load_qry = " SELECT D.OBID, C.N1NAME AS [DETECTOR], C.N1LIBRARYNO AS [SEQ], RELDEFID, E.N1STRVALUE, G.DB_NAME,G.DESC_NAME FROM N2REVGRP C ";
//load_qry = load_qry + " INNER JOIN N3RGRPRGRP R ON R.LEFTREL = C.OBID ";
//load_qry = load_qry + " INNER JOIN N3OBJATTR D ON C.OBID = D.LEFTREL ";
//load_qry = load_qry + " INNER JOIN N2SPCATTR E ON D.RIGHTREL = E.OBID ";
//load_qry = load_qry + " INNER JOIN N2CLSATTR F ON E.N1ATTRCLASSOBID = F.OBID ";
//load_qry = load_qry + " INNER JOIN N3SECTION G ON G.DB_NAME = F.N1ATTRCLASSNAME ";
//load_qry = load_qry + " WHERE C.N1TERMINATIONDATE = '' AND C.N1PROJECTNAME = '" + fgm_moduler.func_Class.project_Name + "' ";
//load_qry = load_qry + " AND R.N1TERMINATIONDATE = '' AND R.RIGHTREL = '" + obid + "' AND R.N1TERMINATIONDATE = '' ";
//load_qry = load_qry + " AND C.N1CLASS = 'TagDetector' AND D.N1TERMINATIONDATE = '' AND E.N1TERMINATIONDATE = '' ";
//load_qry = load_qry + " AND G.MODULE_NAME IN ('FDMDetector') and G.PRJ_NAME='" + fgm_moduler.func_Class.project_Name + "' ";
//load_qry = load_qry + " AND G.TERMINATIONDATE = ''";
//load_qry = load_qry + " ORDER BY DETECTOR, VIEW_SEQ ";
//data_adapter = new SqlDataAdapter(load_qry, fgm_moduler.func_Class.connString);
//data_adapter.Fill(data_DataSet, "DataField");
//GridDetector.DataSource = data_DataSet;
//GridDetector.DataBind();
//GridDetector.KeyFieldName = "OBID";
//GridDetector.ExpandAll();
}
protected DataTable Srch_DataField(string m_name)
{
string load_qry;
SqlDataAdapter data_adapter;
DataSet ds_datafield = new DataSet();
DataTable DetectorList = new DataTable();
//string []enum_role;
//enum_role = fgm_moduler.load_RoleList(module_Name);
load_qry = "SELECT VIEW_INDEX, DB_NAME, ISFIXED, isnull(RTRIM(DESC_NAME),'') AS DESC_NAME ,VIEWER, SEL_TYPE, AUTH, VIEW_SEQ, isnull(UOM,'') AS UOM,REF_FROM ";
load_qry = load_qry + ", GROUP_NAME, '' AS N3_VALUE, '' AS N3_OBID FROM N3SECTION ";
load_qry = load_qry + " WHERE MODULE_NAME = '" + m_name + "' AND PRJ_NAME='" + SessionInfo.ProjectName + "'";
load_qry = load_qry + " AND TERMINATIONDATE = '' ";
load_qry = load_qry + " AND VIEWER =1 and DB_NAME != 'START_SEQ' AND DB_NAME != 'START_SUFFIX' AND DB_NAME != 'ID_ZONE' ";
load_qry = load_qry + " ORDER BY AUTH DESC, VIEW_SEQ, SYSTEM_SEQ";
data_adapter = new SqlDataAdapter(load_qry, fgm_moduler.func_Class.connString);
data_adapter.Fill(ds_datafield, "DataField");
return ds_datafield.Tables["DataField"];
}
protected DataTable Srch_DataField_Detector(string m_name)
{
string load_qry;
SqlDataAdapter data_adapter;
DataSet ds_datafield = new DataSet();
DataTable DetectorList = new DataTable();
load_qry = "SELECT C.OBID, C.N1NAME AS [N1NAME], C.OBID + '@' + DB_NAME+'@'+N1NAME AS [KEY], DB_NAME, isnull(RTRIM(DESC_NAME),'') AS DESC_NAME, '' AS N3_VALUE, '' AS N3_OBID ";
load_qry = load_qry + " ,AUTH, VIEW_SEQ ";
//load_qry = load_qry + " VIEWER, SEL_TYPE, AUTH, VIEW_SEQ, isnull(UOM,'') AS UOM, REF_FROM, GROUP_NAME ";
load_qry = load_qry + " FROM N2REVGRP C ";
load_qry = load_qry + " INNER JOIN N3RGRPRGRP R ON R.LEFTREL = C.OBID ";
load_qry = load_qry + " CROSS JOIN N3SECTION G ";
load_qry = load_qry + " WHERE C.N1TERMINATIONDATE = '' AND C.N1PROJECTNAME = '" + SessionInfo.ProjectName + "' AND R.N1TERMINATIONDATE = '' ";
load_qry = load_qry + " AND R.RIGHTREL = '" + Detector_obid + "' AND R.N1TERMINATIONDATE = '' AND C.N1CLASS = 'TagDetector' ";
load_qry = load_qry + " AND G.MODULE_NAME = '" + m_name + "' AND G.PRJ_NAME = '"+ SessionInfo.ProjectName + "' AND G.TERMINATIONDATE ='' AND VIEWER=1";
load_qry = load_qry + " ORDER BY N1NAME, VIEW_SEQ";
data_adapter = new SqlDataAdapter(load_qry, fgm_moduler.func_Class.connString);
data_adapter.Fill(ds_datafield, "DataField");
return ds_datafield.Tables["DataField"];
}
string Detector_Group_cnt;
protected void Fill_Record(ref DataTable dynamic_table, string obid)
{
string load_qry;
SqlDataAdapter data_adapter;
DataSet data_DataSet = new DataSet();
string rev;
string TagNo;
string revdate;
load_qry = "SELECT C.N1MAJORREVISION + C.N1MINORREVISION as Rev, C.OBID as TagID, isnull(C.N1NAME,'') as N1NAME, F.N1ATTRCLASSNAME, E.N1STRVALUE, C.N1CREATIONDATE, ";
load_qry = load_qry + " C.N1CLASS,C.N1TERMINATIONDATE, RTrim(C.N1ORIGCLASSDEFUID) as N1ORIGCLASSDEFUID, D.OBID, isnull(G.ISFIXED,0) as FIXED, G.AUTH, C.N1LASTUPDATED, C.N1ISSUESTATE, G.SEL_TYPE,G.VIEWER ";
load_qry = load_qry + " FROM N2REVGRP C ";
load_qry = load_qry + " INNER JOIN N3OBJATTR D ON C.OBID = D.LEFTREL ";
load_qry = load_qry + " INNER JOIN N2SPCATTR E ON D.RIGHTREL = E.OBID ";
load_qry = load_qry + " INNER JOIN N2CLSATTR F ON E.N1ATTRCLASSOBID = F.OBID ";
load_qry = load_qry + " INNER JOIN N3SECTION G ON G.DB_NAME = F.N1ATTRCLASSNAME ";
load_qry = load_qry + " WHERE (C.OBID='" + obid + "') ";
//load_qry = load_qry + " AND (C.N1PROJECTNAME='" + fgm_moduler.func_Class.project_Name + "') ";
load_qry = load_qry + " AND (C.N1PROJECTNAME='"+ SessionInfo.ProjectName + "') AND C.N1TERMINATIONDATE = '' AND N1CLASS = 'TagGroupDetector' ";
load_qry = load_qry + " AND D.N1TERMINATIONDATE = '' ";
//load_qry = load_qry + " AND G.MODULE_NAME IN ('" + module_Name + "') and G.PRJ_NAME='" + fgm_moduler.func_Class.project_Name + "'";
load_qry = load_qry + " AND G.MODULE_NAME IN ('FDM') and G.PRJ_NAME='" + SessionInfo.ProjectName + "'";
load_qry = load_qry + " AND G.TERMINATIONDATE = '' ";
//REPORT 조건 추가 (15.08.10)
load_qry = load_qry + " AND G.REPORT = '0' ";
string update_qry = "SELECT TOP 1 * FROM N2REVGRP";
data_adapter = new SqlDataAdapter(load_qry, fgm_moduler.func_Class.connString);
data_adapter.Fill(data_DataSet, "DataField");
if (data_DataSet.Tables["DataField"].Rows.Count > 0)
{
rev = data_DataSet.Tables["DataField"].Rows[0]["Rev"].ToString();
TagNo = data_DataSet.Tables["DataField"].Rows[0]["N1NAME"].ToString();
revdate = data_DataSet.Tables["DataField"].Rows[0]["N1LASTUPDATED"].ToString();
issue_state = data_DataSet.Tables["DataField"].Rows[0]["N1ISSUESTATE"].ToString();
foreach (DataRow datafield_DataRow in dynamic_table.Select("AUTH = 'System'"))
{
if (datafield_DataRow["DB_NAME"].ToString() == "REV")
datafield_DataRow["N3_VALUE"] = rev;
else if (datafield_DataRow["DB_NAME"].ToString() == "N1NAME")
datafield_DataRow["N3_VALUE"] = TagNo;
else if (datafield_DataRow["DB_NAME"].ToString() == "N1LASTUPDATED")
datafield_DataRow["N3_VALUE"] = revdate;
}
}
foreach (DataRow data_DataRow in data_DataSet.Tables["DataField"].Rows)
{
if (data_DataRow["N1ATTRCLASSNAME"].ToString() == "CNT")
Detector_Group_cnt = data_DataRow["N1STRVALUE"].ToString();
if (data_DataRow["N1ATTRCLASSNAME"].ToString() == "ID_UNIT")
Detector_unit = data_DataRow["N1STRVALUE"].ToString();
if (data_DataRow["N1ATTRCLASSNAME"].ToString() == "DETECTOR_TYPE")
{
Detector_type = data_DataRow["N1STRVALUE"].ToString();
Detector_type_HiddenField.Value = data_DataRow["N1STRVALUE"].ToString();
}
if (data_DataRow["N1ATTRCLASSNAME"].ToString() == "LOC")
Detector_loc = data_DataRow["N1STRVALUE"].ToString();
//if (data_DataRow["N1ATTRCLASSNAME"].ToString() == "DESC_NAME")
// Detector_desc = data_DataRow["N1STRVALUE"].ToString();
foreach (DataRow datafield_DataRow in dynamic_table.Select("DB_NAME = '" + data_DataRow["N1ATTRCLASSNAME"].ToString() + "'"))
{
datafield_DataRow["N3_VALUE"] = data_DataRow["N1STRVALUE"];
datafield_DataRow["N3_OBID"] = data_DataRow["OBID"];
}
}
GridGroupDetail.DataSource = dynamic_table;
GridGroupDetail.DataBind();
for (int i = 0; i < dynamic_table.Rows.Count; i++)
{
if (dynamic_table.Rows[i]["DB_NAME"].ToString() == "LOC")
Session["loc_cause"] = dynamic_table.Rows[i]["N3_VALUE"].ToString();
}
//Grid Disable (Issued)
if (issue_state == "")
GridGroupDetail.Enabled = true;
else
GridGroupDetail.Enabled = false;
//GridGroupDetail.KeyFieldName = "DB_NAME";
//Detector_Group_cnt = dynamic_table.Rows[11][11].ToString();
}
protected void Fill_Record_Detector(ref DataTable dynamic_table_detector, string obid)
{
string load_qry;
SqlDataAdapter data_adapter;
DataSet data_DataSet = new DataSet();
//load_qry = "SELECT C.N1MAJORREVISION + C.N1MINORREVISION as Rev, C.OBID as TagID, isnull(C.N1NAME,'') as N1NAME, F.N1ATTRCLASSNAME, E.N1STRVALUE, C.N1CREATIONDATE, ";
//load_qry = load_qry + " C.N1CLASS,C.N1TERMINATIONDATE, RTrim(C.N1ORIGCLASSDEFUID) as N1ORIGCLASSDEFUID, D.OBID, isnull(G.ISFIXED,0) as FIXED, G.AUTH, C.N1LASTUPDATED, C.N1ISSUESTATE, G.SEL_TYPE,G.VIEWER ";
load_qry = " SELECT D.OBID, C.N1NAME AS [N1NAME], C.N1LIBRARYNO AS [SEQ], RELDEFID, E.N1STRVALUE, G.DB_NAME,G.DESC_NAME, F.N1ATTRCLASSNAME FROM N2REVGRP C ";
load_qry = load_qry + " INNER JOIN N3RGRPRGRP R ON R.LEFTREL = C.OBID ";
load_qry = load_qry + " INNER JOIN N3OBJATTR D ON C.OBID = D.LEFTREL ";
load_qry = load_qry + " INNER JOIN N2SPCATTR E ON D.RIGHTREL = E.OBID ";
load_qry = load_qry + " INNER JOIN N2CLSATTR F ON E.N1ATTRCLASSOBID = F.OBID ";
load_qry = load_qry + " INNER JOIN N3SECTION G ON G.DB_NAME = F.N1ATTRCLASSNAME ";
load_qry = load_qry + " WHERE C.N1TERMINATIONDATE = '' AND C.N1PROJECTNAME = '" + fgm_moduler.func_Class.project_Name + "' ";
load_qry = load_qry + " AND R.N1TERMINATIONDATE = '' AND R.RIGHTREL = '" + obid + "' AND R.N1TERMINATIONDATE = '' ";
load_qry = load_qry + " AND C.N1CLASS = 'TagDetector' AND D.N1TERMINATIONDATE = '' AND E.N1TERMINATIONDATE = '' ";
load_qry = load_qry + " AND G.MODULE_NAME IN ('FDMDetector') and G.PRJ_NAME='" + fgm_moduler.func_Class.project_Name + "' ";
load_qry = load_qry + " AND G.TERMINATIONDATE = ''";
load_qry = load_qry + " ORDER BY N1NAME, VIEW_SEQ ";
data_adapter = new SqlDataAdapter(load_qry, fgm_moduler.func_Class.connString);
data_adapter.Fill(data_DataSet, "DataField");
foreach (DataRow data_DataRow in data_DataSet.Tables["DataField"].Rows)
{
foreach (DataRow datafield_DataRow in dynamic_table_detector.Select("N1NAME = '"+ data_DataRow["N1NAME"].ToString()+ "' AND DB_NAME = '" + data_DataRow["N1ATTRCLASSNAME"].ToString() + " '"))
{
datafield_DataRow["N3_VALUE"] = data_DataRow["N1STRVALUE"];
datafield_DataRow["N3_OBID"] = data_DataRow["OBID"];
}
}
GridDetector.Columns.Clear();
GridDetector.AutoGenerateColumns = true;
GridDetector.DataSource = dynamic_table_detector;
GridDetector.DataBind();
//Grid Disable (Issued)
if (issue_state == "")
GridDetector.Enabled = true;
else
GridDetector.Enabled = false;
//Grid Column Setting
GridDetector.Columns["KEY"].Visible = false;
GridDetector.Columns["OBID"].Visible = false;
GridDetector.Columns["N3_OBID"].Visible = false;
GridDetector.Columns["DB_NAME"].Visible = false;
GridDetector.GroupBy(GridDetector.Columns["N1NAME"]);
GridViewDataColumn c1 = GridDetector.Columns["DESC_NAME"] as GridViewDataColumn;
c1.ReadOnly = true;
c1.EditFormSettings.Visible = DevExpress.Utils.DefaultBoolean.False;
GridDetector.Columns["AUTH"].Visible = false;
GridDetector.Columns["VIEW_SEQ"].Visible = false;
}
protected void Setup_Zone()
{
DataSet ds_zone = new DataSet();
SqlDataAdapter data_adapter;
string load_qry = "SELECT LOOKUPDETNAME, LOOKUPDETDESC FROM LOOKUPDET WHERE DEPENDENTPROJECT = '" + fgm_moduler.func_Class.project_Name + "' ";
load_qry = load_qry + " AND LOOKUPNAME = 'ID_ZONE' AND TERMINATIONDATE = '' AND LOOKUPDETNAME <> 'COMMON' ORDER BY LOOKUPDETNAME";
data_adapter = new SqlDataAdapter(load_qry, fgm_moduler.func_Class.admin_connString);
data_adapter.Fill(ds_zone);
ddl_zone.DataSource = ds_zone.Tables[0];
ddl_zone.DataTextField = "LOOKUPDETNAME";
ddl_zone.DataValueField = "LOOKUPDETNAME";
ddl_zone.DataTextFormatString = "Zone {0}";
ddl_zone.DataBind();
}
///// <summary>
/////
///// </summary>
///// <param name="obid"></param>
protected void makeViewGridEffect(string obid)
{
dynamic_table_effect = new DataTable();
//DataTable dt_interface = new DataTable();
SqlDataAdapter data_adapter;
//string load_qry = "SELECT OBID, SYS_INTERFACE, N1NAME AS [TagNo], DESC_NAME as [Description], ";
//load_qry = load_qry + " LOC as [Location], ACTION_STATUS as [ActionStatus], SIGNAL_VOTING FROM TBLEFFECT ";
//load_qry = load_qry + " WHERE N1TERMINATIONDATE = '' AND PARENT_REL = '" + obid + "' ";
//load_qry = load_qry + " ORDER BY N1NAME";
//string load_qry = "SELECT D.OBID, (CASE WHEN E.VOTING='V' THEN 'Voting' WHEN E.VOTING='S' THEN 'Single' ELSE E.VOTING END) AS VOTING, E.VOTING_CNT, ('Effect ' + E.EFFECTTYPE) AS EFFECTTYPE, F.SYS_INTERFACE, F.N1NAME AS [TagNo], F.DESC_NAME AS [Description], F.LOC AS [Location], ";
//load_qry = load_qry + " F.ACTION_STATUS as [ActionStatus] FROM N2REVGRP C ";
//load_qry = load_qry + " INNER JOIN N3OBJATTR D ON D.LEFTREL = C.OBID ";
//load_qry = load_qry + " INNER JOIN TBLEFFECT E ON E.OBID = D.RIGHTREL ";
//load_qry = load_qry + " INNER JOIN TBLEFFECT_SETUP F ON F.OBID = E.RIGHTREL ";
//load_qry = load_qry + " WHERE C.N1PROJECTNAME = '" + fgm_moduler.func_Class.project_Name + "' AND C.N1TERMINATIONDATE = '' ";
//load_qry = load_qry + " AND C.N1CLASS = 'TagGroupDetector' AND D.N1TERMINATIONDATE = '' AND E.N1TERMINATIONDATE = '' AND F.N1TERMINATIONDATE = '' ";
//load_qry = load_qry + " AND C.OBID = '" + obid + "' ORDER BY [TagNo] ";
string load_qry = "SELECT D.OBID, F.VOTING, F.VOTING_CNT, F.ALARM_LEVEL, ";
load_qry = load_qry + " CASE WHEN F.VOTING = 'Voting' THEN F.VOTING + ' : ' + F.VOTING_CNT + ' oo ' + '" + Detector_Group_cnt + "' + ' (' + F.ALARM_LEVEL + ') '";
load_qry = load_qry + " ELSE F.VOTING + ' (' + F.ALARM_LEVEL + ') ' END AS EFFECT_GROUP, ";
load_qry = load_qry + " E.N1NAME AS [TagNo], F.DESC_NAME, F.LOC1, F.LOC2, F.OBID AS OBID_TEMPLATE";
load_qry = load_qry + " FROM N2REVGRP C ";
load_qry = load_qry + " INNER JOIN N3OBJATTR D ON D.LEFTREL = C.OBID ";
load_qry = load_qry + " INNER JOIN TBLEFFECT_NEW E ON E.OBID = D.RIGHTREL ";
load_qry = load_qry + " INNER JOIN TBLEFFECT_SETUP_NEW F ON F.OBID = E.RIGHTREL ";
load_qry = load_qry + " WHERE C.N1PROJECTNAME = '" + fgm_moduler.func_Class.project_Name + "' AND C.N1TERMINATIONDATE = '' ";
load_qry = load_qry + " AND C.N1CLASS = 'TagGroupDetector' AND D.N1TERMINATIONDATE = '' AND E.N1TERMINATIONDATE = '' AND F.N1TERMINATIONDATE = '' ";
load_qry = load_qry + " AND C.OBID = '" + obid + "' ORDER BY [TagNo] ";
data_adapter = new SqlDataAdapter(load_qry, fgm_moduler.func_Class.connString);
data_adapter.Fill(dynamic_table_effect);
//for (int i = 0; i < dynamic_table_effect.Rows.Count; i++)
//{
// if (dynamic_table_effect.Rows[i]["VOTING"].ToString() == "Voting")
// dynamic_table_effect.Rows[i]["VOTING"] = "Voting : " + dynamic_table_effect.Rows[i]["VOTING_CNT"] + "oo" + Detector_Group_cnt;
//}
gv1temp.DataSource = dynamic_table_effect;
gv1temp.DataBind();
//Grid Enable/Disable (Issued)
if (issue_state == "")
gv1temp.Enabled = true;
else
gv1temp.Enabled = false;
gv1temp.ExpandAll();
}
protected void GridGroupDetector_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
{
SqlCommand ins_cmd = new SqlCommand();
XmlDocument tag_Doc = new XmlDocument();
XmlElement tag_Ele;
XmlElement data_Ele;
int i;
ASPxTextBox new_textbox;
ASPxComboBox new_combobox;
ASPxMemo new_memo;
string grouptag_Name;
string grouptag_ID;
string tag_Name;
string tag_Seq="";
string tag_ID;
int tag_Count=0;
tag_Ele = tag_Doc.CreateElement("GroupDetector");
tag_Doc.AppendChild(tag_Ele);
//ASPxFormLayout editform_GroupDetector = new ASPxFormLayout();
//editform_GroupDetector.ID = "editform_GroupDetector";
ASPxFormLayout editform_GroupDetector = GridGroupDetector.FindEditFormTemplateControl("editform_GroupDetector") as ASPxFormLayout;
int cnt = editform_GroupDetector.Items.Count;
DataTable dt = Srch_DataField("FDM");
string db_name = "";
string auth = "";
foreach (DataRow dr in dt.Select("AUTH <> 'System'", "VIEW_SEQ"))
{
string value="";
db_name = dr["DB_NAME"].ToString();
auth = dr["AUTH"].ToString();
object item = editform_GroupDetector.FindNestedControlByFieldName(db_name);
if (item.GetType() == typeof(ASPxTextBox))
{
new_textbox = (ASPxTextBox)item;
if(new_textbox.Text != "")
{
data_Ele = tag_Doc.CreateElement("Data");
data_Ele.SetAttribute("Name", db_name);
value = new_textbox.Text;
data_Ele.InnerText = new_textbox.Text;
tag_Ele.AppendChild(data_Ele);
}
}
else if (item.GetType() == typeof(ASPxComboBox))
{
new_combobox = (ASPxComboBox)item;
if (new_combobox.Text != "")
{
data_Ele = tag_Doc.CreateElement("Data");
data_Ele.SetAttribute("Name", db_name);
value = new_combobox.Text;
data_Ele.InnerText = new_combobox.Text;
tag_Ele.AppendChild(data_Ele);
}
}
else if (item.GetType() == typeof(ASPxMemo))
{
new_memo = (ASPxMemo)item;
if (new_memo.Text != "")
{
data_Ele = tag_Doc.CreateElement("Data");
data_Ele.SetAttribute("Name", db_name);
value = new_memo.Text;
data_Ele.InnerText = new_memo.Text;
tag_Ele.AppendChild(data_Ele);
}
}
if (auth == "Manager" && value == "")
{
(sender as ASPxGridView).JSProperties["cpConfirmationMessage"] = "필수값을 입력하세요";
e.Cancel = true;
return;
}
else if (db_name == "CNT")
{
try
{
int chk_count = int.Parse(value);
if (chk_count < 1)
throw new Exception("");
}
catch
{
(sender as ASPxGridView).JSProperties["cpConfirmationMessage"] = "Count : Error";
e.Cancel = true;
return;
}
}
}
grouptag_Name = fgm_moduler.Validate_tagName(ref tag_Ele, env_config, module_Name, "");
if (grouptag_Name.Contains("Err"))
{
(sender as ASPxGridView).JSProperties["cpConfirmationMessage"] = "Tag No : Error";
e.Cancel = true;
return;
}
ins_cmd.Connection = fgm_moduler.func_Class.conn;
try
{
//Group Detector Tag Insert
grouptag_ID = fgm_moduler.Save_REVGRP(ref ins_cmd, env_config, "TagGroupDetector", grouptag_Name, tag_Ele, "*", 0, zone);
Detector_obid = grouptag_ID;
if (grouptag_ID.Contains("Err"))
{
(sender as ASPxGridView).JSProperties["cpConfirmationMessage"] = "Tag No : Duplication";
e.Cancel = true;
//GridGroupDetector.CancelEdit();
return;
}
fgm_moduler.Add_Attr(ref ins_cmd, "ID_ZONE", "text", zone, grouptag_ID);
foreach (XmlElement Ele in tag_Ele.ChildNodes)
{
fgm_moduler.Add_Attr(ref ins_cmd, Ele.GetAttribute("Name"), "text", Ele.InnerText, grouptag_ID);
if (Ele.GetAttribute("Name").ToString() == "CNT")
tag_Count = Int32.Parse(Ele.InnerText.ToString());
if (Ele.GetAttribute("Name").ToString() == "ID_UNIT")
Detector_unit = Ele.InnerText.ToString();
if (Ele.GetAttribute("Name").ToString() == "DETECTOR_TYPE")
Detector_type = Ele.InnerText.ToString();
if (Ele.GetAttribute("Name").ToString() == "LOC")
Detector_loc = Ele.InnerText.ToString();
if (Ele.GetAttribute("Name").ToString() == "CNT")
Detector_cnt = Ele.InnerText.ToString();
//if (Ele.GetAttribute("Name").ToString() == "DESC_NAME")
// Detector_desc = Ele.InnerText.ToString();
}
//Detector Tag Insert (Count 값으로 자동생성)
//Group Detector Dfactor 삽입추가(15.10.04) ex) Unit-Type c
for (i = 0; i < tag_Count; i++)
{
Add_Detector(grouptag_ID, grouptag_Name, tag_Ele);
}
}
catch (Exception ex)
{
(sender as ASPxGridView).JSProperties["cpConfirmationMessage"] = ex.ToString();
fgm_moduler.func_Class.conn.Close();
e.Cancel = true;
GridGroupDetector.CancelEdit();
return;
}
e.Cancel = true;
GridGroupDetector.CancelEdit();
GridGroupDetector.JSProperties["cpNewWindowUrl"] = "FDMQNA.aspx?TYPE=" + Detector_type + "&OBID=" + grouptag_ID + "&UNIT=" + Detector_unit + "&LOC=" + Detector_loc + "&ZONE=" + zone + "&CNT=" + tag_Count;
}
protected string get_DetectorName(XmlElement tag_Ele, XmlDocument env_config)
{
string names="";
foreach (XmlElement xe in env_config.SelectNodes("//GENERAL/TAG_NO/GROUP_DETECTOR/FACTOR[@D_FACTOR='TRUE']"))
{
string db_name = xe.GetAttribute("NAME");
string seperator = xe.GetAttribute("SEPERATOR");
names = names + seperator;
names = names + tag_Ele.SelectSingleNode("./Data[@Name ='" + db_name + "']").InnerText;
}
return names;
}
protected string get_DetectorSeq(string tag_Name, ref string len)
{
SqlDataAdapter data_adapter;
DataTable dt = new DataTable();
string seq="";
string seq_qry = " SELECT TOP 1 N1LIBRARYNO AS SEQ, LEN(N1LIBRARYNO) AS LEN ";
seq_qry = seq_qry + " FROM N2REVGRP WHERE N1PROJECTNAME = '" + SessionInfo.ProjectName + "' AND N1CLASS = 'TagDetector' ";
seq_qry = seq_qry + " AND N1TERMINATIONDATE = '' AND N1NAME LIKE '" + tag_Name + "-%'";
seq_qry = seq_qry + " ORDER BY N1NAME DESC ";
data_adapter = new SqlDataAdapter(seq_qry, fgm_moduler.func_Class.connString);
data_adapter.Fill(dt);
if (dt.Rows.Count > 0)
{
seq = dt.Rows[0]["SEQ"].ToString();
for (int i = 0; i < Int32.Parse(dt.Rows[0]["LEN"].ToString()); i++)
{
len = len + "0";
}
len = "{0:" + len + "}";
return seq;
}
else
{
len = "{0:0000}";
return "0";
}
}
protected void GridGroupDetector_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
{
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "OBID = '" + GridGroupDetector.GetRowValues(GridGroupDetector.FocusedRowIndex, "OBID").ToString() + "'";
}
protected void GridGroupDetector_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e)
{
if (e.GetValue("N1ISSUESTATE") == null)
{
e.Row.Enabled = true;
}
else if (e.GetValue("N1ISSUESTATE").ToString() != "")
{
e.Row.Enabled = false;
}
}
protected void GridGroupDetail_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e)
{
if (e.Row.Attributes["GROUP_NAME"] == group_Name)
return;
else
{
group_Name = e.Row.Attributes["GROUP_NAME"];
}
}
protected void GridGroupDetail_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)
{
if (e.KeyValue != null)
{
if (e.GetValue("AUTH").ToString() == "System")
{
e.Row.BackColor = Color.FromName("#E6E6FA");
e.Row.ForeColor = Color.Black;
}
else
{
}
}
}
protected DataTable Srch_DropDown(string db_name)
{
string load_qry;
FGMModule fgm_moduler;
fgm_moduler = new FGMModule("FDM", SessionInfo.ProjectName, "TagGroupDetector");
SqlDataAdapter data_adapter;
DataSet ds_datafield = new DataSet();
load_qry = "SELECT LOOKUPDETNAME, LOOKUPDETDESC FROM LOOKUPDET ";
load_qry = load_qry + " WHERE LOOKUPNAME = '" + db_name + "' AND DEPENDENTPROJECT = '" + SessionInfo.ProjectName + "' AND TERMINATIONDATE = '' ";
load_qry = load_qry + " ORDER BY LOOKUPDETDESC ";
data_adapter = new SqlDataAdapter(load_qry, fgm_moduler.func_Class.admin_connString);
data_adapter.Fill(ds_datafield, "DropDownItem");
return ds_datafield.Tables["DropDownItem"];
}
protected void GridGroupDetail_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
{
string property = e.NewValues["N3_VALUE"].ToString();
ASPxGridView gv = sender as ASPxGridView;
e.Cancel = true;
gv.CancelEdit();
}
protected void GridGroupDetail_BatchUpdate(object sender, ASPxDataBatchUpdateEventArgs e)
{
SqlCommand up_cmd = new SqlCommand();
up_cmd.Connection = fgm_moduler.func_Class.conn;
bool success = false;
string grouptag_Name;
XmlDocument tag_Doc = new XmlDocument();
XmlElement tag_Ele;
XmlElement data_Ele;
tag_Ele = tag_Doc.CreateElement("Detector");
tag_Ele.SetAttribute("Name", tagName.Value);
tag_Ele.SetAttribute("OBID", Detector_obid);
tag_Doc.AppendChild(tag_Ele);
DataTable dt1 = Srch_DataField("FDM");
DataTable dt = dynamic_table;
dt.Columns.Add("v_state");
dt.Columns.Add("old_value");
//dt.Columns.Add("old_value");
string db_name = "";
string auth = "";
foreach (var args in e.UpdateValues)
{
db_name = args.Keys[0].ToString();
DataRow dr = dt.Select("DB_NAME = '" + db_name + "'")[0];
if(dr["AUTH"].ToString() != "System")
{
string newValue = "";
if (args.NewValues["N3_VALUE"] != null)
newValue = args.NewValues["N3_VALUE"].ToString();
dr["old_value"] = args.OldValues["N3_VALUE"].ToString();
dr["N3_VALUE"] = newValue;
dr["v_state"] = "Updated";
}
}
foreach (DataRow dr in dt.Select("AUTH <> 'System'", "VIEW_SEQ"))
{
//db_name = dr["DB_NAME"].ToString();
//auth = dr["AUTH"].ToString();
data_Ele = tag_Doc.CreateElement("Data");
data_Ele.SetAttribute("Name", dr["DB_NAME"].ToString());
data_Ele.InnerText = dr["N3_VALUE"].ToString();
if (dr["v_state"].ToString() == "Updated")
{
data_Ele.SetAttribute("v_state", "Updated");
data_Ele.SetAttribute("old_value", dr["old_value"].ToString());
}
tag_Ele.AppendChild(data_Ele);
}
grouptag_Name = fgm_moduler.Validate_tagName(ref tag_Ele, env_config, module_Name, "");
if (grouptag_Name.Contains("Err"))
{
(sender as ASPxGridView).JSProperties["cpConfirmationMessage"] = "Tag No : Error - "+group_Name;
return;
}
if (grouptag_Name != tag_Ele.GetAttribute("oldValue"))
{
fgm_moduler.Update_N2REVGRP(up_cmd, "N1NAME", grouptag_Name, Detector_obid);
tagName.Value = grouptag_Name;
}
try
{
foreach (XmlElement Ele in tag_Ele.SelectNodes("./Data[@v_state = 'Updated']"))
{
//Count Handling
if (Ele.GetAttribute("Name").ToString() == "CNT")
{
int prev_cnt; int cur_cnt;
try
{
prev_cnt = Convert.ToInt32(Ele.Attributes["old_value"].Value);
cur_cnt = Convert.ToInt32(Ele.InnerText);
}
catch (Exception ex)
{
(sender as ASPxGridView).JSProperties["cpConfirmationMessage"] = "CNT : Invalid value";
success = false;
continue;
}
if (prev_cnt < cur_cnt)
{
int add = cur_cnt - prev_cnt;
for (int i = 0; i < add; i++)
{
Add_Detector(Detector_obid, grouptag_Name,tag_Ele);
}
}
else if (prev_cnt == cur_cnt)
{
success = false;
continue;
}
else
{
int del = prev_cnt - cur_cnt;
for (int i = 0; i < del; i++)
{
Del_Detector(Detector_obid);
}
}
}
fgm_moduler.Add_Attr(ref up_cmd, Ele.GetAttribute("Name"), "text", Ele.InnerText, Detector_obid);
success = true;
}
if (e.UpdateValues.Count > 0)
{
if (success)
{
fgm_moduler.Update_N2REVGRP(up_cmd, "N1LASTUPDATED", "date", Detector_obid);
fgm_moduler.Update_N2REVGRP(up_cmd, "", "version", Detector_obid);
}
}
makeViewGridGroupDetail(Detector_obid);
}
catch (Exception ex)
{
(sender as ASPxGridView).JSProperties["cpConfirmationMessage"] = ex.ToString();
}
e.Handled = true;
}
protected void Add_Detector(string grouptag_OBID, string grouptag_Name, XmlElement grouptag_Ele)
{
SqlCommand Add_cmd = new SqlCommand();
Add_cmd.Connection = fgm_moduler.func_Class.conn;
//string unit = ""; string type = ""; string group_name = "";
string tag_Seq = "";
string tag_Seq_Len = "";
string tag_Name = "";
string tag_ID = "";
tag_Name = get_DetectorName(grouptag_Ele, env_config);
tag_Seq = get_DetectorSeq(tag_Name, ref tag_Seq_Len);
if (true)
{
tag_Seq = string.Format(tag_Seq_Len, Int32.Parse(tag_Seq) + 1);
}
else
{
}
//tag_Seq = string.Format(tag_Seq_Len, Int32.Parse(tag_Seq) + 1);
tag_ID = fgm_moduler.Create_GUID();
if (SessionInfo.ProjectName == "INAS")
{
// fgm_moduler.Add_N2REVGRP(Add_cmd, env_config, "TagDetector", tag_ID, tag_Name + tag_Seq, zone, tag_Seq);
}
else
fgm_moduler.Add_N2REVGRP(Add_cmd, env_config, "TagDetector", tag_ID, tag_Name + "-" + tag_Seq, zone, tag_Seq);
//Group Detector Dfactor 삽입추가(15.10.04) ex) Unit-Type c
foreach (XmlElement xe in env_config.SelectNodes("//GENERAL/TAG_NO/GROUP_DETECTOR/FACTOR[@D_FACTOR='TRUE']"))
{
string attr_name = xe.GetAttribute("NAME");
string attr_value = grouptag_Ele.SelectSingleNode("./Data[@Name ='" + attr_name + "']").InnerText;
fgm_moduler.Add_Attr(ref Add_cmd, attr_name, "text", attr_value, tag_ID);
}
fgm_moduler.Add_Attr(ref Add_cmd, "SEQ", "text", tag_Seq, tag_ID);
fgm_moduler.Add_Attr(ref Add_cmd, "REF_N1NAME", "text", grouptag_Name, tag_ID);
fgm_moduler.Save_N3RGRPRRP(ref Add_cmd, grouptag_OBID, "", tag_ID, "TagGroupDetector", "", grouptag_Name);
}
protected void Del_Detector(string groupOBID)
{
SqlDataAdapter data_adapter;
DataTable dt = new DataTable();
SqlCommand del_cmd = new SqlCommand();
del_cmd.Connection = fgm_moduler.func_Class.conn;
string qry = "SELECT TOP 1 C.OBID FROM N2REVGRP C ";
qry = qry + " INNER JOIN N3RGRPRGRP R ON R.LEFTREL = C.OBID ";
qry = qry + " WHERE C.N1PROJECTNAME = '" + fgm_moduler.func_Class.project_Name + "' AND R.RIGHTREL = '" + groupOBID + "' ";
qry = qry + " AND C.N1CLASS = 'TagDetector' AND R.N1TERMINATIONDATE = '' AND C.N1TERMINATIONDATE ='' ";
qry = qry + " ORDER BY N1LIBRARYNO DESC ";
data_adapter = new SqlDataAdapter(qry, fgm_moduler.func_Class.connString);
data_adapter.Fill(dt);
string max_seq_obid = dt.Rows[0][0].ToString();
string d_qry = "UPDATE N3RGRPRGRP SET N1TERMINATIONDATE = REPLACE(REPLACE(CONVERT(varchar(23), GETDATE(), 121), '-','/'),' ', '-'), ";
d_qry = d_qry + "N1TERMINATIONSESID = '" + SessionInfo.UserName + "' WHERE LEFTREL = '" + max_seq_obid + "' AND RIGHTREL = '" + groupOBID + "'";
d_qry = d_qry + " AND N1TERMINATIONDATE = '' ";
del_cmd.CommandText = d_qry;
del_cmd.ExecuteNonQuery();
fgm_moduler.Update_N2REVGRP(del_cmd, "N1TERMINATIONDATE", "date", max_seq_obid);
}
protected void GridEffectList_CustomJSProperties(object sender, CustomJSPropertiesEventArgs e)
{
ASPxGridView gv_effect = sender as ASPxGridView;
Hashtable selectedRowTable = new Hashtable();
for (int i = 0; i < gv_effect.VisibleRowCount; i++)
{
DataRow dr = gv_effect.GetDataRow(i);
if(!selectedRowTable.ContainsKey(dr["OBID"].ToString()))
selectedRowTable.Add(dr["OBID"].ToString(), string.Format("{0} {1}", dr["TagNo"].ToString(), dr["Location"].ToString()));
}
e.Properties["cpgetTokenname"] = selectedRowTable;
}
public int effect_cnt = 0;
protected void CallbackPanel1_Callback(object sender, CallbackEventArgsBase e)
{
if (e.Parameter == "Insert_Effect")
{
effect_cnt++;
ASPxDropDownEdit ddl1 = new ASPxDropDownEdit();
ddl1.ID = "ddlRunTime-" + effect_cnt.ToString();
ddl1.Width = Unit.Percentage(99);
ddl1.NullText = "Effect-" + effect_cnt.ToString();
//DropDownTemplate ddeTemplate = new DropDownTemplate();
Control cnr = LoadControl("./EffectGrid.ascx?zone=FZ-01");
cnr.ID = "cnr-" + effect_cnt.ToString();
cnr.Page.Response.Write("asdf");
//ddl1.DropDownWindowTemplate = (ITemplate)cnr;
gv1temp.Controls.Add(cnr);
}
}