private void getNewSearchRowsList()
    {
        SearchRowsList.Clear();
        string txtRows = this.txtSearchRows.Value;

        if (txtRows.Length > 0)
        {
            txtRows = txtRows.Substring(0, txtRows.Length - 1);
        }

        string[] rows = txtRows.Split(new char[] { ';' });

        for (int i = 0; i < rows.Length; i++)
        {
            string [] row = rows[i].Split(new char[] { '|' });

            SearchRow srow = new SearchRow();
            srow.Field          = row[0];
            srow.FieldType      = row[1];
            srow.SearchOperator = row[2];;
            srow.SearchValue    = row[3];
            srow.AndOr          = row[4];
            SearchRowsList.Add(srow);
        }
    }
    protected void btnAddRow_Click(object sender, EventArgs e)
    {
        getNewSearchRowsList();
        SearchRow srow = new SearchRow();

        srow.AndOr = "And";
        SearchRowsList.Add(srow);
        BindGrid();
    }
Exemplo n.º 3
0
        public SearchResults Search(SearchInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException();
            }

            var search = new PCDSearch();

            search.SetDST(Dst);
            search.SetSearchObject(info.SearchObject);
            foreach (var pair in info.Criteria)
            {
                search.AddSearchCriteria(pair.Key, pair.Value);
            }
            foreach (var prop in info.ReturnProperties)
            {
                search.AddReturnProperty(prop);
            }
            if (info.OrderBy != null)
            {
                foreach (var pair in info.OrderBy)
                {
                    search.AddOrderByProperty(pair.Key, (int)pair.Value);
                }
            }

            if (search.Execute() != 0 || search.ErrNumber != 0)
            {
                throw new DMApiException(string.Format("PCDSearch.Execute failed with error {0}: {1}", search.ErrNumber, search.ErrDescription));
            }
            var results = new SearchResults();
            int count   = search.GetRowsFound();

            if (count > 0)
            {
                results.Rows.Capacity = count;
                search.BeginGetBlock();
                try {
                    for (int i = 0; i < count; i++)
                    {
                        search.NextRow();
                        var row = new SearchRow();
                        foreach (var prop in info.ReturnProperties)
                        {
                            row.Add(prop, search.GetPropertyValue(prop));
                        }
                        results.Rows.Add(row);
                    }
                }
                finally {
                    search.EndGetBlock();
                    search.ReleaseResults();
                }
            }
            return(results);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the return columns.
 /// </summary>
 public void SetColumns(SearchRow columns)
 {
     if (columns is InventoryNumberSearchRow)
     {
         this.columns = (InventoryNumberSearchRow)columns;
     }
     else
     {
         throw new System.ArgumentException("Parameter should be of type InventoryNumberSearchRow", "columns");
     }
 }
 /// <summary>
 /// Sets the return columns.
 /// </summary>
 public void SetColumns(SearchRow columns)
 {
     if (columns is AccountSearchRow)
     {
         this.columns = (AccountSearchRow)columns;
     }
     else
     {
         throw new System.ArgumentException("Parameter should be of type AccountSearchRow", "columns");
     }
 }
 /// <summary>
 /// Sets the return columns.
 /// </summary>
 public void SetColumns(SearchRow columns)
 {
     if (columns is ManufacturingOperationTaskSearchRow)
     {
         this.columns = (ManufacturingOperationTaskSearchRow)columns;
     }
     else
     {
         throw new System.ArgumentException("Parameter should be of type ManufacturingOperationTaskSearchRow", "columns");
     }
 }
 /// <summary>
 /// Sets the return columns.
 /// </summary>
 public void SetColumns(SearchRow columns)
 {
     if (columns is CustomerMessageSearchRow)
     {
         this.columns = (CustomerMessageSearchRow)columns;
     }
     else
     {
         throw new System.ArgumentException("Parameter should be of type CustomerMessageSearchRow", "columns");
     }
 }
 /// <summary>
 /// Sets the return columns.
 /// </summary>
 public void SetColumns(SearchRow columns)
 {
     if (columns is GiftCertificateSearchRow)
     {
         this.columns = (GiftCertificateSearchRow)columns;
     }
     else
     {
         throw new System.ArgumentException("Parameter should be of type GiftCertificateSearchRow", "columns");
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// Sets the return columns.
 /// </summary>
 public void SetColumns(SearchRow columns)
 {
     if (columns is ExpenseCategorySearchRow)
     {
         this.columns = (ExpenseCategorySearchRow)columns;
     }
     else
     {
         throw new System.ArgumentException("Parameter should be of type ExpenseCategorySearchRow", "columns");
     }
 }
 /// <summary>
 /// Sets the return columns.
 /// </summary>
 public void SetColumns(SearchRow columns)
 {
     if (columns is WinLossReasonSearchRow)
     {
         this.columns = (WinLossReasonSearchRow)columns;
     }
     else
     {
         throw new System.ArgumentException("Parameter should be of type WinLossReasonSearchRow", "columns");
     }
 }
 /// <summary>
 /// Sets the return columns.
 /// </summary>
 public void SetColumns(SearchRow columns)
 {
     if (columns is RevRecScheduleSearchRow)
     {
         this.columns = (RevRecScheduleSearchRow)columns;
     }
     else
     {
         throw new System.ArgumentException("Parameter should be of type RevRecScheduleSearchRow", "columns");
     }
 }
Exemplo n.º 12
0
        public static SearchRow ReadFromBatchFile(string[] metadata, StreamReader reader)
        {
            var row = new SearchRow();

            row.Id   = metadata[1];
            row.Type = metadata[2];
            row.Lang = metadata[3];
            row.Name = reader.ReadLine();
            row.Json = reader.ReadLine();

            reader.ReadLine();
            return(row);
        }
    void FillData(int index, DropDownList ddlAndOr, DropDownList ddl, DropDownList ddloperator, TextBox txtValue)
    {
        SearchRow row = SearchRowsList[index];

        ddlAndOr.DataSource = new string[] { "And", "Or" };

        ddlAndOr.DataBind();

        if (row.AndOr == "Or")
        {
            ddlAndOr.SelectedIndex = 1;
        }
        else
        {
            ddlAndOr.SelectedIndex = 0;
        }



        txtValue.Text = row.SearchValue;

        //fill ddlField
        ddl.DataSource     = SearchFields;
        ddl.DataTextField  = "FName";
        ddl.DataValueField = "DatabaseFieldAndType";

        ddl.DataBind();
        ddl.Items.Insert(0, "");

        //fill ddloperator

        string fieldName = row.Field;

        if (row.Field == string.Empty || row.Field == null)
        {
            return;
        }
        for (int i = 0; i < ddl.Items.Count; i++)
        {
            if (ddl.Items[i].Value.StartsWith(fieldName))
            {
                ddl.SelectedIndex = i;
                string fieldType = ddl.SelectedValue.Split(new char[] { '|' })[1];


                fillDropdownList(ddloperator, fieldType, row.SearchOperator);
                return;
            }
        }
    }
Exemplo n.º 14
0
        public NesuiInventoryItem(SearchRow row)
        {
            dynamic self = row;

            this.Id = self.basic.internalId[0].searchValue.internalId;

            var upcCode = self.basic.upcCode;
            if (upcCode != null)
                this.Barcode = upcCode[0].searchValue;

            var displayName = self.basic.displayName;
            if (displayName != null)
                this.Name = displayName[0].searchValue;

            var basePrice = self.basic.basePrice;
            if (basePrice != null)
                this.Price = basePrice[0].searchValue;
        }