/// <summary> /// Create instance of object. /// </summary> /// <param name="control">Reference to the data source control.</param> /// <param name="oldTypeName">Existing type name.</param> public CslaDataSourceConfiguration(DataSourceControl control, string oldTypeName) : this() { _control = control; DiscoverTypes(); this.TypeComboBox.Text = oldTypeName; }
internal QueryableDataSourceView(DataSourceControl owner, string viewName, HttpContext context, IDynamicQueryable queryable) : base(owner, viewName) { _context = context; _queryable = queryable; _owner = owner; }
public DbEntryDesignerDataSourceView(DbEntryDataSourceDesigner owner) : base(owner, "MainView") { _dataSource = (DataSourceControl)owner.Component; _modelType = _dataSource.GetType().BaseType.GetGenericArguments()[0]; _info = ObjectInfoFactory.Instance.GetInstance(_modelType); }
/// <summary> /// Binds datasource control data to the viewer control /// </summary> private void BindControl() { if (DataSourceControl != null) { BasicRepeater.DataSource = DataSourceControl.LoadData(true); LoadTransformations(); BasicRepeater.DataBind(); binded = true; } }
public static void ProvideRowInsertion(ASPxScheduler control, DataSourceControl dataSource) { ObjectDataSource objectDataSource = dataSource as ObjectDataSource; if (objectDataSource != null) { ObjectDataSourceRowInsertionProvider provider = new ObjectDataSourceRowInsertionProvider(); provider.ProvideRowInsertion(control, objectDataSource); } }
/// <summary> /// Binds datasource control data to the viewer control /// </summary> private void BindControl() { if (DataSourceControl != null) { basicUniView.DataSource = DataSourceControl.LoadData(true); LoadTransformations(); basicUniView.DataBind(); binded = true; } }
/// <summary> /// Handles the data binding. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void HandleDataBinding(object sender, EventArgs e) { Control ctrl = (Control)sender; object val = GetValue(ctrl.NamingContainer) ?? string.Empty; if (data == null) { //Cache the data from the DataSourceControl, so that we only get the data once. If //we just set the DataSourceID on the dropdown, the select command would get called //once for each row. DataSourceControl dsc = this.Control.NamingContainer.FindControl(this.DataSourceID) as DataSourceControl; DataSourceView dsv = ((IDataSource)dsc).GetView("DefaultView"); dsv.Select(DataSourceSelectArguments.Empty, new DataSourceViewSelectCallback(this.DataSourceCallback)); } if (ctrl is EntityDropDownList) { EntityDropDownList eddl = (EntityDropDownList)ctrl; eddl.DataTextField = this.DataTextField; eddl.DataValueField = this.DataValueField; eddl.DataSource = this.data; eddl.AppendNullItem = this.AppendNullItem; } else if (ctrl is Label) { Label label = (Label)ctrl; EntityDropDownList temp = new EntityDropDownList(); temp.DataTextField = this.DataTextField; temp.DataValueField = this.DataValueField; temp.DataSource = this.data; temp.Visible = false; temp.AppendNullItem = this.AppendNullItem; label.Controls.Add(temp); temp.DataBind(); label.Text = String.Empty; foreach (ListItem listItem in temp.Items) { if (0 == String.Compare(listItem.Value, val.ToString())) { label.Text = listItem.Text; } } } }
public esDataSourceWizard(IServiceProvider provider, DataSourceControl esDataSource) { InitializeComponent(); this.esDataSource = esDataSource; this.provider = provider; this.helper = new esReflectionHelper(); //---------------------------------------------------- // Let's see if we can load our types right up !! //---------------------------------------------------- ITypeDiscoveryService discovery = null; if (esDataSource.Site != null) { discovery = (ITypeDiscoveryService)esDataSource.Site.GetService(typeof(ITypeDiscoveryService)); } ICollection types = discovery.GetTypes(typeof(esEntityCollectionBase), true); foreach (Type type in types) { if (type.IsClass && !type.IsAbstract) { if (type.IsSubclassOf(typeof(esEntityCollectionBase))) { try { esEntityCollectionBase coll = Activator.CreateInstance(type) as esEntityCollectionBase; if (coll != null) { collections[type.Name] = coll; } } catch { } } } } foreach (string collectionName in collections.Keys) { this.lboxCollections.Items.Add(collectionName); } }
/// <summary> /// Occurs when the server control is initialized. /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { base.OnInit(e); if (!String.IsNullOrEmpty(this.DataSourceID)) { if (Page.IsPostBack == false && base.DesignMode == false) { this.Sort(DefaultSortColumnName, _defaultSortDirection); } DataSourceControl dsc = (DataSourceControl)this.NamingContainer.FindControl(this.DataSourceID); System.Reflection.EventInfo eventInfo = dsc.GetType().GetEvent("Selected"); Delegate d = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, "dsc_Selected"); eventInfo.AddEventHandler(dsc, d); } }
/// <summary> /// Called by the ASP.NET page framework to notify server controls that /// use composition-based implementation to create any child controls they /// contain in preparation for posting back or rendering. /// </summary> protected override void CreateChildControls() { // Start with a clean form base.Controls.Clear(); cboFieldName = new DropDownList(); cboFieldName.ID = "cboFieldName"; cboFieldName.SkinID = "cboFieldName"; if (!base.DesignMode) { GridView1 = (GridView)this.NamingContainer.FindControl(this.GridViewControlID); TypedDataSource = (DataSourceControl)this.NamingContainer.FindControl(GridView1.DataSourceID); Type[] typeArguments = TypedDataSource.GetType().BaseType.GetGenericArguments(); _businessEntityType = typeArguments[0].FullName; #region Set up the fields drop down list using the list of table columns Type enumType = EntityUtil.GetType(string.Format("{0}Column", _businessEntityType)); Array c = Enum.GetValues(enumType); for (int i = 0; i < c.Length; i++) { ColumnEnumAttribute cea = EntityHelper.GetAttribute <ColumnEnumAttribute>((Enum)c.GetValue(i)); EnumTextValueAttribute etv = EntityHelper.GetAttribute <EnumTextValueAttribute>((Enum)c.GetValue(i)); // only show fields that we can realistically search against switch (cea.DbType) { case System.Data.DbType.AnsiString: case System.Data.DbType.AnsiStringFixedLength: case System.Data.DbType.Boolean: case System.Data.DbType.Byte: case System.Data.DbType.Currency: case System.Data.DbType.Date: case System.Data.DbType.DateTime: case System.Data.DbType.Decimal: case System.Data.DbType.Double: case System.Data.DbType.Int16: case System.Data.DbType.Int32: case System.Data.DbType.Int64: case System.Data.DbType.SByte: case System.Data.DbType.Single: case System.Data.DbType.String: case System.Data.DbType.StringFixedLength: case System.Data.DbType.Time: case System.Data.DbType.UInt16: case System.Data.DbType.UInt32: case System.Data.DbType.UInt64: case System.Data.DbType.VarNumeric: case System.Data.DbType.Xml: #region Add fields to the dropdown collection ListItem li = new ListItem(); li.Text = etv != null && !string.IsNullOrEmpty(etv.Text) ? EntityHelper.GetPascalSpacedName(etv.Text) : EntityHelper.GetPascalSpacedName(cea.Name); li.Value = cea.Name; cboFieldName.Items.Add(li); #endregion break; default: break; } } #endregion } else { cboFieldName.Items.Add(new ListItem("FieldName", "FieldValue")); } #region UI implementation cboOperator = new DropDownList(); cboOperator.ID = "cboOperator"; cboOperator.SkinID = "cboOperator"; cboOperator.Items.Add(new ListItem("contains", "0")); cboOperator.Items.Add(new ListItem("starts with", "1")); cboOperator.Items.Add(new ListItem("equals", "2")); cboOperator.Items.Add(new ListItem("ends with", "3")); txtKeyword = new TextBox(); txtKeyword.ID = "txtKeyword"; txtKeyword.SkinID = "txtKeyword"; Label lblLookFor = new Label(); lblLookFor.ID = "lblLookFor"; lblLookFor.SkinID = "lblLookFor"; lblLookFor.Text = LookForText; Label lblWhich = new Label(); lblWhich.ID = "lblWhich"; lblWhich.SkinID = "lblWhich"; lblWhich.Text = WhichText; Button cmdSearch = new Button(); cmdSearch.ID = "cmdSearch"; cmdSearch.SkinID = "cmdSearch"; cmdSearch.Text = "Search"; cmdSearch.CausesValidation = CausesValidation; cmdSearch.Click += new EventHandler(cmdSearch_Click); Button cmdReset = new Button(); cmdReset.ID = "cmdReset"; cmdReset.SkinID = "cmdReset"; cmdReset.Text = "Reset"; cmdReset.CausesValidation = CausesValidation; cmdReset.Click += new EventHandler(cmdReset_Click); Table tbl = new Table(); tbl.SkinID = "tblSearchPanel"; TableRow tr = new TableRow(); TableCell td; td = new TableCell(); td.Controls.Add(lblLookFor); tr.Cells.Add(td); td = new TableCell(); td.Controls.Add(cboFieldName); tr.Cells.Add(td); td = new TableCell(); td.Controls.Add(lblWhich); tr.Cells.Add(td); td = new TableCell(); td.Controls.Add(cboOperator); tr.Cells.Add(td); td = new TableCell(); td.Controls.Add(txtKeyword); tr.Cells.Add(td); td = new TableCell(); td.Controls.Add(cmdSearch); tr.Cells.Add(td); td = new TableCell(); td.Controls.Add(cmdReset); tr.Cells.Add(td); tbl.Rows.Add(tr); #endregion base.Controls.Add(tbl); base.ClearChildViewState(); }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (!StopProcessing) { #region "Caching options" // Set caching options if server processing is enabled if (DataSourceControl != null && EnableServerProcessing) { BasicBingMaps.CacheItemName = DataSourceControl.CacheItemName; BasicBingMaps.CacheMinutes = DataSourceControl.CacheMinutes; // Cache depends only on data source and properties of data source web part string cacheDependencies = CacheHelper.GetCacheDependencies(DataSourceControl.CacheDependencies, DataSourceControl.GetDefaultCacheDependencies()); // All view modes, except LiveSite mode if (PortalContext.ViewMode != ViewModeEnum.LiveSite) { // Cache depends on data source, properties of data source web part and properties of BasicBingMaps web part cacheDependencies += "webpartinstance|" + InstanceGUID.ToString().ToLowerCSafe(); } BasicBingMaps.CacheDependencies = cacheDependencies; } #endregion #region "Map properties" CMSMapProperties mp = new CMSMapProperties(); mp.Location = DefaultLocation; mp.EnableKeyboardShortcuts = EnableKeyboardShortcuts; mp.EnableMapDragging = EnableMapDragging; mp.Height = Height; mp.Width = Width; mp.EnableServerProcessing = EnableServerProcessing; mp.Longitude = Longitude; mp.Latitude = Latitude; mp.LatitudeField = LatitudeField; mp.LongitudeField = LongitudeField; mp.LocationField = LocationField; mp.MapKey = MapKey; mp.MapType = MapType; mp.Scale = Scale; mp.ShowNavigationControl = ShowNavigationControl; mp.ShowScaleControl = ShowScaleControl; mp.ToolTipField = ToolTipField; mp.IconField = IconField; mp.ZoomScale = ZoomScale; mp.MapId = ClientID; #endregion BasicBingMaps.MapProperties = mp; BasicBingMaps.HideControlForZeroRows = HideControlForZeroRows; BasicBingMaps.DataBindByDefault = false; BasicBingMaps.MainScriptPath = "~/CMSWebParts/Maps/Basic/BasicBingMaps_files/BingMaps.js"; // Add basic maps control to the filter collection EnsureFilterControl(); if (!String.IsNullOrEmpty(ZeroRowsText)) { BasicBingMaps.ZeroRowsText = ZeroRowsText; } } }
protected QueryableDataSourceView(DataSourceControl owner, string viewName, HttpContext context) : this(owner, viewName, context, new DynamicQueryableWrapper()) { _context = context; _owner = owner; }
/// <summary> /// Initialize the designer component. /// </summary> /// <param name="component">The CslaDataSource control to /// be designed.</param> public override void Initialize(IComponent component) { base.Initialize(component); _control = (DataSourceControl)component; }
internal ContextDataSourceView(DataSourceControl owner, string viewName, HttpContext context, IDynamicQueryable queryable) : base(owner, viewName, context, queryable) { }
protected ContextDataSourceView(DataSourceControl owner, string viewName, HttpContext context) : base(owner, viewName, context) { _owner = owner; }
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { LibTreeNode node = (LibTreeNode)e.Node; if (node.NodeType != NodeType.Class && node.NodeType != NodeType.Func && node.NodeType != NodeType.ReportFunc) { #region 创建Tabpage string tabNm = string.Format("{0}{2}{1}", node.Name, node.NodeType.ToString(), SysConstManage.Underline); if (this.libTabControl1.TabPages.ContainsKey(tabNm)) { this.libTabControl1.SelectedTab = this.libTabControl1.TabPages[tabNm]; return; } TabPage page = new TabPage(string.Format("{0}({1})", node.Text, node.NodeType.ToString())); page.Name = tabNm; #endregion this.libTabControl1.TabPages.Add(page); this.libTabControl1.SelectedTab = page; switch (node.NodeType) { case NodeType.DataModel: DataSourceControl dsControl = new DataSourceControl(node); dsControl.Dock = DockStyle.Fill; page.Controls.Add(dsControl); break; case NodeType.FormModel: FormTemplate fmControl = new FormTemplate(node); fmControl.Dock = DockStyle.Fill; page.Controls.Add(fmControl); break; case NodeType.PermissionModel: PermissionProperty permissionctrl = new PermissionProperty(node.Name); permissionctrl.Dock = DockStyle.Fill; page.Controls.Add(permissionctrl); SDPCRL.COM.ModelManager.LibPermissionSource libpermission = ModelDesignProject.GetLibPermissionById(node.Name); libpermission.Package = node.Package; permissionctrl.SetPropertyValue(libpermission, node); break; case NodeType.KeyValues: KeyValuesControl keyvaluectrl = new KeyValuesControl(node); keyvaluectrl.Dock = DockStyle.Fill; page.Controls.Add(keyvaluectrl); break; case NodeType.ReportModel: ReportSourceControl reportSourceControl = new ReportSourceControl(node); reportSourceControl.Dock = DockStyle.Fill; page.Controls.Add(reportSourceControl); break; case NodeType.TransBillModel: TransSourceControl tranSourceControl = new TransSourceControl(node); tranSourceControl.Dock = DockStyle.Fill; page.Controls.Add(tranSourceControl); break; } } }