프로젝트

일반

사용자정보

개정판 923501a9

ID923501a9dad9674cae9b6759ab55ea3255ad6e3f
상위 93c417a9
하위 1ecaaba8

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

dev issue #1286 : attribute text label modeling form

Change-Id: Ib34f6fdec1cc31e8ff3a86daa7bf714a1e738e1f

차이점 보기:

DTI_PID/SPPIDConverter/DB/Project_DB.cs
262 262
                                }
263 263

  
264 264
                                #region Check Column 업데이트시 예비용
265
                                //cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_ATTRIBUTE_MAPPING_TABLE);
266
                                //using (SQLiteDataReader dr = cmd.ExecuteReader())
267
                                //using (DataTable dt = new DataTable())
268
                                //{
269
                                //    dt.Load(dr);
270
                                //    if (!dt.Columns.Contains("ISTEXT"))
271
                                //    {
272
                                //        cmd.CommandText = string.Format("ALTER TABLE {0} ADD COLUMN ISTEXT BIT", SPPID_ATTRIBUTE_MAPPING_TABLE);
273
                                //        cmd.ExecuteNonQuery();
274
                                //    }
275
                                //}
265
                                cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_ATTRIBUTE_MAPPING_TABLE);
266
                                using (SqlDataReader dr = cmd.ExecuteReader())
267
                                using (DataTable dt = new DataTable())
268
                                {
269
                                    dt.Load(dr);
270
                                    if (!dt.Columns.Contains("ISTEXT"))
271
                                    {
272
                                        cmd.CommandText = string.Format("ALTER TABLE {0} ADD ISTEXT BIT", SPPID_ATTRIBUTE_MAPPING_TABLE);
273
                                        cmd.ExecuteNonQuery();
274
                                    }
275
                                }
276 276
                                #endregion
277 277
                            }
278 278
                            result = true;
......
944 944
                        using (SQLiteCommand cmd = connection.CreateCommand())
945 945
                        {
946 946
                            cmd.CommandText = string.Format(@"
947
                            SELECT sa.UID, sa.DisplayAttribute, st.TYPE, spa.SPPID_ATTRIBUTE, sp.SPPID_SYMBOL_PATH, spl.LOCATION, spl.LEADERLINE, sa.Property
947
                            SELECT sa.UID, sa.DisplayAttribute, st.TYPE, spa.SPPID_ATTRIBUTE, sp.SPPID_SYMBOL_PATH, spa.ISTEXT, spl.LOCATION, spl.LEADERLINE, sa.Property
948 948
                            FROM {1} as sa, {0} as st 
949 949
                                 LEFT OUTER JOIN {2} as sp 
950 950
                                      ON sa.UID = SP.UID 
......
979 979
                            using (SqlCommand cmd = connection.CreateCommand())
980 980
                            {
981 981
                                cmd.CommandText = string.Format(@"
982
                            SELECT sa.UID, sa.DisplayAttribute, st.Type, spa.SPPID_ATTRIBUTE, sp.SPPID_SYMBOL_PATH, spl.LOCATION, spl.LEADERLINE, sa.Property
982
                            SELECT sa.UID, sa.DisplayAttribute, st.Type, spa.SPPID_ATTRIBUTE, sp.SPPID_SYMBOL_PATH, spa.ISTEXT, spl.LOCATION, spl.LEADERLINE, sa.Property
983 983
                            FROM {1} as sa
984 984
                                 LEFT OUTER JOIN {2} as sp 
985 985
                                      ON sa.UID = SP.UID 
......
1084 1084

  
1085 1085
            return dt;
1086 1086
        }
1087

  
1087 1088
        private static DataTable SelectDrawingProjectAttribute2()
1088 1089
        {
1089 1090
            DataTable dt = new DataTable();
......
1624 1625
            return true;
1625 1626
        }
1626 1627

  
1627
        public static bool InsertAttributeMapping(List<Tuple<string, string>> datas)
1628
        public static bool InsertAttributeMapping(List<Tuple<string, string, bool>> datas)
1628 1629
        {
1629 1630
            Project_Info projectInfo = Project_Info.GetInstance();
1630 1631
            if (projectInfo.DBType == ID2DB_Type.SQLite)
......
1643 1644
                                    foreach (var item in datas)
1644 1645
                                    {
1645 1646
                                        cmd.Parameters.Clear();
1646
                                        cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (UID, SPPID_ATTRIBUTE) VALUES (@UID, @SPPID_ATTRIBUTE)", SPPID_ATTRIBUTE_MAPPING_TABLE);
1647
                                        cmd.CommandText = string.Format("INSERT OR REPLACE INTO {0} (UID, SPPID_ATTRIBUTE, ISTEXT) VALUES (@UID, @SPPID_ATTRIBUTE, @ISTEXT)", SPPID_ATTRIBUTE_MAPPING_TABLE);
1647 1648
                                        cmd.Parameters.AddWithValue("@UID", item.Item1);
1648 1649
                                        cmd.Parameters.AddWithValue("@SPPID_ATTRIBUTE", item.Item2);
1650
                                        cmd.Parameters.AddWithValue("@ISTEXT", item.Item3);
1649 1651
                                        cmd.ExecuteNonQuery();
1650 1652
                                    }
1651 1653
                                }
......
1689 1691
                                    cmd.Parameters.Clear();
1690 1692
                                    cmd.CommandText = string.Format(@"
1691 1693
                                    IF EXISTS (SELECT * FROM {0} WHERE UID = '{1}')
1692
                                        UPDATE {0} SET SPPID_ATTRIBUTE = @SPPID_ATTRIBUTE WHERE UID = @UID
1694
                                        UPDATE {0} SET SPPID_ATTRIBUTE = @SPPID_ATTRIBUTE, ISTEXT = @ISTEXT WHERE UID = @UID
1693 1695
                                    ELSE
1694
                                        INSERT INTO {0} (UID, SPPID_ATTRIBUTE) VALUES (@UID, @SPPID_ATTRIBUTE)", SPPID_ATTRIBUTE_MAPPING_TABLE, item.Item1);
1696
                                        INSERT INTO {0} (UID, SPPID_ATTRIBUTE, ISTEXT) VALUES (@UID, @SPPID_ATTRIBUTE, @ISTEXT)", SPPID_ATTRIBUTE_MAPPING_TABLE, item.Item1);
1695 1697

  
1696 1698
                                    cmd.Parameters.AddWithValue("@UID", item.Item1);
1697 1699
                                    if (string.IsNullOrEmpty(item.Item2))
1698 1700
                                        cmd.Parameters.AddWithValue("@SPPID_ATTRIBUTE", DBNull.Value);
1699 1701
                                    else
1700 1702
                                        cmd.Parameters.AddWithValue("@SPPID_ATTRIBUTE", item.Item2);
1703
                                    cmd.Parameters.AddWithValue("@ISTEXT", item.Item3);
1701 1704
                                    cmd.ExecuteNonQuery();
1702 1705
                                }
1703 1706
                            }

내보내기 Unified diff