public IsbNode Load()
        {
            var methodsSupports = CheckTableExist("MBVidAnMethod");
            var rootRefNode     = new IsbNode("Тип справочника");

            if (this.CheckTableExist("MBVidAn") && this.CheckTableExist("MBVidAnRecv"))
            {
                SqlCommand command = new SqlCommand();
                command.Connection  = Connection;
                command.CommandText = "select Vid, Name, Kod, Exprn, LastUpd, Comment from MBVidAn order by Name ASC";
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var refNode = new IsbNode();
                        refNode.Type = IsbNodeType.ReferenceType;
                        //ИД
                        refNode.Id = reader.GetInt32(0);
                        //Имя (Код)
                        if ((!reader.IsDBNull(1)) && (!reader.IsDBNull(2)))
                        {
                            refNode.Name = reader.GetString(1).Trim() + " (" + reader.GetString(2).Trim() + ")";
                        }
                        if (!reader.IsDBNull(2))
                        {
                            refNode.Code = reader.GetString(2).Trim();
                        }
                        if (!reader.IsDBNull(3))
                        {
                            ReferenceEventsParser.ParseEvents(reader.GetString(3).Trim(), refNode);
                        }
                        if (!reader.IsDBNull(4))
                        {
                            refNode.LastUpdate = reader.GetDateTime(4);
                        }
                        if (!reader.IsDBNull(5))
                        {
                            refNode.Text = reader.GetString(5).Trim();
                        }


                        rootRefNode.Nodes.Add(refNode);
                    }
                }
                reader.Close();
                foreach (var node in rootRefNode.Nodes)
                {
                    LoadRecvisites(node);
                    if (methodsSupports)
                    {
                        LoadMethods(node);
                    }
                }
            }
            return(rootRefNode);
        }
        public IsbNode Load()
        {
            var     methodsSupports = CheckTableExist("MBEDocTypeMethod");
            IsbNode listNode        = null;

            if (this.CheckTableExist("MBEDocType") && CheckTableExist("MBEDocTypeRecv"))
            {
                SqlCommand command = new SqlCommand();
                command.Connection  = Connection;
                command.CommandText = "select TypeID, Kod, Name, Exprn, LastUpd, Comment from MBEDocType order by Name ASC";
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    listNode      = new IsbNode();
                    listNode.Name = "Тип карточки электронного документа";

                    while (reader.Read())
                    {
                        var eDocNode = new IsbNode();
                        eDocNode.Type = IsbNodeType.EDocType;
                        //ИД
                        eDocNode.Id   = reader.GetInt32(0);
                        eDocNode.Code = reader.GetString(1).Trim();
                        //Имя
                        eDocNode.Name = reader.GetString(2).Trim() + " (" + eDocNode.Code + ")";
                        //Текст событий
                        if (!reader.IsDBNull(3))
                        {
                            ReferenceEventsParser.ParseEvents(reader.GetString(3).Trim(), eDocNode);
                        }
                        //Дата последнего изменения
                        if (!reader.IsDBNull(4))
                        {
                            eDocNode.LastUpdate = reader.GetDateTime(4);
                        }
                        //Комментарий
                        if (!reader.IsDBNull(5))
                        {
                            eDocNode.Text = reader.GetString(5);
                        }

                        listNode.Nodes.Add(eDocNode);
                    }
                }
                reader.Close();
                foreach (var eDocNode in listNode.Nodes.Where(n => n.Id != 0))
                {
                    LoadRecvisites(eDocNode);
                    if (methodsSupports)
                    {
                        LoadMethods(eDocNode);
                    }
                }
            }
            return(listNode);
        }
Example #3
0
        public IsbNode Load()
        {
            var methodsSupports = CheckTableExist("SBDialogMethod");
            var rootRefNode     = new IsbNode("Диалог");

            if (this.CheckTableExist("SBDialog") && this.CheckTableExist("SBDialogRequisiteLink"))
            {
                SqlCommand command = new SqlCommand();
                command.Connection  = Connection;
                command.CommandText = "select XRecID, Name, Code, EventHandlersText, LastUpd, Comment from SBDialog order by Name ASC";
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var refNode = new IsbNode();
                        refNode.Type = IsbNodeType.Dialog;
                        refNode.Id   = reader.GetInt32(0);
                        refNode.Code = reader.GetString(2).Trim();
                        refNode.Name = reader.GetString(1).Trim() + " (" + refNode.Code + ")";
                        if (!reader.IsDBNull(3))
                        {
                            ReferenceEventsParser.ParseEvents(reader.GetString(3).Trim(), refNode);
                        }
                        if (!reader.IsDBNull(4))
                        {
                            refNode.LastUpdate = reader.GetDateTime(4);
                        }
                        if (!reader.IsDBNull(5))
                        {
                            refNode.Text = reader.GetString(5).Trim();
                        }


                        rootRefNode.Nodes.Add(refNode);
                    }
                }
                reader.Close();
                foreach (var node in rootRefNode.Nodes)
                {
                    LoadRecvisites(node);
                    if (methodsSupports)
                    {
                        LoadMethods(node);
                    }
                }
            }
            return(rootRefNode);
        }