Пример #1
0
        public virtual void Configure <TBusinessObject> (BocList bocList, Func <TBusinessObject> newObjectFactory)
            where TBusinessObject : BaseSecurityManagerObject
        {
            ArgumentUtility.CheckNotNull("bocList", bocList);
            ArgumentUtility.CheckNotNull("newObjectFactory", newObjectFactory);

            if (!ControlHelper.IsDesignMode(bocList))
            {
                bocList.FixedColumns.Insert(
                    0,
                    new BocRowEditModeColumnDefinition
                {
                    Width      = Unit.Pixel(40),
                    EditIcon   = GetIcon("EditItem.gif", GlobalResourcesHelper.GetString(_globalizationService, GlobalResources.Edit)),
                    SaveIcon   = GetIcon("ApplyButton.gif", GlobalResourcesHelper.GetString(_globalizationService, GlobalResources.Apply)),
                    CancelIcon = GetIcon("CancelButton.gif", GlobalResourcesHelper.GetString(_globalizationService, GlobalResources.Cancel))
                });

                bocList.EditableRowChangesCanceled += HandleEditableRowChangesCanceled;

                bocList.ListMenuItems.Add(
                    new BocMenuItem
                {
                    Text    = GlobalResourcesHelper.GetString(_globalizationService, GlobalResources.New),
                    Command = new InlineEditingNewItemMenuItemCommand <TBusinessObject> (newObjectFactory)
                });
                bocList.ListMenuItems.Add(
                    new BocMenuItem
                {
                    Text = GlobalResourcesHelper.GetString(_globalizationService, GlobalResources.Delete),
                    RequiredSelection = RequiredSelection.OneOrMore,
                    Command           = new InlineEditingDeleteItemMenuItemCommand <TBusinessObject>()
                });
            }
        }
Пример #2
0
        protected void ResetListOnTenantChange(BocList list)
        {
            ArgumentUtility.CheckNotNull("list", list);

            if (HasTenantChanged)
            {
                CurrentFunction.Reset();
                list.LoadUnboundValue(GetValues(), false);
            }
        }
        private string GetSelectedRowIndicesAsString(BocList bocList)
        {
            var selectedRows = string.Join(", ", bocList.GetSelectedRows());

            if (string.IsNullOrEmpty(selectedRows))
            {
                selectedRows = "NoneSelected";
            }
            return(selectedRows);
        }
Пример #4
0
        protected override bool EvaluateIsValid()
        {
            Control control = this.NamingContainer.FindControl(ControlToValidate);
            BocList bocList = (BocList)control;

            if (!bocList.IsRequired)
            {
                return(true);
            }
            return(bocList.Value != null && bocList.Value.Count > 0);
        }
Пример #5
0
        protected void HandleNewButtonClick(BocList sender)
        {
            ArgumentUtility.CheckNotNull("sender", sender);

            if (!Page.IsReturningPostBack)
            {
                var editUserFormFunction = CreateEditFunction(WxeTransactionMode.CreateRootWithAutoCommit, null);
                Page.ExecuteFunction(editUserFormFunction, WxeCallArguments.Default);
            }
            else
            {
                if (!((FormFunction <T>)Page.ReturningFunction).HasUserCancelled)
                {
                    CurrentFunction.Reset();
                    sender.LoadUnboundValue(GetValues(), false);
                }
            }
        }
        private void OnVerbEditFixedColumns(object sender, EventArgs e)
        {
            BocList bocList = Component as BocList;

            if (bocList == null)
            {
                throw new InvalidOperationException("Cannot use BocListDesigner for objects other than BocList.");
            }

            PropertyDescriptorCollection propertyDescriptors = TypeDescriptor.GetProperties(bocList);
            PropertyDescriptor           propertyDescriptor  = propertyDescriptors["FixedColumns"];

            TypeDescriptorContext context = new TypeDescriptorContext(this, this, propertyDescriptor);
            object value = propertyDescriptor.GetValue(Component);
            BocColumnDefinitionCollectionEditor editor = null;

            editor = (BocColumnDefinitionCollectionEditor)TypeDescriptor.GetEditor(value, typeof(UITypeEditor));
            editor.EditValue(context, this, value);
        }
 public void SetInfoForNormalBocList(BocList bocList)
 {
     SelectedIndicesLabel.Text = GetSelectedRowIndicesAsString(bocList);
     SelectedViewLabel.Text    = bocList.SelectedView.ItemID;
     EditModeLabel.Text        = bocList.IsRowEditModeActive.ToString();
 }