示例#1
0
 public static bool SqlUpdate(EA.Repository rep, string updateString)
 {
     try
     {
         rep.Execute(updateString);
     }
     catch (Exception e)
     {
         MessageBox.Show($@"Update:\r\n{updateString}\r\n\r\n{e}", "Error update SQL");
         return(false);
     }
     return(true);
 }
        /// <summary>
        /// Create a Tagged value type
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public static bool DeleteTaggedValueTye(EA.Repository rep, string property)
        {
            try
            {
                string sql = $@"Delete from t_propertytypes where Property = '{property}';";

                rep.Execute(sql);
            }
            catch (Exception e)
            {
                MessageBox.Show($@"Property: '{property}'

{e}", @"Can't delete Tagged Value Type");
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Create a Tagged value type
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="property"></param>
        /// <param name="notes"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public static bool CreateTaggedValueType(EA.Repository rep, string property, string notes, string description)
        {
            try
            {
                string del = notes.Contains("'") ? @"""" : "'";
                string sql = $@"Insert into t_propertytypes ( Property, Notes, Description )
                                   values ({del}{property}{del}, {del}{notes}{del}, {del}{description}{del});";
                rep.Execute(sql);
            }
            catch (Exception e)
            {
                MessageBox.Show($@"Property: '{property}'

{e}", @"Can't create Tagged Value Type");
                return(false);
            }

            return(true);
        }