public static void InitEdit(this RepositoryItemPopupContainerEdit edit, string layoutEntityName, string filterEntityName, bool isMarkCheck)
        {
            edit.QueryResultValue += (sender, e) =>
            {
                RepositoryItemPopupContainerEdit editValue = sender as RepositoryItemPopupContainerEdit;
                if (editValue == null)
                {
                    return;
                }
                PopupContainerControlExtention popupSample = editValue.Properties.PopupControl as PopupContainerControlExtention;
                if (popupSample == null)
                {
                    return;
                }
                var selectedList = editValue.GetSelection();
                if (selectedList.Count > 0)
                {
                    e.Value = selectedList[0];
                }
            };
            edit.EditValueChanged += (sender, e) =>
            {
                RepositoryItemPopupContainerEdit editValue = sender as RepositoryItemPopupContainerEdit;
                if (editValue == null)
                {
                    return;
                }
                PopupContainerControlExtention popupSample = editValue.Properties.PopupControl as PopupContainerControlExtention;
                if (popupSample == null)
                {
                    return;
                }
                popupSample.LoadUserData();
            };

            edit.QueryDisplayText += (sender, e) =>
            {
                RepositoryItemPopupContainerEdit editValue = sender as RepositoryItemPopupContainerEdit;
                if (editValue == null)
                {
                    return;
                }
                PopupContainerControlExtention popupSample = editValue.Properties.PopupControl as PopupContainerControlExtention;
                if (popupSample == null)
                {
                    return;
                }
                e.DisplayText = GetPopupEditText(popupSample);
            };

            PopupContainerControlExtention sample = new PopupContainerControlExtention(layoutEntityName, filterEntityName, isMarkCheck);

            sample.Tag = edit;
            edit.Properties.PopupControl = sample;
            sample.BindData(null);
        }
        public static void SelectionChanged(object sender, EventArgs e)
        {
            PopupContainerControlExtention gridCheckMarks = (PopupContainerControlExtention)sender;

            if (!gridCheckMarks.IsMarkCheck)
            {
                return;
            }
            var edit = gridCheckMarks.Tag as PopupContainerEdit;

            if (edit == null)
            {
                return;
            }
            edit.Text = GetPopupEditText(gridCheckMarks);
        }
        private static string GetPopupEditText(PopupContainerControlExtention gridCheckMarks)
        {
            if (gridCheckMarks == null)
            {
                return(string.Empty);
            }
            StringBuilder sb          = new StringBuilder();
            string        displayName = gridCheckMarks.LayoutEntityDisplayName;

            for (int rIndex = 0; rIndex < gridCheckMarks.Selection.Count; rIndex++)
            {
                if (sb.ToString().Length > 0)
                {
                    sb.Append(",");
                }
                var    selectItem = gridCheckMarks.Selection[rIndex];
                string str        = selectItem.GetType().GetProperty(displayName).GetValue(selectItem, null).ToString();
                sb.Append(str);
            }
            return(sb.ToString());
        }
        public static List <Guid> GetSelection(this RepositoryItemPopupContainerEdit edit)
        {
            PopupContainerControlExtention sample = edit.Properties.PopupControl as PopupContainerControlExtention;
            List <Guid> result = new List <Guid>();

            if (sample == null)
            {
                return(result);
            }
            if (sample.Selection.Count <= 0)
            {
                return(result);
            }
            for (int rIndex = 0; rIndex < sample.Selection.Count; rIndex++)
            {
                var selectItem  = sample.Selection[rIndex];
                var selectValue = selectItem.GetType().GetProperty(sample.LayOutEntityKey).GetValue(selectItem, null);
                result.Add((Guid)selectValue);
            }
            return(result);
        }