当前位置: 首页>>代码示例>>C#>>正文


C# QueryDataParameters类代码示例

本文整理汇总了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;
    }
开发者ID:v-jli,项目名称:jean0407large,代码行数:26,代码来源:Newsletter_Issue_OpenedBy.aspx.cs

示例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;
    }
开发者ID:v-jli,项目名称:jean0407large,代码行数:38,代码来源:ListFilter.ascx.cs

示例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;
    }
开发者ID:v-jli,项目名称:jean0407large,代码行数:32,代码来源:OnlineMarketingFunctions.cs

示例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();
    }
开发者ID:DeepakV1985,项目名称:MyCompany,代码行数:10,代码来源:CommentView.ascx.cs

示例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();
    }
开发者ID:DeepakV1985,项目名称:MyCompany,代码行数:11,代码来源:CommentView.ascx.cs

示例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));
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:52,代码来源:List.aspx.cs

示例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)));
        }
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:49,代码来源:List.aspx.cs

示例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;
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:45,代码来源:List.aspx.cs

示例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;
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:18,代码来源:Workflow_Steps.aspx.cs

示例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"));
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:23,代码来源:SampleData_Generator.aspx.cs

示例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());
        }
    }
开发者ID:DeepakV1985,项目名称:MyCompany,代码行数:25,代码来源:BlogCategory.ascx.cs

示例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;
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:55,代码来源:Documents.ascx.cs

示例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")))
            {
开发者ID:jiva,项目名称:Kentico,代码行数:67,代码来源:Documents.ascx.cs

示例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;
    }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:13,代码来源:PermissionsMatrix.ascx.cs

示例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";
        }
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:50,代码来源:Security.ascx.cs


注:本文中的QueryDataParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。