コード例 #1
0
        private void setDefaultValues(IServiceManager serviceManager, Field field, EditItemControl editItemControl)
        {
            object val = serviceManager.GetProperty(_defaultValues, field.Name);

            if (val != null)
            {
                editItemControl.Value = val;
            }
        }
コード例 #2
0
        private void PropertyComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Field field = (Field)PropertyComboBox.SelectedValue;

            this.SearchFilter.FieldName = field.Name;
            //TODO: Check if last two parameters null causes a problem -> that is to say, can it have a lookup? If so, get them somehow!
            editItemControl = EditItemManager.GetEditItemControl(this.WebURL, field, null, this.ContentType, null, null);
            FilterValueControlPanel.Children.Clear();
            FilterValueControlPanel.Children.Add(editItemControl);

            if (FilterTypeComboBox.SelectedItem == null)
            {
                FilterTypeComboBox.SelectedIndex = 0;
            }
        }
コード例 #3
0
        private Dictionary <object, object> setMappings()
        {
            mappingIsSet          = true;
            mappings              = new Dictionary <object, object>();
            fieldRequiredValidate = true;

            foreach (UIElement control in FieldMappingsStackPanel.Children)
            {
                if (control is Sobiens.Connectors.Studio.UI.Controls.EditItems.FieldMappingControl)
                {
                    Sobiens.Connectors.Studio.UI.Controls.EditItems.FieldMappingControl fieldMappingControl = control as Sobiens.Connectors.Studio.UI.Controls.EditItems.FieldMappingControl;
                    object value = fieldMappingControl.GetFieldValue();
                    if (value != null)
                    {
                        mappings.Add(fieldMappingControl.GetField(), value);
                    }
                }
            }
            foreach (UIElement control in FieldMappingsStackPanel.Children)
            {
                if (control is EditItemControl)
                {
                    EditItemControl editItemControl = control as EditItemControl;
                    if (!mappings.ContainsKey(editItemControl.Field))
                    {
                        if (editItemControl.hasBeenModified)
                        {
                            mappings.Add(editItemControl.Field, editItemControl.Value);
                        }

                        bool isNull = editItemControl.Value == null;
                        if (!isNull)
                        {
                            isNull = string.IsNullOrEmpty(editItemControl.Value.ToString());
                        }

                        if (editItemControl.Field.Required && isNull)
                        {
                            fieldRequiredValidate = false;
                        }
                    }
                }
            }
            return(mappings);
        }
コード例 #4
0
        private void GenerateEditForm(EUFolder folder, EUListItem listItem, string contentTypeID)
        {
            List <EUField> editableFields = SharePointManager.GetContentType(folder.SiteSetting, folder.WebUrl, folder.ListName, contentTypeID).Fields.GetEditableFields();

            for (int i = EditControlsPanel.Controls.Count - 1; i > -1; i--)
            {
                if (EditControlsPanel.Controls[i].Tag is EUField)
                {
                    EditControlsPanel.Controls.RemoveAt(i);
                }
            }

            int height = 30;

            EditItemControls = new List <EditItemControl>();
            for (int i = 0; i < editableFields.Count; i++)
            {
                EUField         field       = editableFields[i];
                EditItemControl editControl = GetEditItemControl(field, folder, listItem);

                Label fieldNameLabel = new Label();
                fieldNameLabel.Text     = field.DisplayName;
                fieldNameLabel.Location = new Point(10, height);
                fieldNameLabel.Tag      = field;
                toolTip1.SetToolTip(fieldNameLabel, field.Description);
                EditControlsPanel.Controls.Add(fieldNameLabel);

                editControl.Location = new Point(200, height);
                editControl.Width    = 400;
                editControl.Tag      = field;
                toolTip1.SetToolTip(editControl, field.Description);
                EditControlsPanel.Controls.Add(editControl);
                height = height + editControl.Height + 5;
                EditItemControls.Add(editControl);
            }
        }
コード例 #5
0
        private void setContentType(ContentType contentType)
        {
            IServiceManager serviceManager = ServiceManagerFactory.GetServiceManager(_siteSetting.SiteSettingType);

            string[] folderFieldInLimitedView = new string[] { "FileLeafRef" };

            double height = 10;

            fieldRequiredPresnet = false;
            FieldMappingsStackPanel.Children.Clear();

            //Get default mappings
            ItemPropertyMappings itemPropertyMappings = null;

            if (_folderSettings != null)
            {
                itemPropertyMappings = _folderSettings.GetItemPropertyMappings(contentType.ID);
            }

            List <Field> filtredField = contentType.Fields;

            if (_siteSetting.limitFolderEditableProperties & isFolder)
            {
                filtredField = contentType.Fields.Where(f => folderFieldInLimitedView.Contains(f.Name)).ToList();
            }

            foreach (Field field in filtredField)
            {
                if (!_displayFileName && field.Name == "FileLeafRef")
                {
                    continue;
                }

                Label label = new Label()
                {
                    Content = field.DisplayName.removeTextInsideParenthesis()
                };


                label.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                label.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                if (field.Required && !field.ReadOnly)
                {
                    label.Foreground     = new SolidColorBrush(Colors.Red);
                    label.Content       += "*";
                    fieldRequiredPresnet = true;
                }

                label.Margin = new Thickness(0, height, 5, 0);
                FieldMappingsStackPanel.Children.Add(label);

                //if (field.ReadOnly == false)
                //{
                EditItemControl editItemControl = EditItemManager.GetEditItemControl(_webURL, field, null, contentType, _siteSetting, _rootFolder);

                editItemControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                editItemControl.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                editItemControl.Margin = new Thickness(160, height, 0, 0);//



                FieldMappingsStackPanel.Children.Add(editItemControl);
                if (_properties != null && _properties.Count > 0)
                {
                    //Set default mapping value
                    ApplicationItemProperty defaultApplicationItemProperty = null;
                    if (itemPropertyMappings != null)
                    {
                        ItemPropertyMapping mapping = itemPropertyMappings.Where(m => m.ServicePropertyName == field.Name).FirstOrDefault();
                        if (mapping != null)
                        {
                            defaultApplicationItemProperty = _properties.Where(p => p.Name == mapping.ApplicationPropertyName).FirstOrDefault();
                            editItemControl.IsEnabled      = false;
                        }
                        else
                        {
                            mapping = _defaultFolderSetting.ItemPropertyMappings.Where(m => m.ServicePropertyName == field.Name).FirstOrDefault();
                            if (mapping != null)
                            {
                                defaultApplicationItemProperty = _properties.Where(p => p.Name == mapping.ApplicationPropertyName).FirstOrDefault();
                                editItemControl.IsEnabled      = false;
                            }
                        }
                    }

                    EditItems.FieldMappingControl fieldMappingControl = new EditItems.FieldMappingControl(_properties, field, defaultApplicationItemProperty);
                    fieldMappingControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    fieldMappingControl.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                    fieldMappingControl.Margin = new Thickness(350, height, 0, 0);

                    FieldMappingsStackPanel.Children.Add(fieldMappingControl);
                }

                height = height + editItemControl.GetHeight() + 5;

                if (_defaultValues != null)
                {
                    object[] args = { serviceManager, field, editItemControl };
                    Dispatcher.BeginInvoke(new setDefaultValuesDelegate(setDefaultValues), args);
                }


                //}
            }

            labelfieldRequired.Visibility = fieldRequiredPresnet ? Visibility.Visible : Visibility.Hidden;
        }