Exemple #1
0
 public SQLSCCProvider(List <SQLServer_Object> Childs, List <Variables> Vars, SQLServer SqlServerData, ImageList imageList, string FilterCad, FilteringTypeValues Info, int StartOffset)
 {
     this.SqlServerData = SqlServerData;
     this.imageList     = imageList;
     this.FilterCad     = FilterCad;
     this.Info          = Info;
     this.StartOffset   = StartOffset;
     this.Vars          = Vars;
     this.Childs        = Childs;
 }
        public SQLServer_Object(SQLServer Dad, int ID, string Name, string Descrption, DataType Kind)
        {
            _Daddy       = Dad;
            _Id          = ID;
            _Name        = Name;
            _Kind        = Kind;
            _Description = Descrption;
            _script      = "_";
            _Childs      = new List <SQLServer_Object>();
            switch (Kind)
            {
            case DataType.Table:
                _ImageIndex = 0;
                break;

            case DataType.View:
                _ImageIndex = 1;
                break;

            case DataType.StoredProcedure:
                _ImageIndex = 2;
                break;

            case DataType.Field:
                _ImageIndex = 3;
                break;

            case DataType.ForeignKeyField:
                _ImageIndex = 4;
                break;

            case DataType.KeyField:
                _ImageIndex = 5;
                break;

            case DataType.Variable:
                _ImageIndex = 6;
                break;

            case DataType.Snippet:
                _ImageIndex = 7;
                break;

            case DataType.DataBase:
                _ImageIndex = 8;
                break;
            }
        }
Exemple #3
0
 public SQLSCCProvider(SQLServer SqlServerData, ImageList imageList)
 {
     this.SqlServerData = SqlServerData;
     this.imageList     = imageList;
     Vars = new List <Variables>();
 }
Exemple #4
0
        public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
        {
            if (SqlServerData == null)
            {
                SqlServerData = new SQLServer(ConnectioString);
                SqlServerData.Initialize();
            }
            List <SQLServer_Object> Back;

            Back = SqlServerData.FilterByType(Info);
            if (Vars != null && Vars.Count > 0 && Info == FilteringTypeValues.Variables)
            {
                List <Variables> VarsBack = Vars.FindAll(N => N.Text.ToLower().StartsWith(FilterCad.ToLower()));
                if (VarsBack == null || VarsBack.Count == 0)
                {
                    _IsEmpty = true;
                }
                else
                {
                    _IsEmpty = false;
                }
                VarsBack.Sort(ICompletionDataCompare);
                return(VarsBack.ToArray());
            }
            if (Childs != null && Childs.Count > 0 && Info == FilteringTypeValues.Childs)
            {
                List <SQLServer_Object> ChildsBack = Childs.FindAll(N => N.Text.ToLower().StartsWith(FilterCad.ToLower()));
                if (ChildsBack == null || ChildsBack.Count == 0)
                {
                    _IsEmpty = true;
                }
                else
                {
                    _IsEmpty = false;
                }
                ChildsBack.Sort(ICompletionDataCompare);
                return(ChildsBack.ToArray());
            }
            //switch (Info)
            //{
            //    case FilteringTypeValues.Tables:
            //        Back = SqlServerData.FilterByType(FilteringTypeValues.Tables);
            //        break;
            //    case FilteringTypeValues.Views:
            //        Back = SqlServerData.FilterByType(FilteringTypeValues.Views);
            //        break;
            //    case FilteringTypeValues.Sps:
            //        Back = SqlServerData.FilterByType(FilteringTypeValues.Sps);
            //        break;
            //    case FilteringTypeValues.Code:
            //        Back = SqlServerData.FilterByType(FilteringTypeValues.ViewsAndSPs);
            //        break;
            //    case FilteringTypeValues.Fields:
            //        Back = SqlServerData.FilterByType(FilteringTypeValues.Fields);
            //        break;
            //    case FilteringTypeValues.All:
            //        Back = SqlServerData.FilterByType(FilteringTypeValues.All);
            //        break;
            //    default:
            //        Back = new List<CompletionData>();
            //        break;
            //}
            Back = Back.FindAll(N => N.Text.ToLower().StartsWith(FilterCad.ToLower()));
            if (Back == null || Back.Count == 0)
            {
                _IsEmpty = true;
            }
            else
            {
                _IsEmpty = false;
            }
            Back.Sort(ICompletionDataCompare);
            return(Back.ToArray());
        }