Exemplo n.º 1
0
        protected void btnTestQuery_OnClick(object sender, EventArgs e)
        {
            var dt      = (DataTable)ViewState["nbiEntries"];
            var queries = new List <DtoCustomComputerQuery>();

            if (dt.Rows.Count > 0)
            {
                foreach (GridViewRow row in gvNetBoot.Rows)
                {
                    var query = new DtoCustomComputerQuery();
                    query.IncludeArchived = chkArchived.Checked;
                    query.GroupBy         = ddlGroupBy.SelectedItem.Text;
                    query.AndOr           = ((Label)row.FindControl("lblAndOr")).Text;

                    query.LeftParenthesis  = ((Label)row.FindControl("lblLeftPar")).Text;
                    query.Table            = ((Label)row.FindControl("lblTable")).Text;
                    query.Field            = ((Label)row.FindControl("lblField")).Text;
                    query.Operator         = ((Label)row.FindControl("lblOperator")).Text;
                    query.Value            = ((Label)row.FindControl("lblValue")).Text;
                    query.RightParenthesis = ((Label)row.FindControl("lblRightPar")).Text;

                    queries.Add(query);
                }
            }
            var result = Call.ReportApi.GetCustomAsset(queries);

            gvResult.DataSource = result;
            gvResult.DataBind();
            lblTotal.Text = gvResult.Rows.Count + " Result(s)";
        }
Exemplo n.º 2
0
        protected void btnTestQuery_OnClick(object sender, EventArgs e)
        {
            var dt         = (DataTable)ViewState["nbiEntries"];
            var queries    = new List <DtoCustomComputerQuery>();
            int currentRow = 0;

            if (dt.Rows.Count > 0)
            {
                foreach (GridViewRow row in gvNetBoot.Rows)
                {
                    currentRow++;
                    var query = new DtoCustomComputerQuery();
                    query.IncludeArchived       = chkArchived.Checked;
                    query.IncludePreProvisioned = chkPre.Checked;
                    query.GroupBy = ddlGroupBy.SelectedItem.Text;
                    query.AndOr   = ((Label)row.FindControl("lblAndOr")).Text;
                    if (dt.Rows.Count > 1 && query.AndOr.Equals("Not"))
                    {
                        EndUserMessage = "Not Can Only Be Used In A Single Query";
                        return;
                    }

                    if (currentRow > 1 && query.AndOr.Equals("Not"))
                    {
                        EndUserMessage = "Not Can Only Be Used In The First Query";
                        return;
                    }
                    query.LeftParenthesis  = ((Label)row.FindControl("lblLeftPar")).Text;
                    query.Table            = ((Label)row.FindControl("lblTable")).Text;
                    query.Field            = ((Label)row.FindControl("lblField")).Text;
                    query.Operator         = ((Label)row.FindControl("lblOperator")).Text;
                    query.Value            = ((Label)row.FindControl("lblValue")).Text;
                    query.RightParenthesis = ((Label)row.FindControl("lblRightPar")).Text;

                    queries.Add(query);
                }
            }
            var result = Call.ReportApi.GetCustomComputer(queries);

            gvResult.DataSource = result;
            gvResult.DataBind();
            lblTotal.Text = gvResult.Rows.Count + " Result(s)";
        }