Пример #1
0
 private static void old_acctor_mc()
 {
     AppConfigInfo.UserID              = "";
     AppConfigInfo.OLEDBConnection     = "";
     AppConfigInfo.GHXBDBConnection    = "";
     AppConfigInfo.OLEDBServer         = "";
     AppConfigInfo.SDEServer           = "";
     AppConfigInfo.SDEInstance         = "";
     AppConfigInfo.SDEUser             = "";
     AppConfigInfo.SDEPassword         = "";
     AppConfigInfo.SDEVersion          = "";
     AppConfigInfo.SDEDatabase         = "";
     AppConfigInfo.LayerConfig         = "";
     AppConfigInfo.m_LayerConfigDB     = "";
     AppConfigInfo.IsLogin             = false;
     AppConfigInfo.StyleFileType       = 0;
     AppConfigInfo.m_pFeatureWorkspace = null;
     AppConfigInfo.m_Init              = false;
     AppConfigInfo.m_pWorkspace        = null;
     AppConfigInfo.m_IsCreate          = false;
     AppConfigInfo.Init();
 }
Пример #2
0
        public void CreateXML(string string_3)
        {
            try
            {
                string       str2;
                string       str3;
                ITable       table  = AppConfigInfo.OpenTable(this.string_0);
                IQueryFilter filter = new QueryFilter
                {
                    WhereClause = "  ParentIDS = '0'"
                };
                (filter as IQueryFilterDefinition).PostfixClause = " order by menuid ";
                XmlDocument   document = new XmlDocument();
                StringBuilder builder  = new StringBuilder();
                builder.Append("<?xml version='1.0' encoding='utf-8' ?>");
                builder.Append("<Bars>");
                builder.Append("</Bars>");
                document.LoadXml(builder.ToString());
                XmlNode node = document.ChildNodes[1];
                string  str  = "";
                ICursor o    = table.Search(null, false);
                IRow    row  = o.NextRow();
                int     num  = 0;
                SortedList <int, XmlNode> list = new SortedList <int, XmlNode>();
Label_009C:
                if (row == null)
                {
                    goto Label_0384;
                }
                XmlNode node2 = document.CreateElement("Bar");
                object  obj2  = row.get_Value(table.FindField("ItemCol"));
                object  obj3  = row.get_Value(table.FindField("OrderBy"));
                object  obj4  = row.get_Value(table.FindField("Caption"));
                object  obj5  = row.get_Value(table.FindField("Name"));
                object  obj6  = row.get_Value(table.FindField("Visible"));
                if (obj4 is DBNull)
                {
                    str2 = "";
                }
                else
                {
                    str2 = obj4.ToString().Trim();
                }
                if (obj5 is DBNull)
                {
                    str3 = "";
                }
                else
                {
                    str3 = obj5.ToString().Trim();
                }
                XmlAttribute attribute = document.CreateAttribute("caption");
                attribute.Value = str2;
                node2.Attributes.Append(attribute);
                attribute       = document.CreateAttribute("name");
                attribute.Value = str3;
                node2.Attributes.Append(attribute);
                if (obj3 is DBNull)
                {
                    attribute       = document.CreateAttribute("row");
                    attribute.Value = num.ToString();
                    node2.Attributes.Append(attribute);
                }
                else
                {
                    try
                    {
                        int num2 = int.Parse(obj3.ToString());
                        attribute       = document.CreateAttribute("row");
                        attribute.Value = num2.ToString();
                        node2.Attributes.Append(attribute);
                    }
                    catch
                    {
                    }
                }
                goto Label_036D;
Label_0232:
                attribute       = document.CreateAttribute("col");
                attribute.Value = "0";
                node2.Attributes.Append(attribute);
                goto Label_029A;
Label_025C:
                ;
                try
                {
                    int num3 = int.Parse(obj2.ToString());
                    attribute       = document.CreateAttribute("col");
                    attribute.Value = num3.ToString();
                    node2.Attributes.Append(attribute);
                }
                catch
                {
                }
Label_029A:
                attribute = document.CreateAttribute("visible");
                if (obj6 is DBNull)
                {
                    attribute.Value = "True";
                }
                else
                {
                    try
                    {
                        if (short.Parse(obj6.ToString()) == 0)
                        {
                            attribute.Value = "False";
                        }
                        else
                        {
                            attribute.Value = "True";
                        }
                    }
                    catch
                    {
                        attribute.Value = "True";
                    }
                }
                node2.Attributes.Append(attribute);
                int key = Convert.ToInt32(row.get_Value(table.FindField("menuid")));
                list.Add(key, node2);
                if (node2.ChildNodes.Count > 0)
                {
                    node.AppendChild(node2);
                }
                num++;
                row = o.NextRow();
                goto Label_009C;
Label_036D:
                if (!(obj2 is DBNull))
                {
                    goto Label_025C;
                }
                goto Label_0232;
Label_0384:
                ComReleaser.ReleaseCOMObject(o);
                foreach (KeyValuePair <int, XmlNode> pair in list)
                {
                    this.method_0(pair.Value, document, pair.Key, table);
                }
                if (str.Length != 0)
                {
                    document.ChildNodes[1].AppendChild(this.method_1(document, "MainMenu", str));
                }
                if (File.Exists(string_3))
                {
                    File.Delete(string_3);
                }
                document.Save(string_3);
            }
            catch (Exception exception)
            {
                Logger.Current.Error("", exception, "");
            }
            this.sysGrants_0.CloseTable();
        }
Пример #3
0
 static AppConfigInfo()
 {
     AppConfigInfo.old_acctor_mc();
 }
Пример #4
0
        public static ITable OpenTable(string string_0)
        {
            ITable table;
            string string0;
            string str;
            object obj;
            object obj1;

            try
            {
                if (!AppConfigInfo.m_Init)
                {
                    AppConfigInfo.m_pFeatureWorkspace = AppConfigInfo.GetWorkspace() as IFeatureWorkspace;
                    if (AppConfigInfo.m_pFeatureWorkspace != null)
                    {
                        AppConfigInfo.m_Init = true;
                    }
                }
                if (AppConfigInfo.m_pFeatureWorkspace != null)
                {
                    string0 = string_0;
                    if ((AppConfigInfo.m_pFeatureWorkspace as IWorkspace).Type ==
                        esriWorkspaceType.esriRemoteDatabaseWorkspace)
                    {
                        str = "";
                        try
                        {
                            object property =
                                (AppConfigInfo.m_pFeatureWorkspace as IWorkspace).ConnectionProperties.GetProperty(
                                    "VERSION");
                            str = property.ToString();
                            string[] strArrays = str.Split(new char[] { '.' });
                            str = ((int)strArrays.Length <= 1 ? "" : strArrays[0]);
                        }
                        catch (Exception exception)
                        {
                        }
                        if (AppConfigInfo.m_pFeatureWorkspace is ISQLSyntax)
                        {
                            string0 =
                                (AppConfigInfo.m_pFeatureWorkspace as ISQLSyntax).QualifyTableName(
                                    AppConfigInfo.SDEDatabase, str, string_0);
                        }
                    }
                    table = AppConfigInfo.m_pFeatureWorkspace.OpenTable(string0);
                    return(table);
                }
                else
                {
                    table = null;
                    return(table);
                }
            }
            catch (Exception exception1)
            {
                Logger.Current.Error("", exception1, "");
            }
            try
            {
                string0 = string_0;
                if ((AppConfigInfo.m_pFeatureWorkspace as IWorkspace).Type ==
                    esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    str = "DBO";
                    if (AppConfigInfo.m_pFeatureWorkspace is ISQLSyntax)
                    {
                        string0 =
                            (AppConfigInfo.m_pFeatureWorkspace as ISQLSyntax).QualifyTableName(
                                AppConfigInfo.SDEDatabase, str, string_0);
                    }
                }
                (AppConfigInfo.m_pFeatureWorkspace as IWorkspace).ConnectionProperties.GetAllProperties(out obj,
                                                                                                        out obj1);
                table = AppConfigInfo.m_pFeatureWorkspace.OpenTable(string0);
                return(table);
            }
            catch (Exception exception2)
            {
                Logger.Current.Error("", exception2, "");
            }
            table = null;
            return(table);
        }
Пример #5
0
        public static IWorkspace GetWorkspace()
        {
            IWorkspaceFactory sdeWorkspaceFactoryClass;
            IWorkspace        mPWorkspace;
            Exception         exception;

            if (!AppConfigInfo.m_IsCreate)
            {
                AppConfigInfo.m_IsCreate = true;
                string upper = AppConfigInfo.dbclient.ToUpper();
                if (!(upper == "SQLSERVER" ? false : !(upper == "ORACLE")))
                {
                    sdeWorkspaceFactoryClass = new SdeWorkspaceFactory();
                    try
                    {
                        IPropertySet propertySet = AppConfigInfo.CreateSdePropertySet();
                        if (propertySet != null)
                        {
                            AppConfigInfo.m_pWorkspace = sdeWorkspaceFactoryClass.Open(propertySet, 0);
                        }
                        else
                        {
                            mPWorkspace = null;
                            return(mPWorkspace);
                        }
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        Logger.Current.Error("", exception, "");
                    }
                }
                else if (upper != "MDB")
                {
                    try
                    {
                        if ((AppConfigInfo.m_LayerConfigDB.Length <= 0
                            ? false
                            : File.Exists(AppConfigInfo.m_LayerConfigDB)))
                        {
                            sdeWorkspaceFactoryClass   = new FileGDBWorkspaceFactory();
                            AppConfigInfo.m_pWorkspace =
                                sdeWorkspaceFactoryClass.OpenFromFile(AppConfigInfo.m_LayerConfigDB, 0);
                        }
                    }
                    catch (Exception exception2)
                    {
                        exception = exception2;
                        MessageBox.Show(exception.Message);
                        Logger.Current.Error("", exception, "");
                    }
                }
                else
                {
                    try
                    {
                        if ((AppConfigInfo.m_LayerConfigDB.Length <= 0
                            ? false
                            : File.Exists(AppConfigInfo.m_LayerConfigDB)))
                        {
                            sdeWorkspaceFactoryClass   = new AccessWorkspaceFactory();
                            AppConfigInfo.m_pWorkspace =
                                sdeWorkspaceFactoryClass.OpenFromFile(AppConfigInfo.m_LayerConfigDB, 0);
                        }
                    }
                    catch (Exception exception3)
                    {
                        exception = exception3;
                        MessageBox.Show(exception.Message);
                        Logger.Current.Error("", exception, "");
                    }
                }
            }
            mPWorkspace = AppConfigInfo.m_pWorkspace;
            return(mPWorkspace);
        }