本文整理汇总了C#中QueryDataParameters类的典型用法代码示例。如果您正苦于以下问题:C# QueryDataParameters类的具体用法?C# QueryDataParameters怎么用?C# QueryDataParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryDataParameters类属于命名空间,在下文中一共展示了QueryDataParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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());
mParameters = new QueryDataParameters();
DateTime from = dtpFrom.SelectedDateTime;
DateTime to = dtpTo.SelectedDateTime;
if (from != DateTimeHelper.ZERO_TIME)
{
where = SqlHelperClass.AddWhereCondition(where, "ABTestOpenFrom > @from");
mParameters.Add("@from", from);
}
if (to != DateTimeHelper.ZERO_TIME)
{
where = SqlHelperClass.AddWhereCondition(where, "ABTestOpenTo < @to");
mParameters.Add("@to", to);
}
return where;
}
示例3: 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;
}
示例4: dlComment_DeleteCommand
protected void dlComment_DeleteCommand(object source, DataListCommandEventArgs e)
{
int CommentID = Convert.ToInt32(dlComment.DataKeys[e.Item.ItemIndex]);
string delete = string.Format("DELETE FROM [Form_blog_comment] WHERE commentID ='" + CommentID + "'");
QueryDataParameters queryparam = new QueryDataParameters();
DataSet dataSet = ConnectionHelper.ExecuteQuery(delete, queryparam, QueryTypeEnum.SQLQuery);
BindDataList();
}
示例5: BindDataList
protected void BindDataList()
{
int nodeID = CMS.DocumentEngine.DocumentContext.CurrentDocument.NodeID;
string serviceType = string.Format("SELECT * FROM [Form_blog_comment] WHERE BlogNodeID ='" + nodeID + "' ORDER BY FormInserted DESC");
QueryDataParameters queryparam = new QueryDataParameters();
DataSet dataSet = ConnectionHelper.ExecuteQuery(serviceType, queryparam, QueryTypeEnum.SQLQuery);
dlComment.DataSource = dataSet.Tables[0];
dlComment.DataBind();
}
示例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);
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));
}
}
示例7: 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)));
}
}
示例8: 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;
}
}
示例9: 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;
}
示例10: 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"));
}
}
示例11: SetupControl
/// <summary>
/// Initializes the control properties.
/// </summary>
protected void SetupControl()
{
try
{
litArchive.Text = (string)this.GetValue("Header");
string serviceType = string.Format("SELECT categoryname FROM [customtable_Category]");
QueryDataParameters queryparam = new QueryDataParameters();
DataSet dataSet = ConnectionHelper.ExecuteQuery(serviceType, queryparam, QueryTypeEnum.SQLQuery);
if (!DataHelper.DataSourceIsEmpty(dataSet))
{
rptCategory.DataSource = dataSet.Tables[0];
rptCategory.DataBind();
}
}
catch (Exception ex1)
{
Response.Write(ex1.Message.ToString() + ex1.StackTrace.ToString());
}
}
示例12: SetupGridQueryParameters
/// <summary>
/// Setups grid query parameters.
/// </summary>
private void SetupGridQueryParameters()
{
// Create query parameters
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("@Now", DateTime.Now);
if (ListingType == ListingTypeEnum.OutdatedDocuments)
{
parameters.Add("@SiteID", SiteContext.CurrentSiteID);
}
// Initialize UserID query parameter
int userID = currentUserInfo.UserID;
if (ListingType == ListingTypeEnum.PendingDocuments)
{
parameters.Add("@SiteID", SiteInfoProvider.GetSiteID(SiteName));
if ((currentUserInfo.IsGlobalAdministrator) || (currentUserInfo.IsAuthorizedPerResource("CMS.Content", "manageworkflow")))
{
userID = -1;
}
}
parameters.Add("@UserID", userID);
// Document Age
if (DocumentAge != String.Empty)
{
string[] ages = DocumentAge.Split(';');
if (ages.Length == 2)
{
// Add from a to values to temp parameters
int from = ValidationHelper.GetInteger(ages[1], 0);
int to = ValidationHelper.GetInteger(ages[0], 0);
if (@from > 0)
{
gridElem.WhereCondition = SqlHelper.AddWhereCondition(gridElem.WhereCondition, SOURCE_MODIFIEDWHEN + " >= @FROM");
parameters.Add("@FROM", DateTime.Now.AddDays((-1) * @from));
}
if (to > 0)
{
gridElem.WhereCondition = SqlHelper.AddWhereCondition(gridElem.WhereCondition, SOURCE_MODIFIEDWHEN + " <= @TO");
parameters.Add("@TO", DateTime.Now.AddDays((-1) * to));
}
}
}
// Set parameters
gridElem.QueryParameters = parameters;
}
示例13: Page_Load
//.........这里部分代码省略.........
break;
}
// Page Size
if (!RequestHelper.IsPostBack() && !String.IsNullOrEmpty(ItemsPerPage))
{
gridElem.Pager.DefaultPageSize = ValidationHelper.GetInteger(ItemsPerPage, -1);
}
// Order
switch (ListingType)
{
case ListingTypeEnum.WorkflowDocuments:
case ListingTypeEnum.OutdatedDocuments:
case ListingTypeEnum.PageTemplateDocuments:
case ListingTypeEnum.CategoryDocuments:
case ListingTypeEnum.TagDocuments:
case ListingTypeEnum.ProductDocuments:
case ListingTypeEnum.DocTypeDocuments:
gridElem.OrderBy = SOURCE_DOCUMENTNAME;
break;
default:
gridElem.OrderBy = OrderBy;
break;
}
if (ListingType == ListingTypeEnum.All)
{
gridElem.WhereCondition = SqlHelperClass.AddWhereCondition(gridElem.WhereCondition, String.Format("(UserID1 = {0} OR UserID2 = {0} OR UserID3 = {0})", currentUserInfo.UserID));
}
// Create query parameters
QueryDataParameters parameters = new QueryDataParameters();
if (ListingType == ListingTypeEnum.OutdatedDocuments)
{
parameters.Add("@SiteID", CMSContext.CurrentSite.SiteID);
DateTime olderThan = DateTime.Now;
int dateTimeValue = ValidationHelper.GetInteger(txtFilter.Text, 0);
if (drpFilter.SelectedValue == strDays)
{
olderThan = olderThan.AddDays(-dateTimeValue);
}
else if (drpFilter.SelectedValue == strWeeks)
{
olderThan = olderThan.AddDays(-dateTimeValue * 7);
}
else if (drpFilter.SelectedValue == strMonths)
{
olderThan = olderThan.AddMonths(-dateTimeValue);
}
else if (drpFilter.SelectedValue == strYears)
{
olderThan = olderThan.AddYears(-dateTimeValue);
}
parameters.Add("@OlderThan", olderThan);
}
// Initialize UserID query parameter
int userID = currentUserInfo.UserID;
if (ListingType == ListingTypeEnum.PendingDocuments)
{
if ((currentUserInfo.IsGlobalAdministrator) || (currentUserInfo.IsAuthorizedPerResource("CMS.Content", "manageworkflow")))
{
示例14: 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;
}
示例15: 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";
}
}