protected override CustomListColumnCollection GetColumnsOverride(CustomListData data)
        {
            var columnCollection   = new CustomListColumnCollection();
            var chooseEntityOrView = data.Parameter.Split(';')[7];

            if (chooseEntityOrView == "View")
            {
                var link            = data.Parameter.Split(';')[0];
                var username        = data.Parameter.Split(';')[1];
                var password        = data.Parameter.Split(';')[2];
                var logicalNameView = data.Parameter.Split(';')[4];

                columnCollection = CrmHelper.GetViewColumns(link, username, password, logicalNameView);
            }
            else if (chooseEntityOrView == "Entity")
            {
                var      displayNameColumn    = data.Parameter.Split(';')[5];
                string[] newDisplayNameColumn = displayNameColumn.Replace(" ", String.Empty).Split(',');

                foreach (var c in newDisplayNameColumn)
                {
                    columnCollection.Add(new CustomListColumn(c, CustomListColumnTypes.String));
                }
            }

            return(columnCollection);
        }
        protected override CustomListObjectElementCollection GetItemsOverride(CustomListData data)
        {
            CustomListObjectElementCollection itemsCollection = new CustomListObjectElementCollection();
            var chooseEntityOrView = data.Parameter.Split(';')[7];

            var link     = data.Parameter.Split(';')[0];
            var username = data.Parameter.Split(';')[1];
            var password = data.Parameter.Split(';')[2];
            var maxRows  = data.Parameter.Split(';')[3];
            var logicalNameViewOrTable = data.Parameter.Split(';')[4];

            if (chooseEntityOrView == "View")
            {
                itemsCollection = CrmHelper.GetDataFromView(link, username, password, maxRows, logicalNameViewOrTable);
            }
            else if (chooseEntityOrView == "Entity")
            {
                var displayNameColumn = data.Parameter.Split(';')[5];
                var logicalNameColumn = data.Parameter.Split(';')[6];

                itemsCollection = CrmHelper.GetDataFromEntity(link, username, password, maxRows, logicalNameViewOrTable, displayNameColumn, logicalNameColumn);
            }

            return(itemsCollection);
        }
        private void btnTable_Click(object sender, RoutedEventArgs e)
        {
            this.columns.Items.Clear();

            List <CrmName> columns = CrmHelper.GetTableColumns(this.link.Text, this.username.Text, this.password.Password, ((ComboBoxItem)this.cboTable.SelectedItem).Tag.ToString());

            foreach (CrmName c in columns)
            {
                CheckBox cb = new CheckBox();
                cb.Content = c.displayName;
                cb.Tag     = c.logicalName;
                this.columns.Items.Add(cb);
            }
        }
        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            this.cboTable.Items.Clear();
            this.cboView.Items.Clear();


            List <CrmName> tableList = new List <CrmName>();

            tableList = CrmHelper.GetTablesName(this.link.Text, this.username.Text, this.password.Password);

            if (tableList == null || tableList.Count == 0)
            {
                return;
            }
            else
            {
                foreach (CrmName table in tableList)
                {
                    ComboBoxItem cboi = new ComboBoxItem
                    {
                        Content = table.displayName,
                        Tag     = table.logicalName
                    };
                    this.cboTable.Items.Add(cboi);
                }
            }


            List <CrmName> viewList = new List <CrmName>();

            viewList = CrmHelper.GetViewsName(this.link.Text, this.username.Text, this.password.Password);

            if (viewList == null || viewList.Count == 0)
            {
                return;
            }
            else
            {
                foreach (CrmName view in viewList)
                {
                    ComboBoxItem cboi = new ComboBoxItem
                    {
                        Content = view.displayName,
                        Tag     = view.logicalName
                    };
                    this.cboView.Items.Add(cboi);
                }
            }
        }