本文整理汇总了C#中FormInfo.GetDataRow方法的典型用法代码示例。如果您正苦于以下问题:C# FormInfo.GetDataRow方法的具体用法?C# FormInfo.GetDataRow怎么用?C# FormInfo.GetDataRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormInfo
的用法示例。
在下文中一共展示了FormInfo.GetDataRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPreInit
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
SetCulture();
IFormatProvider culture = DateTimeHelper.DefaultIFormatProvider;
IFormatProvider currentCulture = new System.Globalization.CultureInfo(System.Threading.Thread.CurrentThread.CurrentUICulture.IetfLanguageTag);
reportId = ValidationHelper.GetInteger(Request.QueryString["reportid"], 0);
ReportInfo ri = ReportInfoProvider.GetReportInfo(reportId);
if (ri != null)
{
string[] httpParameters = ValidationHelper.GetString(Request.QueryString["parameters"], "").Split(";".ToCharArray());
FormInfo fi = new FormInfo(ri.ReportParameters);
// Get datarow with required columns
DataRow dr = fi.GetDataRow();
if (httpParameters.Length > 1)
{
string[] parameters = new string[httpParameters.Length / 2];
// Put values to given data row
for (int i = 0; i < httpParameters.Length; i = i + 2)
{
if (dr.Table.Columns.Contains(httpParameters[i]))
{
if (dr.Table.Columns[httpParameters[i]].DataType != typeof(DateTime))
{
dr[httpParameters[i]] = httpParameters[i + 1];
}
else
{
if (httpParameters[i + 1] != String.Empty)
{
dr[httpParameters[i]] = Convert.ToDateTime(httpParameters[i + 1], culture).ToString(currentCulture);
}
}
}
}
dr.AcceptChanges();
DisplayReport1.LoadFormParameters = false;
DisplayReport1.ReportName = ri.ReportName;
DisplayReport1.DisplayFilter = false;
DisplayReport1.ReportParameters = dr;
}
else
{
DisplayReport1.ReportName = ri.ReportName;
DisplayReport1.DisplayFilter = false;
}
this.Page.Title = GetString("Report_Print.lblPrintReport") + " " + ri.ReportDisplayName;
}
}
示例2: btnOK_Click
protected void btnOK_Click(object sender, EventArgs e)
{
// If data are valid
if (bfParameters.ValidateData())
{
// Fill BasicForm with user data
bfParameters.SaveData(null);
if (bfParameters.DataRow != null)
{
int reportID = QueryHelper.GetInteger("ReportID", 0);
ReportInfo ri = ReportInfoProvider.GetReportInfo(reportID);
if (ri == null)
{
return;
}
FormInfo fi = new FormInfo(ri.ReportParameters);
DataRow defaultRow = fi.GetDataRow();
fi.LoadDefaultValues(defaultRow);
// Load default parameters to items ,where displayed in edit form not checked
List<FormItem> items = fi.ItemsList;
foreach (FormItem item in items)
{
FormFieldInfo ffi = item as FormFieldInfo;
if ((ffi != null) && (!ffi.Visible))
{
bfParameters.DataRow[ffi.Name] = defaultRow[ffi.Name];
}
}
WindowHelper.Add(hdnGuid.Value, bfParameters.DataRow.Table.DataSet);
}
// Refreshh opener update panel script
ltlScript.Text = ScriptHelper.GetScript("wopener.refresh (); window.close ()");
}
}
示例3: ReloadData
/// <summary>
/// Reload data.
/// </summary>
public override void ReloadData(bool forceLoad)
{
if ((GraphImageWidth != 0) && (ComputedWidth == 0))
{
// Graph width is computed no need to create graph
return;
}
Visible = true;
errorOccurred = false;
try
{
ReportTableName = Parameter;
EnsureTableInfo();
EnsureChildControls();
//Test security
if (TableInfo != null)
{
ri = ReportInfoProvider.GetReportInfo(TableInfo.TableReportID);
if (ri != null)
{
if (ri.ReportAccess != ReportAccessEnum.All)
{
if (!CMSContext.CurrentUser.IsAuthenticated())
{
Visible = false;
return;
}
}
EnableSubscription = EnableSubscription && (ValidationHelper.GetBoolean(TableInfo.TableSettings["SubscriptionEnabled"], true) && ri.ReportEnableSubscription);
if (EmailMode && !EnableSubscription)
{
this.Visible = false;
return;
}
//Set default parametrs directly if not set
if (ReportParameters == null)
{
FormInfo fi = new FormInfo(ri.ReportParameters);
// Get datarow with required columns
ReportParameters = fi.GetDataRow(false);
fi.LoadDefaultValues(ReportParameters, true);
}
ApplyTimeParameters();
}
}
// Only use base parameters in case of stored procedure
if (QueryIsStoredProcedure)
{
AllParameters = SpecialFunctions.ConvertDataRowToParams(ReportParameters, null);
}
// Load data
DataSet ds = LoadData();
// If no data load, set empty dataset
if (DataHelper.DataSourceIsEmpty(ds))
{
if (EmailMode && SendOnlyNonEmptyDataSource)
{
Visible = false;
return;
}
string noRecordText = ValidationHelper.GetString(TableInfo.TableSettings["QueryNoRecordText"], String.Empty);
if (noRecordText != String.Empty)
{
GridViewObject.Visible = false;
lblInfo.Text = CMSContext.ResolveMacros(noRecordText);
plcInfo.Visible = true;
EnableExport = false;
return;
}
if (!EmailMode)
{
Visible = false;
}
}
else
{
GridViewObject.Visible = true;
// Resolve macros in column names
int i = 0;
foreach (DataColumn dc in ds.Tables[0].Columns)
{
if (dc.ColumnName == "Column" + ((int)(i + 1)).ToString())
{
dc.ColumnName = ResolveMacros(ds.Tables[0].Rows[0][i].ToString());
//.........这里部分代码省略.........
示例4: LoadFormDefinition
/// <summary>
/// Loads the from definition from selected parameter into a BasicForm control.
/// </summary>
/// <param name="actual">If true, data from actual hiddens are loaded</param>
private void LoadFormDefinition(bool actual)
{
MacroRuleTree selected = GetSelected((actual ? hdnParamSelected.Value : hdnLastSelected.Value));
if (selected != null)
{
string paramName = (actual ? hdnParam.Value.ToLowerCSafe() : hdnLastParam.Value.ToLowerCSafe());
MacroRuleParameter param = selected.Parameters[paramName];
if (param != null)
{
FormInfo fi = new FormInfo(selected.RuleParameters);
FormFieldInfo ffi = fi.GetFormField(paramName);
if (ffi != null)
{
fi = new FormInfo();
fi.AddFormItem(ffi);
// Add fake DisplayName field
FormFieldInfo displayName = new FormFieldInfo();
displayName.Visible = false;
displayName.Name = "DisplayName";
displayName.DataType = FieldDataType.Text;
fi.AddFormItem(displayName);
DataRow row = fi.GetDataRow().Table.NewRow();
if (ffi.AllowEmpty && String.IsNullOrEmpty(param.Value))
{
if (!DataTypeManager.IsString(TypeEnum.Field, ffi.DataType))
{
row[paramName] = DBNull.Value;
}
}
else
{
// Convert to a proper type
var val = DataTypeManager.ConvertToSystemType(TypeEnum.Field, ffi.DataType, param.Value, CultureHelper.EnglishCulture);
if (val != null)
{
row[paramName] = val;
}
}
formElem.DataRow = row;
formElem.FormInformation = fi;
formElem.ReloadData();
}
}
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
usReports.OnSelectionChanged += usReports_OnSelectionChanged;
string [,]specialFields = new string [1,2];
pnlReports.Attributes.Add("style", "margin-bottom:3px");
string reportName = ValidationHelper.GetString(usReports.Value, String.Empty);
ReportInfo ri = ReportInfoProvider.GetReportInfo(reportName);
if (ri != null)
{
usItems.Enabled = true;
//test if there is any item visible in report parameters
FormInfo fi = new FormInfo(ri.ReportParameters);
//Get dataset from cache
DataSet ds = (DataSet)WindowHelper.GetItem(hdnGuid.Value);
DataRow dr = fi.GetDataRow();
fi.LoadDefaultValues(dr);
bool itemVisible = false;
List<FormItem> items = fi.ItemsList;
foreach (FormItem item in items)
{
FormFieldInfo ffi = item as FormFieldInfo;
if (ffi != null)
{
if (ffi.Visible)
{
itemVisible = true;
break;
}
}
}
ReportID = ri.ReportID;
if (!itemVisible)
{
plcParametersButtons.Visible = false;
}
else
{
plcParametersButtons.Visible = true;
}
}
else
{
plcParametersButtons.Visible = false;
usItems.Enabled = false;
}
ltlScript.Text = ScriptHelper.GetScript("function refresh () {" + ControlsHelper.GetPostBackEventReference(pnlUpdate, String.Empty) + "}");
usReports.DropDownSingleSelect.AutoPostBack = true;
if (!mDisplay)
{
pnlReports.Visible = false;
plcParametersButtons.Visible = false;
usItems.Enabled = true;
}
if (!ShowItemSelector)
{
pnlItems.Visible = false;
}
usItems.IsLiveSite = IsLiveSite;
usReports.IsLiveSite = IsLiveSite;
ugParameters.GridName = "~/CMSModules/Reporting/FormControls/ReportParametersList.xml";
ugParameters.ZeroRowsText = String.Empty;
ugParameters.PageSize = "##ALL##";
ugParameters.Pager.DefaultPageSize = -1;
BuildConditions();
// First item as "please select string" - not default "none"
usItems.AllowEmpty = false;
usReports.AllowEmpty = false;
specialFields[0, 0] = "(" + GetString("rep.pleaseselect") + ")";
specialFields[0, 1] = "0";
usReports.SpecialFields = specialFields;
if (ri == null)
{
string[,] itemSpecialFields = new string[1, 2];
itemSpecialFields[0, 0] = "(" + firstItemText + ")";
itemSpecialFields[0, 1] = "0";
usItems.SpecialFields = itemSpecialFields;
}
if (ShowItemSelector)
{
ReloadItems();
}
}
示例6: ReloadData
/// <summary>
/// Reload data.
/// </summary>
public override void ReloadData(bool forceLoad)
{
try
{
// Load value info object
ReportValueInfo rvi = ValueInfo;
if (rvi != null)
{
//Test security
ReportInfo ri = ReportInfoProvider.GetReportInfo(rvi.ValueReportID);
if (ri.ReportAccess != ReportAccessEnum.All)
{
if (!CMSContext.CurrentUser.IsAuthenticated())
{
this.Visible = false;
return;
}
}
ContextResolver resolver = CMSContext.CurrentResolver;
// Resolve dynamic data macros
if (DynamicMacros != null)
{
for (int i = 0; i <= this.DynamicMacros.GetUpperBound(0); i++)
{
resolver.AddDynamicParameter(DynamicMacros[i, 0], DynamicMacros[i, 1]);
}
}
this.QueryIsStoredProcedure = rvi.ValueQueryIsStoredProcedure;
this.QueryText = resolver.ResolveMacros(rvi.ValueQuery);
//Set default parametrs directly if not set
if (this.ReportParameters == null)
{
if (ri != null)
{
FormInfo fi = new FormInfo(ri.ReportParameters);
// Get datarow with required columns
this.ReportParameters = fi.GetDataRow();
fi.LoadDefaultValues(this.ReportParameters);
}
}
}
// Only use base parameters in case of stored procedure
if (this.QueryIsStoredProcedure)
{
this.AllParameters = SpecialFunctions.ConvertDataRowToParams(this.ReportParameters, null);
}
// Load data
DataSet ds = this.LoadData();
// If datasource is emptry, create empty dataset
if (!DataHelper.DataSourceIsEmpty(ds))
{
// Set literal text
string value = rvi.ValueFormatString;
if ((value == null) || (value == ""))
{
value = ValidationHelper.GetString(ds.Tables[0].Rows[0][0], "");
}
else
{
value = string.Format(value, ds.Tables[0].Rows[0].ItemArray);
}
lblValue.Text = HTMLHelper.HTMLEncode(ResolveMacros(value));
}
}
catch (Exception ex)
{
// Display error message, if data load fail
lblError.Visible = true;
lblError.Text = "[ReportValue.ascx] Error loading the data: " + ex.Message;
EventLogProvider ev = new EventLogProvider();
ev.LogEvent("Report value", "E", ex);
}
}
示例7: ShowPreview
/// <summary>
/// Show preview.
/// </summary>
private void ShowPreview()
{
if (mReportInfo != null)
{
pnlPreview.Visible = true;
divPanelHolder.Visible = false;
pnlVersions.Visible = false;
FormInfo fi = new FormInfo(mReportInfo.ReportParameters);
DataRow defaultValues = fi.GetDataRow(false);
fi.LoadDefaultValues(defaultValues, true);
//reportGraph.ContextParameters
ctrlReportValue.ReportParameters = defaultValues;
ctrlReportValue.Visible = true;
ctrlReportValue.ValueInfo = mReportValueInfo;
ctrlReportValue.ReloadData(true);
}
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:25,代码来源:ReportValue_Edit.aspx.cs
示例8: GetReportGraph
/// <summary>
/// Returns report graph.
/// </summary>
private void GetReportGraph(ReportGraphInfo reportGraph)
{
Visible = true;
ucChart.Visible = true;
int correctWidth = 0;
if (ComputedWidth != 0)
{
correctWidth = ModifyGraphInfo();
}
if (Width != String.Empty)
{
int graphWidth = ValidationHelper.GetInteger(Width, 0);
if (graphWidth != 0)
{
reportGraph.GraphWidth = graphWidth;
}
}
if (Height != 0)
{
reportGraph.GraphHeight = Height;
}
ReportGraph graph = new ReportGraph();
graph.ChartControl = ucChart;
ReportInfo report = ReportInfoProvider.GetReportInfo(reportGraph.GraphReportID);
if (report == null)
{
return;
}
// Check graph security settings
if (report.ReportAccess != ReportAccessEnum.All)
{
if (!CMSContext.CurrentUser.IsAuthenticated())
{
Visible = false;
return;
}
}
// Set default parametrs directly if not set
if (ReportParameters == null)
{
// Load ReportInfo
if (report != null)
{
FormInfo fi = new FormInfo(report.ReportParameters);
// Get datarow with required columns
ReportParameters = fi.GetDataRow();
fi.LoadDefaultValues(ReportParameters);
}
}
// If used via widget - this function ensure showing specific interval from actual time (f.e. last 6 weeks)
ApplyTimeParameters();
// Only use base parameters in case of stored procedure
if (QueryIsStoredProcedure)
{
AllParameters = SpecialFunctions.ConvertDataRowToParams(ReportParameters, null);
}
ContextResolver resolver = CMSContext.CurrentResolver.CreateContextChild();
// Indicaates whether exception was throw during data loading
bool errorOccurred = false;
// Create graph image
try
{
// Resolve parameters in query
resolver.SourceParameters = AllParameters.ToArray();
// Resolve dynamic data macros
if (DynamicMacros != null)
{
for (int i = 0; i <= DynamicMacros.GetUpperBound(0); i++)
{
resolver.AddDynamicParameter(DynamicMacros[i, 0], DynamicMacros[i, 1]);
}
}
// Prepare query attributes
QueryText = resolver.ResolveMacros(reportGraph.GraphQuery);
QueryIsStoredProcedure = reportGraph.GraphQueryIsStoredProcedure;
// LoadData
DataSet dsGraphData = LoadData();
// Test if dataset is empty
if (DataHelper.DataSourceIsEmpty(dsGraphData))
{
string noRecordText = ValidationHelper.GetString(reportGraph.GraphSettings["QueryNoRecordText"], String.Empty);
//.........这里部分代码省略.........
示例9: CombineWithDefaultValues
/// <summary>
/// Combines widget info with default XML system propertiers.
/// </summary>
/// <param name="fi">Widget form info</param>
/// <param name="wi">Widget info object</param>
public DataRow CombineWithDefaultValues(FormInfo fi, WidgetInfo wi)
{
if ((!String.IsNullOrEmpty(wi.WidgetDefaultValues)) && (String.Compare(wi.WidgetDefaultValues, "<form></form>", false) != 0))
{
// Apply changed values
DataRow dr = fi.GetDataRow();
fi.LoadDefaultValues(dr, wi.WidgetDefaultValues);
return dr;
}
return fi.GetDataRow();
}
示例10: OnPreRender
protected override void OnPreRender(EventArgs e)
{
pnlReports.Attributes.Add("style", "margin-bottom:3px");
string reportName = ValidationHelper.GetString(usReports.Value, String.Empty);
ri = ReportInfoProvider.GetReportInfo(reportName);
if (ri != null)
{
usItems.Enabled = true;
// Test if there is any item visible in report parameters
FormInfo fi = new FormInfo(ri.ReportParameters);
// Get dataset from cache
DataSet ds = (DataSet)WindowHelper.GetItem(CurrentGuid());
DataRow dr = fi.GetDataRow();
fi.LoadDefaultValues(dr);
bool itemVisible = false;
List<IFormItem> items = fi.ItemsList;
foreach (IFormItem item in items)
{
FormFieldInfo ffi = item as FormFieldInfo;
if (ffi != null)
{
if (ffi.Visible)
{
itemVisible = true;
break;
}
}
}
ReportID = ri.ReportID;
if (!itemVisible)
{
plcParametersButtons.Visible = false;
}
else
{
plcParametersButtons.Visible = true;
}
}
else
{
if (ReportID == 0)
{
plcParametersButtons.Visible = false;
usItems.Enabled = false;
}
}
ltlScript.Text = ScriptHelper.GetScript("function refresh () {" + ControlsHelper.GetPostBackEventReference(pnlUpdate, String.Empty) + "}");
usReports.DropDownSingleSelect.AutoPostBack = true;
if (!mDisplay)
{
pnlReports.Visible = false;
plcParametersButtons.Visible = false;
usItems.Enabled = true;
}
if (!ShowItemSelector)
{
pnlItems.Visible = false;
}
usItems.IsLiveSite = IsLiveSite;
usReports.IsLiveSite = IsLiveSite;
ugParameters.GridName = "~/CMSModules/Reporting/FormControls/ReportParametersList.xml";
ugParameters.ZeroRowsText = String.Empty;
ugParameters.PageSize = "##ALL##";
ugParameters.Pager.DefaultPageSize = -1;
BuildConditions();
if (ri == null)
{
string[,] itemSpecialFields = new string[1, 2];
itemSpecialFields[0, 0] = "(" + firstItemText + ")";
itemSpecialFields[0, 1] = "0";
usItems.SpecialFields = itemSpecialFields;
}
if (ShowItemSelector)
{
ReloadItems();
}
if (setValues)
{
WindowHelper.Add(CurrentGuid(), CurrentDataSet);
ScriptHelper.RegisterStartupScript(Page, typeof(Page), "OpenModalWindowReportItem", ScriptHelper.GetScript("modalDialog('" + ResolveUrl("~/CMSModules/Reporting/Dialogs/ReportParametersSelector.aspx?ReportID=" + ReportID + "&guid=" + CurrentGuid().ToString()) + "','ReportParametersDialog', 700, 500);"));
keepDataInWindowsHelper = true;
}
// Apply reportid condition if report was selected via uniselector
if (ri != null)
{
FormInfo fi = new FormInfo(ri.ReportParameters);
//.........这里部分代码省略.........
示例11: ShowPreview
/// <summary>
/// Show preview
/// </summary>
private void ShowPreview()
{
divPanelHolder.Visible = false;
pnlVersions.Visible = false;
if (mReportInfo != null)
{
pnlPreview.Visible = true;
FormInfo fi = new FormInfo(mReportInfo.ReportParameters);
// Get datarow with required columns
DataRow defaultValues = fi.GetDataRow(false);
fi.LoadDefaultValues(defaultValues, true);
// ReportGraph.ContextParameters
ctrlReportTable.ReportParameters = defaultValues;
// Prepare fully qualified graph name = with reportname
if (mReportTableInfo != null)
{
string fullReportGraphName = mReportInfo.ReportName + "." + mReportTableInfo.TableName;
ctrlReportTable.Parameter = fullReportGraphName;
}
ctrlReportTable.TableInfo = mReportTableInfo;
ctrlReportTable.ReloadData(true);
}
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:32,代码来源:ReportTable_Edit.aspx.cs
示例12: Page_Load
//.........这里部分代码省略.........
}
// If preview by URL -> select preview tab
bool isPreview = QueryHelper.GetBoolean("preview", false);
if (isPreview && !RequestHelper.IsPostBack())
{
tabControlElem.SelectedTab = 1;
}
if (PersistentEditedObject == null)
{
if (mReportInfo != null) // Must be valid reportid parameter
{
int id = QueryHelper.GetInteger("objectid", 0);
// Try to load tableName from hidden field (adding new graph & preview)
if (id == 0)
{
id = ValidationHelper.GetInteger(txtNewTableHidden.Value, 0);
}
if (id > 0)
{
PersistentEditedObject = ReportTableInfoProvider.GetReportTableInfo(id);
mReportTableInfo = PersistentEditedObject as ReportTableInfo;
}
}
}
else
{
mReportTableInfo = PersistentEditedObject as ReportTableInfo;
}
if (mReportInfo != null)
{
ucSelectString.DefaultConnectionString = mReportInfo.ReportConnectionString;
// Control text initializations
if (mReportTableInfo != null)
{
PageTitle.TitleText = GetString("Reporting_ReportTable_Edit.TitleText");
mTableId = mReportTableInfo.TableID;
if (ObjectVersionManager.DisplayVersionsTab(mReportTableInfo))
{
tabControlElem.TabItems.Add(new UITabItem
{
Text = GetString("objectversioning.tabtitle")
});
versionList.Object = mReportTableInfo;
versionList.IsLiveSite = false;
}
}
else // New item
{
PageTitle.TitleText = GetString("Reporting_ReportTable_Edit.NewItemTitleText");
if (!RequestHelper.IsPostBack())
{
ucSelectString.Value = String.Empty;
txtPageSize.Text = "15";
txtQueryNoRecordText.Text = GetString("attachmentswebpart.nodatafound");
chkExportEnable.Checked = true;
chkSubscription.Checked = true;
}
}
if (!RequestHelper.IsPostBack())
{
ControlsHelper.FillListControlWithEnum<PagerButtons>(drpPageMode, "PagerButtons");
// Preselect page numbers paging
drpPageMode.SelectedValue = ((int)PagerButtons.Numeric).ToString();
LoadData();
}
}
if ((preview) && (!RequestHelper.IsPostBack()))
{
tabControlElem.SelectedTab = 1;
ShowPreview();
}
// In case of preview paging without saving table
if (RequestHelper.IsPostBack() && tabControlElem.SelectedTab == 1)
{
// Reload default parameters
FormInfo fi = new FormInfo(mReportInfo.ReportParameters);
// Get datarow with required columns
ctrlReportTable.ReportParameters = fi.GetDataRow(false);
fi.LoadDefaultValues(ctrlReportTable.ReportParameters, true);
// Collect data and put them in table info
SetData();
ctrlReportTable.TableInfo = mReportTableInfo;
}
CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:101,代码来源:ReportTable_Edit.aspx.cs
示例13: OnInit
/// <summary>
/// OnInit.
/// </summary>
protected override void OnInit(EventArgs e)
{
ScriptHelper.RegisterWOpenerScript(Page);
PageTitle.TitleText = ResHelper.GetString("rep.webparts.reportparameterstitle");
// Load data for this form
int reportID = QueryHelper.GetInteger("ReportID", 0);
hdnGuid.Value = QueryHelper.GetString("GUID", String.Empty);
ReportInfo ri = ReportInfoProvider.GetReportInfo(reportID);
if (ri == null)
{
return;
}
FormInfo fi = new FormInfo(ri.ReportParameters);
bfParameters.FormInformation = fi;
bfParameters.SubmitButton.Visible = false;
bfParameters.Mode = FormModeEnum.Update;
// Get dataset from cache
DataSet ds = (DataSet)WindowHelper.GetItem(hdnGuid.Value);
DataRow dr = fi.GetDataRow(false);
fi.LoadDefaultValues(dr, true);
if (ds == null)
{
if (dr.ItemArray.Length > 0)
{
// Set up grid
bfParameters.DataRow = RequestHelper.IsPostBack() ? fi.GetDataRow(false) : dr;
}
}
// Set data set given from cache
if ((ds != null) && (ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0))
{
//Merge with default data from report
MergeDefaultValuesWithData(dr, ds.Tables[0].Rows[0]);
//Set row to basic form
bfParameters.DataRow = dr;
}
// Test if there is any item visible in report parameters
bool itemVisible = false;
List<IDataDefinitionItem> items = fi.ItemsList;
foreach (IDataDefinitionItem item in items)
{
FormFieldInfo ffi = item as FormFieldInfo;
if (ffi != null && ffi.Visible)
{
itemVisible = true;
break;
}
}
if (!itemVisible)
{
ShowInformation(GetString("rep.parameters.noparameters"));
}
base.OnInit(e);
}
示例14: LoadParameters
/// <summary>
/// Load parameters from data form.
/// </summary>
private void LoadParameters()
{
if (ReportInfo != null)
{
// Set the form
FormInfo fi = new FormInfo(ReportInfo.ReportParameters);
// Get datarow with required columns
DataRow dr = fi.GetDataRow(false);
if (!RequestHelper.IsPostBack() || ForceLoadDefaultValues || !DisplayFilter)
{
fi.LoadDefaultValues(dr, true);
}
else if ((!ForceLoadDefaultValues) && (formParameters.DataRow != null))
{
dr = formParameters.DataRow;
}
// Show filter - based on DisplayFilter and number of visible elements
mDisplayFilterResult = DisplayFilter && (fi.GetFormElements(true, false).Any());
formParameters.DataRow = dr;
formParameters.SubmitButton.Visible = mDisplayFilterResult;
formParameters.SubmitButton.RegisterHeaderAction = false;
formParameters.FormInformation = fi;
formParameters.SubmitButton.ResourceString = "report_view.btnupdate";
formParameters.SiteName = SiteContext.CurrentSiteName;
formParameters.Mode = FormModeEnum.Insert;
formParameters.Visible = mDisplayFilterResult;
wasInit = true;
}
}
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:35,代码来源:DisplayReport.ascx.cs
示例15: LoadForm
/// <summary>
/// Loads basicform with filter controls.
/// </summary>
/// <param name="bf">BasicForm control</param>
/// <param name="fi">Form definition</param>
/// <param name="activityType">Activity type in case the rule type is activity</param>
private void LoadForm(BasicForm bf, FormInfo fi, string activityType = null)
{
bf.FormInformation = fi;
bf.Data = RuleHelper.GetDataFromCondition(Rule, fi.GetDataRow().Table, ref activityType);
bf.SubmitButton.Visible = false;
bf.SiteName = SiteContext.CurrentSiteName;
if (Rule != null)
{
bf.Mode = FormModeEnum.Update;
}
bf.ReloadData();
}