private void AddControls(int level, IEnumerable <string> features, Dictionary <string, List <string> > subfeatures, IEnumerable <string> disabled) { foreach (string feature in features) { if (this.form.TemplateContainer.FindControl(feature) != null) { continue; } if (PX.Data.PXLicenseHelper.License.Licensed && !PX.Data.PXLicenseHelper.License.Features.Any(f => f.EndsWith(feature))) { continue; } PXCheckBox control = new PXCheckBox(); control.ID = feature; control.DataField = feature; control.Enabled = !disabled.Contains(feature); control.TextAlign = TextAlign.Right; if (level > 0) { control.Style["margin-left"] = level * 25 + "px"; } control.CommitChanges = true; control.ApplyStyleSheetSkin(this.Page); this.form.TemplateContainer.Controls.Add(control); if (subfeatures.ContainsKey(feature)) { AddControls(level + 1, subfeatures[feature], subfeatures, disabled); } } }
protected void Page_Init(object sender, EventArgs e) { string query = Request.QueryString["query"]; WikiID = Request.QueryString["wikiid"]; WikiNumber = Request.QueryString["wikinumber"]; CategoryID = Request.QueryString["categoryID"]; ProductID = Request.QueryString["productID"]; OrderID = Request.QueryString["orderID"]; imgMessage = PXFormView1.FindControl("imgMessage") as Image; lblMessage = PXFormView1.FindControl("lblMessage") as Label; lblResults = PXFormView1.FindControl("lblResults") as Label; txtSearch = PXFormView1.FindControl("txtSearch") as PXTextEdit; chkSearchReplace = PXFormView1.FindControl("chkSearchReplace") as PXCheckBox; txtReplace = PXFormView1.FindControl("txtReplace") as PXTextEdit; SearchCaption = PXFormView1.FindControl("SearchCaption") as PXDropDown; SearchCaptionCategory = PXFormView1.FindControl("SearchCaptionCategory") as PXDropDown; SearchCaptionProduct = PXFormView1.FindControl("SearchCaptionProduct") as PXDropDown; OrderCaption = PXFormView1.FindControl("OrderCaption") as PXDropDown; Go = PXFormView1.FindControl("btnSearch") as PXButton; mainContentTable = CreateMainTable(); pager = CreatePager(query); PXFormView1.TemplateContainer.Controls.Add(MainContentTable); SetEditBoxAttrributes(); FullText = true; if (this.searchType == SearchType.Wiki) { this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipHelpSearch); } else if (this.searchType == SearchType.Files) { this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipFileSearch); } else if (this.searchType == SearchType.Entity) { this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipEntitySearch); } else if (this.searchType == SearchType.Notes) { this.txtSearch.ToolTip = PXMessages.LocalizeNoPrefix(Messages.ttipNoteSearch); } FormatSearchCaption(); RegisterThisId(); imgMessage.ImageUrl = ResolveUrl("~/App_Themes/Default/Images/Message/information.gif"); if (query == null || string.IsNullOrEmpty(query.Trim())) { imgMessage.Visible = true; lblMessage.Visible = true; lblResults.Visible = false; lblMessage.Text = PXMessages.LocalizeNoPrefix(Messages.SpecifySearchRequest); return; } imgMessage.Visible = false; lblMessage.Visible = false; lblResults.Visible = true; }
private void AddFileControls(PXSmartPanel smartPanel = null) { if (smartPanel == null) { smartPanel = (PXSmartPanel)form.FindControl("edAttachmentsPanel"); } var graph = (OUSearchMaint)ds.DataGraph; var attachments = graph.APBillAttachments.Select() .AsEnumerable() .Select(a => (OUAPBillAttachment)a) .ToArray(); for (var i = 0; i < attachments.Length; i++) { var id = string.Format("edCheckboxFile{0}", i); var itemIdCaptured = attachments[i].ItemId; var idCaptured = attachments[i].Id; if (smartPanel.FindControl(id) != null) { continue; } var fieldName = string.Format("File{0}", i); if (!graph.Filter.Cache.Fields.Contains(fieldName)) { graph.Filter.Cache.Fields.Add(fieldName); graph.FieldSelecting.AddHandler(_primaryViewName, fieldName, (s, e) => { graph.OUAPBillAttachmentSelectFileFieldSelecting(s, e, itemIdCaptured, idCaptured); }); graph.FieldUpdating.AddHandler(_primaryViewName, fieldName, (s, e) => { graph.OUAPBillAttachmentSelectFileFieldUpdating(s, e, itemIdCaptured, idCaptured); }); } var checkboxFile = new PXCheckBox { ID = id, CommitChanges = true, DataField = fieldName, }; checkboxFile.ClientEvents.ValueChanged = "onFileSelect"; checkboxFile.ApplyStyleSheetSkin(this); smartPanel.Controls.Add(checkboxFile); var formDataProvider = form.DataProviders[_primaryViewName]; formDataProvider.DataControls[id] = checkboxFile; } }
private void AddControls(int level, IEnumerable<string> features, Dictionary<string, List<string>> subfeatures, IEnumerable<string> disabled) { foreach (string feature in features) { if (this.form.TemplateContainer.FindControl(feature) != null) continue; if (PX.Data.PXLicenseHelper.License.Licensed && !PX.Data.PXLicenseHelper.License.Features.Any(f => f.EndsWith(feature))) continue; PXCheckBox control = new PXCheckBox(); control.ID = feature; control.DataField = feature; control.Enabled = !disabled.Contains(feature); control.TextAlign = TextAlign.Right; if(level > 0) control.Style["margin-left"] = level*25 + "px"; control.CommitChanges = true; control.ApplyStyleSheetSkin(this.Page); this.form.TemplateContainer.Controls.Add(control); if (subfeatures.ContainsKey(feature)) AddControls(level +1, subfeatures[feature], subfeatures, disabled); } }
protected void Page_Init(object sender, EventArgs e) { RMReportMaint graph = (RMReportMaint)ds.DataGraph; PXDataSourceViewSchema schema = ds.GetSchema("Report"); RMReport currentReport = graph.Report.Current; RMRowSet currentRowSet = (RMRowSet)graph.Caches[typeof(RMRowSet)].Current; RMColumnSet currentColumnSet = (RMColumnSet)graph.Caches[typeof(RMColumnSet)].Current; RMUnitSet currentUnitSet = (RMUnitSet)graph.Caches[typeof(RMUnitSet)].Current; string currentTypeReport = currentReport != null ? currentReport.Type : null; RMDataSource currentDataSource = graph.DataSourceByID.Current; if (currentTypeReport == null) { graph.Report.Current = currentReport = new RMReport(); } if (currentRowSet == null) { graph.Caches[typeof(RMRowSet)].Current = new RMRowSet(); } graph.Caches[typeof(RMColumnSet)].Current = null; graph.Caches[typeof(RMUnitSet)].Current = null; Dictionary <string, List <PXFieldSchema> > controls = new Dictionary <string, List <PXFieldSchema> >(); string[] arrTypes = ((PXStringState)graph.Report.Cache.GetStateExt <RMReport.type>(null)).AllowedValues; foreach (string type in arrTypes) { graph.Report.Current.Type = type; ((RMRowSet)graph.Caches[typeof(RMRowSet)].Current).Type = type; graph.Report.Current = currentReport; graph.DataSourceByID.Current = null; List <PXFieldSchema> lControls = new List <PXFieldSchema>(); List <PXFieldSchema> list = RefreshFieldsList(schema, graph); foreach (PXFieldSchema f in list) { if (f.DataType == TypeCode.Object) { continue; } if (!ContainsControlDictionary(f, controls)) { lControls.Add(f); } } controls.Add(type, lControls); } if (currentTypeReport == null) { graph.Report.Cache.Clear(); } else { graph.Report.Current.Type = currentTypeReport; } graph.DataSourceByID.Current = currentDataSource; graph.Caches[typeof(RMRowSet)].Current = currentRowSet; graph.Caches[typeof(RMColumnSet)].Current = currentColumnSet; graph.Caches[typeof(RMUnitSet)].Current = currentUnitSet; _insertIndex = 0; foreach (Control control in this.form.TemplateContainer.Controls) { if (!string.IsNullOrEmpty(control.ID)) { if (!control.ID.Equals("edStartUnitCode", StringComparison.OrdinalIgnoreCase)) { _insertIndex++; } else { break; } } else { _insertIndex++; } } _insertIndex++; PXLayoutRule rule1 = new PXLayoutRule() { ID = "rule1", StartGroup = true, GroupCaption = "Default Data Source Settings" }; (rule1).ApplyStyleSheetSkin(this.Page); this.form.TemplateContainer.Controls.AddAt(_insertIndex, rule1); _insertIndex++; for (int c = arrTypes.Length - 1; c >= 0; c--) { string type = arrTypes[c]; List <PXFieldSchema> lDsControls = new List <PXFieldSchema>(); for (int i = 0; i < controls[type].Count; i++) { if (controls[type][i].DataField.StartsWith("DataSource", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceexpand", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceamounttype", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourcestartPeriodOffset", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceEndPeriodOffset", StringComparison.OrdinalIgnoreCase) //ContainsControl("Request" + controls[type][i].DataField.Replace("DataSource", string.Empty), controls[type]) ) { lDsControls.Add(controls[type][i]); } } int cntFirstColumn = lDsControls.Count / 2; if ((lDsControls.Count % 2) > 0) { cntFirstColumn++; } for (int i = 0; i < cntFirstColumn; i++) { AddControl(lDsControls[i], controls[type]); if ((lDsControls.Count - 1) >= (i + cntFirstColumn)) { AddControl(lDsControls[i + cntFirstColumn], controls[type]); } } } PXDropDown edDataSourceAmountType = new PXDropDown() { ID = "edDataSourceAmountType", AllowNull = false, DataField = "DataSourceAmountType" }; form.TemplateContainer.Controls.AddAt(_insertIndex, edDataSourceAmountType); (edDataSourceAmountType).ApplyStyleSheetSkin(this.Page); _insertIndex++; PXCheckBox chkApplyRestrictionGroups = new PXCheckBox() { ID = "chkApplyRestrictionGroups", DataField = "ApplyRestrictionGroups" }; form.TemplateContainer.Controls.AddAt(_insertIndex, chkApplyRestrictionGroups); (chkApplyRestrictionGroups).ApplyStyleSheetSkin(this.Page); }
/// <summary> /// Create web control for specified field. /// </summary> private WebControl CreateControlForField(PXFieldSchema f) { System.Web.UI.WebControls.WebControl ctrl = null; switch (f.ControlType) { case PXSchemaControl.NumberEdit: ctrl = new PXNumberEdit(); ((PXNumberEdit)ctrl).DataField = f.DataField; ((PXNumberEdit)ctrl).ValueType = f.DataType; ((PXNumberEdit)ctrl).AllowNull = true; break; case PXSchemaControl.TextEdit: ctrl = new PXTextEdit(); ((PXTextEdit)ctrl).DataField = f.DataField; break; case PXSchemaControl.CheckBox: ctrl = new PXCheckBox(); ((PXCheckBox)ctrl).DataField = f.DataField; break; case PXSchemaControl.ComboBox: ctrl = new PXDropDown(); ((PXDropDown)ctrl).DataField = f.DataField; ((PXDropDown)ctrl).AllowNull = false; break; case PXSchemaControl.Selector: ctrl = new PXSelector(); ((PXSelector)ctrl).DataSourceID = ds.ID; ((PXSelector)ctrl).DataField = f.DataField; PXFieldState fs = ((RMReportMaint)ds.DataGraph).Report.Cache.GetStateExt(((RMReportMaint)ds.DataGraph).Report.Current, f.DataField) as PXFieldState; if (fs != null && !String.IsNullOrWhiteSpace(fs.DescriptionName)) { ((PXSelector)ctrl).TextMode = TextModeTypes.Search; ((PXSelector)ctrl).DisplayMode = ValueDisplayMode.Text; } else if (fs.ValueField != null && fs.ValueField.ToLower() == "compositekey") { ((PXSelector)ctrl).CommitChanges = true; } break; case PXSchemaControl.SegmentMask: ctrl = new PXSegmentMask(); ((PXSegmentMask)ctrl).DataMember = f.ViewName; break; case PXSchemaControl.DateTimeEdit: ctrl = new PXDateTimeEdit(); ((PXDateTimeEdit)ctrl).DataField = f.DataField; break; } if (ctrl != null) { ctrl.ID = f.DataField; ((IFieldEditor)ctrl).DataField = f.DataField; } return(ctrl); }
protected void Page_Init(object sender, EventArgs e) { RMReportMaint graph = (RMReportMaint)ds.DataGraph; PXDataSourceViewSchema schema = ds.GetSchema("Report"); RMReport currentReport = graph.Report.Current; RMRowSet currentRowSet = (RMRowSet)graph.Caches[typeof(RMRowSet)].Current; RMColumnSet currentColumnSet = (RMColumnSet)graph.Caches[typeof(RMColumnSet)].Current; RMUnitSet currentUnitSet = (RMUnitSet)graph.Caches[typeof(RMUnitSet)].Current; string currentTypeReport = currentReport != null ? currentReport.Type : null; RMDataSource currentDataSource = graph.DataSourceByID.Current; if (currentTypeReport == null) { graph.Report.Current = currentReport = new RMReport(); } if (currentRowSet == null) { graph.Caches[typeof(RMRowSet)].Current = new RMRowSet(); } graph.Caches[typeof(RMColumnSet)].Current = null; graph.Caches[typeof(RMUnitSet)].Current = null; Dictionary<string, List<PXFieldSchema>> controls = new Dictionary<string, List<PXFieldSchema>>(); string[] arrTypes = ((PXStringState)graph.Report.Cache.GetStateExt<RMReport.type>(null)).AllowedValues; foreach (string type in arrTypes) { graph.Report.Current.Type = type; ((RMRowSet)graph.Caches[typeof(RMRowSet)].Current).Type = type; graph.Report.Current = currentReport; graph.DataSourceByID.Current = null; List<PXFieldSchema> lControls = new List<PXFieldSchema>(); List<PXFieldSchema> list = RefreshFieldsList(schema, graph); foreach (PXFieldSchema f in list) { if (f.DataType == TypeCode.Object) continue; if (!ContainsControlDictionary(f, controls)) { lControls.Add(f); } } controls.Add(type, lControls); } if (currentTypeReport == null) { graph.Report.Cache.Clear(); } else { graph.Report.Current.Type = currentTypeReport; } graph.DataSourceByID.Current = currentDataSource; graph.Caches[typeof(RMRowSet)].Current = currentRowSet; graph.Caches[typeof(RMColumnSet)].Current = currentColumnSet; graph.Caches[typeof(RMUnitSet)].Current = currentUnitSet; _insertIndex = 0; foreach (Control control in this.form.TemplateContainer.Controls) { if (!string.IsNullOrEmpty(control.ID)) { if (!control.ID.Equals("edStartUnitCode", StringComparison.OrdinalIgnoreCase)) _insertIndex++; else break; } else _insertIndex++; } _insertIndex++; PXLayoutRule rule1 = new PXLayoutRule() { ID = "rule1", StartGroup = true, GroupCaption = "Default Data Source Settings" }; (rule1).ApplyStyleSheetSkin(this.Page); this.form.TemplateContainer.Controls.AddAt(_insertIndex, rule1); _insertIndex++; for (int c = arrTypes.Length - 1; c >= 0; c--) { string type = arrTypes[c]; List<PXFieldSchema> lDsControls = new List<PXFieldSchema>(); for (int i = 0; i < controls[type].Count; i++) { if (controls[type][i].DataField.StartsWith("DataSource", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceexpand", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceamounttype", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourcestartPeriodOffset", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceEndPeriodOffset", StringComparison.OrdinalIgnoreCase) //ContainsControl("Request" + controls[type][i].DataField.Replace("DataSource", string.Empty), controls[type]) ) { lDsControls.Add(controls[type][i]); } } int cntFirstColumn = lDsControls.Count / 2; if ((lDsControls.Count % 2) > 0) cntFirstColumn++; for (int i = 0; i < cntFirstColumn; i++) { AddControl(lDsControls[i], controls[type]); if ((lDsControls.Count - 1) >= (i + cntFirstColumn)) AddControl(lDsControls[i + cntFirstColumn], controls[type]); } } PXDropDown edDataSourceAmountType = new PXDropDown() { ID = "edDataSourceAmountType", AllowNull = false, DataField = "DataSourceAmountType" }; form.TemplateContainer.Controls.AddAt(_insertIndex, edDataSourceAmountType); (edDataSourceAmountType).ApplyStyleSheetSkin(this.Page); _insertIndex++; PXCheckBox chkApplyRestrictionGroups = new PXCheckBox() { ID = "chkApplyRestrictionGroups", DataField = "ApplyRestrictionGroups" }; form.TemplateContainer.Controls.AddAt(_insertIndex, chkApplyRestrictionGroups); (chkApplyRestrictionGroups).ApplyStyleSheetSkin(this.Page); }
/// <summary> /// Create web control for specified field. /// </summary> private WebControl CreateControlForField(PXFieldSchema f) { System.Web.UI.WebControls.WebControl ctrl = null; switch (f.ControlType) { case PXSchemaControl.NumberEdit: ctrl = new PXNumberEdit(); ((PXNumberEdit)ctrl).DataField = f.DataField; ((PXNumberEdit)ctrl).ValueType = f.DataType; ((PXNumberEdit)ctrl).AllowNull = true; break; case PXSchemaControl.TextEdit: ctrl = new PXTextEdit(); ((PXTextEdit)ctrl).DataField = f.DataField; break; case PXSchemaControl.CheckBox: ctrl = new PXCheckBox(); ((PXCheckBox)ctrl).DataField = f.DataField; break; case PXSchemaControl.ComboBox: ctrl = new PXDropDown(); ((PXDropDown)ctrl).DataField = f.DataField; ((PXDropDown)ctrl).AllowNull = false; break; case PXSchemaControl.Selector: ctrl = new PXSelector(); ((PXSelector)ctrl).DataSourceID = ds.ID; ((PXSelector)ctrl).DataField = f.DataField; PXFieldState fs = ((RMReportMaint)ds.DataGraph).Report.Cache.GetStateExt(((RMReportMaint)ds.DataGraph).Report.Current, f.DataField) as PXFieldState; if (fs != null && !String.IsNullOrWhiteSpace(fs.DescriptionName)) { ((PXSelector)ctrl).TextMode = TextModeTypes.Search; ((PXSelector)ctrl).DisplayMode = ValueDisplayMode.Text; } else if (fs.ValueField != null && fs.ValueField.ToLower() == "compositekey") { ((PXSelector)ctrl).CommitChanges = true; } break; case PXSchemaControl.SegmentMask: ctrl = new PXSegmentMask(); ((PXSegmentMask)ctrl).DataMember = f.ViewName; break; case PXSchemaControl.DateTimeEdit: ctrl = new PXDateTimeEdit(); ((PXDateTimeEdit)ctrl).DataField = f.DataField; break; } if (ctrl != null) { ctrl.ID = f.DataField; ((IFieldEditor)ctrl).DataField = f.DataField; } return ctrl; }