本文整理汇总了C#中QueryDataParameters.Add方法的典型用法代码示例。如果您正苦于以下问题:C# QueryDataParameters.Add方法的具体用法?C# QueryDataParameters.Add怎么用?C# QueryDataParameters.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryDataParameters
的用法示例。
在下文中一共展示了QueryDataParameters.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetScore
/// <summary>
/// Returns contact's points in specified score on current site.
/// </summary>
/// <param name="contact">Contact info object</param>
/// <param name="scoreName">Score name</param>
public static int GetScore(object contact, object scoreName)
{
ContactInfo ci = (ContactInfo)contact;
string score = ValidationHelper.GetString(scoreName, string.Empty);
int siteId = CMSContext.CurrentSiteID;
if ((ci != null) && (siteId > 0) && (!string.IsNullOrEmpty(score)))
{
// Prepare DB query
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@ContactID", ci.ContactID);
parameters.Add("@ScoreName", score);
parameters.Add("@SiteID", siteId);
string where = "(Expiration IS NULL OR Expiration > GetDate()) AND ([email protected]) AND ([email protected]) AND ([email protected])";
// Get sum of points of the contact in specified score
DataSet ds = SqlHelperClass.ExecuteQuery("om.score.selectdatajoined", parameters, "SUM(Value) AS Score", where, null, -1);
if (!DataHelper.DataSourceIsEmpty(ds))
{
return ValidationHelper.GetInteger(ds.Tables[0].Rows[0][0], 0);
}
}
return 0;
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
this.CurrentMaster.Title.TitleText = GetString("newsletter_issue_openedby.title");
this.CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Newsletter/module.png");
issueId = QueryHelper.GetInteger("issueid", 0);
if (issueId == 0)
{
RequestHelper.EndResponse();
}
// Filter by Issue ID (from querystring)
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@IssueID", issueId);
UniGrid.QueryParameters = parameters;
// Filter by Site ID to prevent accessing issues from sites other than current site
string whereCondition = SqlHelperClass.GetWhereCondition("SiteID", CMSContext.CurrentSiteID);
UniGrid.WhereCondition = SqlHelperClass.AddWhereCondition(whereCondition, fltOpenedBy.WhereCondition);
UniGrid.Pager.DefaultPageSize = 15;
UniGrid.Pager.ShowPageSize = false;
UniGrid.FilterLimit = 1;
UniGrid.OnExternalDataBound += UniGrid_OnExternalDataBound;
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Get culture ID from query string
uiCultureID = QueryHelper.GetInteger("UIcultureID", 0);
// Get requested culture
ui = UICultureInfoProvider.GetSafeUICulture(uiCultureID);
UICultureInfo dui = null;
// Check if edited UI culture is the default UI culture
if ((ui != null) && CMSString.Equals(ui.UICultureCode, CultureHelper.DefaultUICulture, true))
{
dui = ui;
// Use different grid definition
gridStrings.GridName = "List_defaultculture.xml";
}
else
{
// Ty to get default UI culture
try
{
dui = UICultureInfoProvider.GetUICultureInfo(CultureHelper.DefaultUICulture);
}
catch
{
}
}
if (dui != null)
{
EditedObject = ui;
// Prepare query params for the grid
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@Culture", ui.UICultureID);
parameters.AddId("@DefaultUICultureID", dui.UICultureID);
// Setup the grid
gridStrings.QueryParameters = parameters;
gridStrings.OnAction += UniGridUICultures_OnAction;
gridStrings.OnExternalDataBound += UniGridStrings_OnExternalDataBound;
InitializeMasterPage();
}
else
{
// Default UI culture does not exist - hide the grid and display error message
gridStrings.StopProcessing = true;
ShowError(String.Format(GetString("uiculture.defaultnotexist"), CultureHelper.DefaultUICulture));
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
gridStrings.OnAction += UniGridCultures_OnAction;
CurrentMaster.DisplaySiteSelectorPanel = true;
cultureSelector.OnSelectionChanged += cultureSelector_OnSelectionChanged;
cultureSelector.DropDownSingleSelect.AutoPostBack = true;
cultureSelector.OnListItemCreated += cultureSelector_OnListItemCreated;
mCultureCode = QueryHelper.GetString("culturecode", CultureHelper.DefaultUICultureCode);
mCultureInfo = CultureInfoProvider.GetCultureInfo(mCultureCode);
if (mCultureInfo != null && mDefaultUICultureInfo != null)
{
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@Culture", mCultureInfo.CultureID);
parameters.AddId("@DefaultCultureID", mDefaultUICultureInfo.CultureID);
gridStrings.QueryParameters = parameters;
string defaultTextCaption = String.Format(GetString("culture.defaultwithparameter"), CultureHelper.DefaultUICultureCode);
gridStrings.GridColumns.Columns.Find(column => column.Source == "DefaultText").Caption = defaultTextCaption;
if (CurrentCultureIsDefault)
{
// Set default translation column to full width
gridStrings.GridColumns.Columns[2].Width = "100%";
// Remove 'CultureText' column if current culture is default
gridStrings.GridColumns.Columns.RemoveAt(1);
}
else
{
if (!LocalizationHelper.ResourceFileExistsForCulture(mCultureInfo.CultureCode))
{
string url = "http://devnet.kentico.com/download/localization-packs";
string downloadPage = String.Format(@"<a href=""{0}"" target=""_blank"" >{1}</a> ", url, HTMLHelper.HTMLEncode(url));
ShowInformation(String.Format(GetString("culture.downloadlocalization"), downloadPage));
}
}
InitializeMasterPage();
}
else
{
gridStrings.StopProcessing = true;
ShowError(String.Format(GetString("culture.doesntexist"), HTMLHelper.HTMLEncode(mCultureCode)));
}
}
示例5: GetWhereCondition
/// <summary>
/// Returns where condition.
/// </summary>
private string GetWhereCondition()
{
String where = String.Empty;
if (!dtpFrom.IsValidRange() || !dtpTo.IsValidRange())
{
lblError.Text = GetString("general.errorinvaliddatetimerange");
lblError.Visible = true;
return String.Empty;
}
where = SqlHelperClass.AddWhereCondition(where, tsfFrom.GetCondition());
where = SqlHelperClass.AddWhereCondition(where, tsfSource.GetCondition());
// Create date time condition
mParameters = new QueryDataParameters();
DateTime from = dtpFrom.SelectedDateTime;
DateTime to = dtpTo.SelectedDateTime;
if (from != DateTimeHelper.ZERO_TIME)
{
where = SqlHelperClass.AddWhereCondition(where, "MVTestOpenFrom > @from");
mParameters.Add("@from", from);
}
if (to != DateTimeHelper.ZERO_TIME)
{
where = SqlHelperClass.AddWhereCondition(where, "MVTestOpenTo < @to");
mParameters.Add("@to", to);
}
return where;
}
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Get culture ID from query string
uiCultureID = QueryHelper.GetInteger("UIcultureID", 0);
// Get requested culture
ui = UICultureInfoProvider.GetSafeUICulture(uiCultureID);
EditedObject = ui;
UICultureInfo dui = null;
if (string.Equals(ui.UICultureCode, CultureHelper.DefaultUICulture, StringComparison.InvariantCultureIgnoreCase))
{
dui = ui;
gridStrings.GridName = "List_defaultculture.xml";
}
else
{
// Ty to get default UI culture
try
{
dui = UICultureInfoProvider.GetUICultureInfo(CultureHelper.DefaultUICulture);
}
catch
{ }
}
if (dui != null)
{
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@Culture", ui.UICultureID);
parameters.AddId("@DefaultUICultureID", dui.UICultureID);
// Setup the grid
gridStrings.QueryParameters = parameters;
gridStrings.OnAction += UniGridUICultures_OnAction;
gridStrings.OnExternalDataBound += UniGridStrings_OnExternalDataBound;
InitializeMasterPage();
}
else
{
// Default UI culture does not exist - hide the grid and display error message
gridStrings.StopProcessing = true;
}
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
stepsGrid.OnAction += stepsGrid_OnAction;
stepsGrid.DataBinding += stepsGrid_DataBinding;
int workflowId = QueryHelper.GetInteger("workflowid", 0);
// Control initialization
InitializeMasterPage(workflowId);
// Prepare the steps query parameters
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@StepWorkflowID", workflowId);
stepsGrid.WhereCondition = "StepWorkflowID = @StepWorkflowID";
stepsGrid.QueryParameters = parameters;
stepsGrid.OnExternalDataBound += stepsGrid_OnExternalDataBound;
}
示例8: GenerateData
/// <summary>
/// Generates sample data.
/// </summary>
private void GenerateData()
{
try
{
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("siteId", CMSContext.CurrentSiteID);
ConnectionHelper.ExecuteQuery("ecommerce.order.generateSampleData", parameters);
// Log successful attempt
EventLogProvider eventLog = new EventLogProvider();
eventLog.LogEvent("I", DateTime.Now, "E-commerce data generator", "DATAGENERATED", CMSContext.CurrentSiteID);
ShowConfirmation(GetString("com.reports.datagenerated"));
}
catch (Exception ex)
{
EventLogProvider.LogException("Reports", "Generate", ex);
ShowError(GetString("com.reports.operationFailed"));
}
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (StopProcessing)
{
// Do nothing
return;
}
gridElem.IsLiveSite = IsLiveSite;
gridElem.OnExternalDataBound += gridElem_OnExternalDataBound;
gridElem.HideControlForZeroRows = false;
currentUserInfo = CMSContext.CurrentUser;
// Initialize strings
string strDays = GetString("MyDesk.OutdatedDocuments.Days");
string strWeeks = GetString("MyDesk.OutdatedDocuments.Weeks");
string strMonths = GetString("MyDesk.OutdatedDocuments.Months");
string strYears = GetString("MyDesk.OutdatedDocuments.Years");
// Set proper XML for control type
switch (ListingType)
{
case ListingTypeEnum.CheckedOut:
gridElem.ZeroRowsText = GetString("mydesk.ui.nochecked");
gridElem.WhereCondition = "View_CMS_Tree_Joined.DocumentCheckedOutByUserID = @UserID";
break;
case ListingTypeEnum.MyDocuments:
gridElem.ZeroRowsText = GetString("general.nodatafound");
gridElem.WhereCondition = "View_CMS_Tree_Joined.NodeOwner = @UserID";
break;
case ListingTypeEnum.RecentDocuments:
gridElem.ZeroRowsText = GetString("general.nodatafound");
gridElem.WhereCondition = "((View_CMS_Tree_Joined.DocumentCreatedByUserID = @UserID OR View_CMS_Tree_Joined.DocumentModifiedByUserID = @UserID OR View_CMS_Tree_Joined.DocumentCheckedOutByUserID = @UserID))";
break;
case ListingTypeEnum.PendingDocuments:
gridElem.ZeroRowsText = GetString("mydesk.ui.nowaitingdocs");
gridElem.WhereCondition = "CMS_WorkflowStep.StepName <> 'edit' AND CMS_WorkflowStep.StepName <> 'published' AND CMS_WorkflowStep.StepName <> 'archived' AND (View_CMS_Tree_Joined.DocumentWorkflowStepID IN ( SELECT StepID FROM CMS_Workflowsteproles LEFT JOIN View_CMS_UserRole_MembershipRole_ValidOnly_Joined ON View_CMS_UserRole_MembershipRole_ValidOnly_Joined.RoleID = CMS_WorkflowStepRoles.RoleID WHERE View_CMS_UserRole_MembershipRole_ValidOnly_Joined.UserID = @UserID ) OR @UserID = -1)";
break;
case ListingTypeEnum.OutdatedDocuments:
// Initialize controls
if (!RequestHelper.IsPostBack())
{
// Fill the dropdown list
drpFilter.Items.Add(strDays);
drpFilter.Items.Add(strWeeks);
drpFilter.Items.Add(strMonths);
drpFilter.Items.Add(strYears);
// Load default value
txtFilter.Text = "1";
drpFilter.SelectedValue = strYears;
// Bind dropdown lists
BindDropDowns();
}
gridElem.WhereCondition = "((DocumentCreatedByUserID = @UserID OR DocumentModifiedByUserID = @UserID OR DocumentCheckedOutByUserID = @UserID) AND " + SOURCE_MODIFIEDWHEN + "<[email protected] AND " + SOURCE_NODESITEID + "[email protected]teID)";
// Add where condition
if (!string.IsNullOrEmpty(txtDocumentName.Text))
{
gridElem.WhereCondition = SqlHelperClass.AddWhereCondition(gridElem.WhereCondition, GetOutdatedWhereCondition(SOURCE_DOCUMENTNAME, drpDocumentName, txtDocumentName));
}
if (!string.IsNullOrEmpty(txtDocumentType.Text))
{
gridElem.WhereCondition = SqlHelperClass.AddWhereCondition(gridElem.WhereCondition, GetOutdatedWhereCondition(SOURCE_CLASSDISPLAYNAME, drpDocumentType, txtDocumentType));
}
gridElem.ZeroRowsText = GetString("mydesk.ui.nooutdated");
// Show custom filter
plcOutdatedFilter.Visible = true;
break;
case ListingTypeEnum.WorkflowDocuments:
break;
case ListingTypeEnum.PageTemplateDocuments:
gridElem.ZeroRowsText = GetString("Administration-PageTemplate_Header.Documents.nodata");
break;
case ListingTypeEnum.CategoryDocuments:
gridElem.ZeroRowsText = GetString("Category_Edit.Documents.nodata");
break;
case ListingTypeEnum.ProductDocuments:
break;
case ListingTypeEnum.TagDocuments:
gridElem.ZeroRowsText = GetString("taggroup_edit.documents.nodata");
break;
case ListingTypeEnum.DocTypeDocuments:
gridElem.ZeroRowsText = GetString("DocumentType_Edit_General.Documents.nodata");
break;
case ListingTypeEnum.All:
gridElem.ZeroRowsText = GetString("mydesk.ui.nodata");
break;
//.........这里部分代码省略.........
示例10: LoadData
/// <summary>
/// Load data.
/// </summary>
public void LoadData()
{
mProcess = true;
if (!Visible || StopProcessing)
{
EnableViewState = false;
mProcess = false;
}
IsLiveSite = false;
if (ProjectID > 0)
{
// Get information on current project
mProject = ProjectInfoProvider.GetProjectInfo(ProjectID);
}
// Get project resource
mResProjects = ResourceInfoProvider.GetResourceInfo("CMS.ProjectManagement");
if ((mResProjects != null) && (mProject != null))
{
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@ID", mResProjects.ResourceId);
parameters.Add("@ProjectID", mProject.ProjectID);
parameters.Add("@SiteID", SiteContext.CurrentSiteID);
string where;
int groupId = mProject.ProjectGroupID;
// Build where condition
if (groupId > 0)
{
where = "RoleGroupID=" + groupId + " AND PermissionDisplayInMatrix = 0";
}
else
{
where = "RoleGroupID IS NULL AND PermissionDisplayInMatrix = 0";
}
// Setup matrix control
gridMatrix.IsLiveSite = IsLiveSite;
gridMatrix.QueryParameters = parameters;
gridMatrix.WhereCondition = where;
gridMatrix.CssClass = "permission-matrix";
}
}
示例11: GetQueryParameters
/// <summary>
/// Gets query parameters for the permission matrix.
/// </summary>
/// <returns>Two dimensional object array of query parameters.</returns>
private QueryDataParameters GetQueryParameters()
{
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@ID", ValidationHelper.GetInteger(SelectedID, 0));
parameters.Add("@SiteID", (GlobalRoles ? 0 : SiteID == 0 ? SiteContext.CurrentSiteID : SiteID));
parameters.Add("@DisplayInMatrix", true);
return parameters;
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Visible)
{
this.EnableViewState = false;
}
// Get group resource info
resGroups = ResourceInfoProvider.GetResourceInfo("CMS.Groups");
if (resGroups != null)
{
// Retrive permission matrix data
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@ID", resGroups.ResourceId);
parameters.Add("@GroupID", this.GroupID);
parameters.Add("@SiteID", CMSContext.CurrentSiteID);
// Setup WHERE condition
string where = "RoleGroupID=" + this.GroupID.ToString() + "AND PermissionDisplayInMatrix = 0";
// Setup grid control
gridMatrix.QueryParameters = parameters;
gridMatrix.WhereCondition = where;
gridMatrix.ContentBefore = "<table class=\"PermissionMatrix\" cellspacing=\"0\" cellpadding=\"0\" rules=\"rows\" border=\"1\" style=\"border-collapse:collapse;\">";
gridMatrix.ContentAfter = "</table>";
gridMatrix.OnItemChanged += new UniMatrix.ItemChangedEventHandler(gridMatrix_OnItemChanged);
// Disable permission matrix if user has no MANAGE rights
if (!CMSContext.CurrentUser.IsGroupAdministrator(this.GroupID))
{
if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.groups", CMSAdminControl.PERMISSION_MANAGE))
{
this.Enabled = false;
gridMatrix.Enabled = false;
lblError.Text = String.Format(ResHelper.GetString("CMSSiteManager.AccessDeniedOnPermissionName"), "Manage");
lblError.Visible = true;
}
}
}
}
示例13: LoadQueryDefinition
/// <summary>
/// Load query definition from XML.
/// </summary>
/// <param name="queryNode">XML query definition node</param>
private void LoadQueryDefinition(XmlNode queryNode)
{
if (queryNode != null)
{
Query = queryNode.Attributes["name"].Value;
// Set the columns property if columns are defined
LoadColumns(queryNode);
LoadAllColumns(queryNode);
// Load the query parameters
XmlNodeList parameters = queryNode.SelectNodes("parameter");
if ((parameters != null) && (parameters.Count > 0))
{
QueryDataParameters newParams = new QueryDataParameters();
// Process all parameters
foreach (XmlNode param in parameters)
{
object value = null;
string name = param.Attributes["name"].Value;
switch (param.Attributes["type"].Value.ToLower())
{
case "string":
value = param.Attributes["value"].Value;
break;
case "int":
value = ValidationHelper.GetInteger(param.Attributes["value"].Value, 0);
break;
case "double":
value = Convert.ToDouble(param.Attributes["value"].Value);
break;
case "bool":
value = Convert.ToBoolean(param.Attributes["value"].Value);
break;
}
newParams.Add(name, value);
}
QueryParameters = newParams;
}
}
}
示例14: LoadData
/// <summary>
/// Load data.
/// </summary>
public void LoadData()
{
process = true;
if (!Visible || StopProcessing)
{
EnableViewState = false;
process = false;
}
IsLiveSite = false;
if (ProjectID > 0)
{
// Get information on current project
project = ProjectInfoProvider.GetProjectInfo(ProjectID);
}
// Get project resource
resProjects = ResourceInfoProvider.GetResourceInfo("CMS.ProjectManagement");
if ((resProjects != null) && (project != null))
{
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@ID", resProjects.ResourceId);
parameters.Add("@ProjectID", project.ProjectID);
parameters.Add("@SiteID", CMSContext.CurrentSiteID);
string where = "";
int groupId = project.ProjectGroupID;
// Build where condition
if (groupId > 0)
{
where = "RoleGroupID=" + groupId.ToString() + " AND PermissionDisplayInMatrix = 0";
}
else
{
where = "RoleGroupID IS NULL AND PermissionDisplayInMatrix = 0";
}
// Setup matrix control
gridMatrix.IsLiveSite = IsLiveSite;
gridMatrix.QueryParameters = parameters;
gridMatrix.WhereCondition = where;
gridMatrix.ContentBefore = "<table class=\"PermissionMatrix\" cellspacing=\"0\" cellpadding=\"0\" rules=\"rows\" border=\"1\" style=\"border-collapse:collapse;\">";
gridMatrix.ContentAfter = "</table>";
}
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Check hash
if (!QueryHelper.ValidateHash("hash"))
{
URLHelper.Redirect(UIHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true));
}
else
{
string element = QueryHelper.GetString("tasktype", null);
// Check UI permissions for Staging
var user = MembershipContext.AuthenticatedUser;
if (!user.IsAuthorizedPerUIElement("cms.staging", element))
{
RedirectToUIElementAccessDenied("cms.staging", element);
}
// Check 'Manage XXX tasks' permission
if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.staging", "Manage" + element + "Tasks"))
{
RedirectToAccessDenied("cms.staging", "Manage" + element + "Tasks");
}
// Register modal dialog scripts
RegisterModalPageScripts();
serverId = QueryHelper.GetInteger("serverid", 0);
taskId = QueryHelper.GetInteger("taskid", 0);
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@TaskID", taskId);
parameters.Add("@ServerID", serverId);
gridLog.QueryParameters = parameters;
gridLog.OnAction += gridLog_OnAction;
gridLog.ZeroRowsText = GetString("Task.LogNoEvents");
gridLog.OnBeforeDataReload += gridLog_OnBeforeDataReload;
PageTitle.TitleText = GetString("Task.LogHeader");
CurrentMaster.DisplayControlsPanel = true;
}
}