예제 #1
0
        private void BtnSearchMulti_Click(object sender, RoutedEventArgs e)
        {
            ResultView    result              = new ResultView();
            List <POLine> dblPOLine           = new List <POLine>();
            string        sPartNumber         = "";
            string        sDescription        = "";
            string        sManufacturer       = "";
            string        sSupplierPartNumber = "";
            int           iCount              = 0;

            if (cbPartNumber.IsChecked ?? false)
            {
                sPartNumber = " PartNumber LIKE '%" + txtFieldsContain.Text;
                iCount++;
            }
            if (cbDescription.IsChecked ?? false)
            {
                if (iCount > 0)
                {
                    sDescription = " %' OR LineDesc LIKE '%" + txtFieldsContain.Text;
                }
                else
                {
                    sDescription = " LineDesc LIKE '%" + txtFieldsContain.Text;
                }
                iCount++;
            }
            if (cbManufacturer.IsChecked ?? false)
            {
                if (iCount > 0)
                {
                    sManufacturer = " %' OR Manufacturer LIKE '%" + txtFieldsContain.Text;
                }
                else
                {
                    sManufacturer = " Manufacturer LIKE '%" + txtFieldsContain.Text;
                }
                iCount++;
            }
            if (cbSupplierPartNumber.IsChecked == true)
            {
                if (iCount > 0)
                {
                    sSupplierPartNumber = " %' OR VenPartNum LIKE '%" + txtFieldsContain.Text;
                }
                else
                {
                    sSupplierPartNumber = " VenPartNum LIKE '%" + txtFieldsContain.Text;
                }
                iCount++;
            }

            if (iCount > 0)
            {
                dblPOLine = context.ExecuteQuery <POLine>("SELECT DISTINCT * FROM EIWarehouse.dbo.POLine WHERE" + sPartNumber + sDescription + sManufacturer + sSupplierPartNumber + "%'").ToList();
                result.dgResult.ItemsSource = dblPOLine;
                result.ShowDialog();
            }
        }
예제 #2
0
        private void ChecksForMultiSearchContain()
        {
            ResultView        result    = new ResultView();
            List <POLineFact> dblPOLine = new List <POLineFact>();

            string sQuery = "";
            int    iCount = 0;

            if (cbPartNumber.IsChecked == true)
            {
                sQuery += " PartNumber LIKE '%" + txtFieldsContain.Text;
                iCount++;
            }
            if (cbDescription.IsChecked == true)
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR PartDescription LIKE '%" + txtFieldsContain.Text;
                }
                else
                {
                    sQuery += " PartDescription LIKE '%" + txtFieldsContain.Text;
                }
                iCount++;
            }
            if (cbManufacturer.IsChecked == true)
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR Manufacturer LIKE '%" + txtFieldsContain.Text;
                }
                else
                {
                    sQuery += " Manufacturer LIKE '%" + txtFieldsContain.Text;
                }
                iCount++;
            }
            if (cbSupplierPartNumber.IsChecked == true)
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR VendorPartNumber LIKE '%" + txtFieldsContain.Text;
                }
                else
                {
                    sQuery += " VendorPartNumber LIKE '%" + txtFieldsContain.Text;
                }
                iCount++;
            }

            if (iCount > 0)
            {
                dblPOLine = context.ExecuteQuery <POLineFact>("SELECT DISTINCT * FROM EIWarehouse.dbo.POLineFact WHERE" + sQuery + "%'").ToList();
                result.dgResult.ItemsSource = dblPOLine;
                result.ShowDialog();
            }
        }
예제 #3
0
        private void ChecksForAllTheSearchContain()
        {
            ResultView        result    = new ResultView();
            List <POLineFact> dblPOLine = new List <POLineFact>();

            int    iCount = 0;
            string sQuery = "";

            if (cbOpen.IsChecked == true)
            {
                sQuery += " %' OR CLOSED LIKE '%FALSE";
                iCount++;
            }
            if (cbClosed.IsChecked == true)
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR CLOSED LIKE '%TRUE";
                }
                else
                {
                    sQuery += " CLOSED LIKE '%TRUE";
                }
                iCount++;
            }
            if (cbMaterial.IsChecked == true)
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR TranType LIKE '%PUR-MTL";
                }
                else
                {
                    sQuery += " TranType LIKE '%PUR-MTL";
                }
                iCount++;
            }
            if (cbSubcontract.IsChecked == true)
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR TranType LIKE '%PUR-SUB";
                }
                else
                {
                    sQuery += " TranType LIKE '%PUR-SUB";
                }
                iCount++;
            }
            if (cbOtherInv.IsChecked == true)
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR TranType LIKE '%PUR-UKN";
                }
                else
                {
                    sQuery += " TranType LIKE '%PUR-UKN";
                }
                iCount++;
            }
            if (txtPartNumber.Text != "")
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR PartNumber LIKE '%" + txtPartNumber.Text;
                }
                else
                {
                    sQuery += " PartNumber LIKE '%" + txtPartNumber.Text;
                }
                iCount++;
            }
            if (txtDescription.Text != "")
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR PartDescription LIKE '%" + txtPartNumber.Text;
                }
                else
                {
                    sQuery += " PartDescription LIKE '%" + txtDescription.Text;
                }
                iCount++;
            }
            if (txtManufacturer.Text != "")
            {
                if (iCount > 0)
                {
                    sQuery = " %' OR Manufacturer LIKE '%" + txtPartNumber.Text;
                }
                else
                {
                    sQuery += " Manufacturer LIKE '%" + txtDescription.Text;
                }
                iCount++;
            }
            if (txtSupplierPart.Text != "")
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR VendorPartNumber LIKE '%" + txtPartNumber.Text;
                }
                else
                {
                    sQuery += " VendorPartNumber LIKE '%" + txtSupplierPart.Text;
                }
                iCount++;
            }
            if (txtJobs.Text != "")
            {
                if (iCount > 0)
                {
                    sQuery = " %' OR JobNum LIKE '%" + txtPartNumber.Text;
                }
                else
                {
                    sQuery += " JobNum LIKE '%" + txtJobs.Text;
                }
                iCount++;
            }
            if (txtAssemblies.Text != "")
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR AssemblySeq LIKE '%" + txtPartNumber.Text;
                }
                else
                {
                    sQuery += " AssemblySeq LIKE '%" + txtAssemblies.Text;
                }
                iCount++;
            }
            if (dpStart.Text != "")
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR OrderDate LIKE '%" + dpStart.Text;
                }
                else
                {
                    sQuery += " OrderDate LIKE '%" + dpStart.Text;
                }
                iCount++;
            }
            if (dpEnd.Text != "")
            {
                if (iCount > 0)
                {
                    sQuery += " %' OR DueDate LIKE '%" + dpEnd.Text;
                }
                else
                {
                    sQuery += " DueDate LIKE '%" + dpEnd.Text;
                }
                iCount++;
            }
            if (txtBuyer.Text != "")
            {
                Buyer buyer = (Buyer)dgBuyers.SelectedItem;
                if (iCount > 0)
                {
                    sQuery += " %' OR Buyer LIKE '%" + buyer.ID;
                }
                else
                {
                    sQuery += " Buyer LIKE '%" + buyer.ID;
                }
                iCount++;
            }
            if (txtSupplier.Text != "" || dgSupplier.SelectedItem != null)
            {
                Vendor vendor = (Vendor)dgSupplier.SelectedItem;
                if (iCount > 0)
                {
                    sQuery += " %' OR Vendor LIKE '%" + vendor.Supplier;
                }
                else
                {
                    sQuery += " Vendor LIKE '%" + vendor.Supplier;
                }
                iCount++;
            }
            if (iCount > 0)
            {
                dblPOLine = context.ExecuteQuery <POLineFact>("SELECT DISTINCT * FROM EIWarehouse.dbo.POLineFact WHERE" + sQuery + "%'").ToList();
                result.dgResult.ItemsSource = dblPOLine;
                result.ShowDialog();
            }
        }
예제 #4
0
        private void BtnSearch_Click(object sender, RoutedEventArgs e)
        {
            ResultView result = new ResultView();

            result.ShowDialog();
        }