Esempio n. 1
0
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            if (context == null)
            {
                return(null);
            }
            ControlParameter instance  = (ControlParameter)context.Instance;
            string           controlID = instance.ControlID;

            if (string.IsNullOrEmpty(controlID))
            {
                return(null);
            }
            IDesignerHost service = (IDesignerHost)context.GetService(typeof(IDesignerHost));

            if (service == null)
            {
                return(null);
            }
            Control control = service.Container.Components[controlID] as Control;

            if (control == null)
            {
                return(null);
            }
            return(new TypeConverter.StandardValuesCollection(this.GetPropertyNames(control)));
        }
        /// <devdoc>
        /// Returns a collection of standard values retrieved from the context specified
        /// by the specified type descriptor.
        /// </devdoc>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            if (context == null)
            {
                return(null);
            }

            // Get ControlID
            ControlParameter param     = (ControlParameter)context.Instance;
            string           controlID = param.ControlID;

            // Check that we actually have a control ID
            if (String.IsNullOrEmpty(controlID))
            {
                return(null);
            }

            // Get designer host
            IDesignerHost host = (IDesignerHost)context.GetService(typeof(IDesignerHost));

            Debug.Assert(host != null, "Unable to get IDesignerHost in ControlPropertyNameConverter");

            if (host == null)
            {
                return(null);
            }

            // Get control
            ComponentCollection allComponents = host.Container.Components;

            Control control = allComponents[controlID] as Control;

            if (control == null)
            {
                return(null);
            }

            string[] propertyNames = GetPropertyNames(control);

            return(new StandardValuesCollection(propertyNames));
        }
 private void InitExistingList()
 {
     MessageItem message = UIFactory.Instance.GetSpeakContext().Message;
     this.RecipientListSource.ID = "RecipientListSource";
     if (Sitecore.Context.User.IsAdministrator)
     {
     this.RecipientListSource.SelectCommand = "fast:@recipientContainerPath[@@id = '@recipientContainerId']//*[(@@templateid='@recipientListTemplate') and @filterExpression]";
     }
     else
     {
     this.RecipientListSource.SelectCommand = "fast:@recipientContainerPath[@@id = '@recipientContainerId']//*[(@__Created by='@ownerName') and (@@templateid='@recipientListTemplate') and @filterExpression]";
     }
     Parameter parameter = new Parameter("@recipientContainerPath") {
     DefaultValue = ItemUtilExt.GetRecipientListsContainerItem(message.InnerItem).Paths.FullPath
     };
     this.RecipientListSource.SelectParameters.Add(parameter);
     Parameter parameter2 = new Parameter("@recipientContainerId") {
     DefaultValue = ItemUtilExt.GetRecipientListsContainerItem(message.InnerItem).ID.ToString()
     };
     this.RecipientListSource.SelectParameters.Add(parameter2);
     Parameter parameter3 = new Parameter("@recipientListTemplate") {
     DefaultValue = "{B95EB9EA-8F86-44FE-B619-4B29C1343F95}"
     };
     this.RecipientListSource.SelectParameters.Add(parameter3);
     if (!Sitecore.Context.User.IsAdministrator)
     {
     Parameter parameter5 = new Parameter("@ownerName")
     {
         DefaultValue = Sitecore.Context.User.Name.Replace(@"\\", @"\")
     };
     this.RecipientListSource.SelectParameters.Add(parameter5);
     }
     ControlParameter parameter4 = new ControlParameter("@filterExpression", this.FilterDropList.ID, "FilterExpression") {
     DefaultValue = "true"
     };
     this.RecipientListSource.SelectParameters.Add(parameter4);
     this.FilterDropList.DataSourceId = this.RecipientListSource.ID;
     this.FilterDropList.Command = typeof(AddRecipientListCommand).FullName;
     this.FilterDropList.Width = new Unit("120px");
     this.FilterDropList.CssClass = "sc-recipient-menu-button";
     if (!string.IsNullOrEmpty(this.DataSourceItem["Use Existing List Button"]))
     {
     this.FilterDropList.Title = this.DataSourceItem["Use Existing List Button"];
     }
 }
Esempio n. 4
0
		protected ControlParameter (ControlParameter original) : base (original)
		{
			this.ControlID = original.ControlID;
			this.PropertyName = original.PropertyName;
		}
        private IEnumerable<Parameter> GetPropertyControlWhereParameters(Control control,
            IControlParameterTarget paramTarget, MetaColumn column) {
            ControlParameter controlParameter = new ControlParameter() {
                Name = column.Name,
                ControlID = control.UniqueID,
                PropertyName = paramTarget.GetPropertyNameExpression(column.Name)
            };
            
            DataSourceUtil.SetParameterTypeCodeAndDbType(controlParameter, column);

            yield return controlParameter;
        }
        private IEnumerable<Parameter> GetForeignKeyControlWhereParameters(Control control,
            IControlParameterTarget paramTarget, MetaForeignKeyColumn column) {

            MetaTable parentTable = paramTarget.Table;
            if (parentTable != null) {
                string namePrefix = String.Empty;
                // Make sure the data types match
                if (column.ColumnType != parentTable.EntityType) {
                    throw new Exception(String.Format(CultureInfo.CurrentCulture,
                        DynamicDataResources.DynamicControlParameter_DynamicDataSourceColumnNotCompatibleWithTable,
                        column.DisplayName, parentTable.Name));
                }

                // For each underlying FK, we need to create a ControlParameter
                Debug.Assert(column.ForeignKeyNames.Count == parentTable.PrimaryKeyColumns.Count);
                int index = 0;
                foreach (var fkName in column.ForeignKeyNames) {
                    MetaColumn parentTablePKColumn = parentTable.PrimaryKeyColumns[index++];

                    var controlParameter = new ControlParameter() {
                        Name = fkName,
                        ControlID = control.UniqueID,
                        PropertyName = paramTarget.GetPropertyNameExpression(parentTablePKColumn.Name)
                    };

                    DataSourceUtil.SetParameterTypeCodeAndDbType(controlParameter, parentTablePKColumn);

                    yield return controlParameter;
                }
            }
        }
        private IEnumerable<Parameter> GetPrimaryKeyControlWhereParameters(Control control,
            IControlParameterTarget paramTarget) {

            MetaTable parentTable = paramTarget.Table;
            if (parentTable != null) {
                // For each PK column in the table, we need to create a ControlParameter
                foreach (var keyColumn in parentTable.PrimaryKeyColumns) {
                    var controlParameter = new ControlParameter() {
                        Name = keyColumn.Name,
                        ControlID = control.UniqueID,
                        PropertyName = paramTarget.GetPropertyNameExpression(keyColumn.Name)
                    };

                    DataSourceUtil.SetParameterTypeCodeAndDbType(controlParameter, keyColumn);

                    yield return controlParameter;
                }
            }
        }
Esempio n. 8
0
 protected ControlParameter(ControlParameter original) : base(original)
 {
     this.ControlID    = original.ControlID;
     this.PropertyName = original.PropertyName;
 }
 public override void Initialize()
 {
     this._parameter = new ControlParameter();
     this._controlIDComboBox.SelectedItem = null;
     this._defaultValueTextBox.Text = string.Empty;
 }
Esempio n. 10
0
        /**************Search Button For Page 2*********************/
        protected void SearchButton_Click(object sender, EventArgs e)
        {
            tests.InnerText = DateLabel.Text + SearchRoomSelect.SelectedValue;
            ObjectDataSource ods3 = new ObjectDataSource("FinalProject.ReservationInfo", "ViewReservationsByRoom");
            ControlParameter dateCtl = new ControlParameter("date", System.TypeCode.String, "DateLabel", "Text");
            ControlParameter roomCtl = new ControlParameter("rm", System.TypeCode.String, "SearchRoomSelect", "SelectedValue");

            ods3.SelectParameters.Add(dateCtl);
            ods3.SelectParameters.Add(roomCtl);

            GridView3.DataSource = ods3;
            GridView3.DataBind();
        }
        internal static IEnumerable<Parameter> GetControlParameters(Control control, IDictionary<string, MetaColumn> nameColumnMapping) {
            IControlParameterTarget target = null;            

            target = DynamicDataManager.GetControlParameterTarget(control);
            Debug.Assert(target != null);            

            foreach (var entry in nameColumnMapping) {
                string parameterName = entry.Key;
                MetaColumn column = entry.Value;

                ControlParameter controlParameter = new ControlParameter() {
                    Name = parameterName,
                    ControlID = control.UniqueID
                };
                if (target != null) {
                    // this means the relationship consists of more than one key and we need to expand the property name
                    controlParameter.PropertyName = target.GetPropertyNameExpression(column.Name);
                }
                DataSourceUtil.SetParameterTypeCodeAndDbType(controlParameter, column);
                yield return controlParameter;
            }
        }
Esempio n. 12
0
		public ControlParameterPoker (ControlParameter control)
			: base (control)
		{
		}