Пример #1
0
    /// <summary>
    /// 
    /// </summary>
        private void SearchCuttingHeader()
        {

            try
            {

                splashScreenManager1.ShowWaitForm();
                //create expression 
                ParameterExpression argParam = Expression.Parameter(typeof(CuttingHeader), "s");
                Expression nameProperty = Expression.Property(argParam, "CuttingHeaderID");
                Expression namespaceProperty = Expression.Property(argParam, "StyleID");

                var val1 = Expression.Constant(txtSearchBox.Text);
                var val2 = Expression.Constant(txtSearchBox.Text);
                //expresttion 1 
                Expression e1 = Expression.Call(nameProperty, "Contains", null, val1);
                // expresstion 2
                Expression e2 = Expression.Call(namespaceProperty, "Contains", null, val2);
                var andExp = Expression.Or(e1, e2);


                // get expresttion to labda objet 
                var lambda1 = Expression.Lambda<Func<CuttingHeader, bool>>(andExp, argParam);
                // pass object to query 
               GenaricRepository<CuttingHeader> _SearchHeaderRepository = new GenaricRepository<CuttingHeader>(new ItrackContext());
                var selected = from item in _SearchHeaderRepository.SearchFor(lambda1).ToList() select new { item.CuttingHeaderID, item.StyleID, item.OrderQuantity, item.Date, item.Remark };

                //check is record exist in selected item
               if (selected.Count() > 0)
                {
                    grdSearch.Show();
                    btnClose.Show();

                    grdSearch.DataSource = selected;
                }
                else
                {
                    grdSearch.DataSource = null;
                }

               splashScreenManager1.CloseWaitForm();

            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "Error - B-0007", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
Пример #2
0
        private void Search()
        {

            try
            {


                //create expression 
                ParameterExpression argParam = Expression.Parameter(typeof(ScaningTimeSchadual), "s");
                Expression nameProperty = Expression.Property(argParam, "ScaningTime");
                Expression namespaceProperty = Expression.Property(argParam, "ScaningTime");

                var val1 = Expression.Constant(txtScanTime.Text);
                var val2 = Expression.Constant(txtScanTime.Text);
                //expresttion 1 
                Expression e1 = Expression.Call(nameProperty, "Contains", null, val1);
                // expresstion 2
                Expression e2 = Expression.Call(namespaceProperty, "Contains", null, val2);
                var andExp = Expression.Or(e1, e2);


                GenaricRepository<ScaningTimeSchadual> _ScaningTimeSchadualRepository = new GenaricRepository<ScaningTimeSchadual>(new ItrackContext());
                // get expresttion to labda objet 
                var lambda1 = Expression.Lambda<Func<ScaningTimeSchadual, bool>>(andExp, argParam);
                // pass object to query 
                var selected = from item in _ScaningTimeSchadualRepository.SearchFor(lambda1).ToList() select new { item.ScaningTimeSchadualID, item.HourNO, item.ScaningTime };
                grdSearch.Show();
                //check is record exist in selected item
                if (selected.Count() > 0)
                {



                    grdSearch.DataSource = selected;
                }
                else
                {
                    grdSearch.DataSource = null;
                }



            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message, "Error - B-0007", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
Пример #3
0
        private void SearchPo()
        {
            try
            {
                
                GenaricRepository<PO> _PORepo = new GenaricRepository<PO>(new ItrackContext());
                //create expression 
                ParameterExpression argParam = Expression.Parameter(typeof(PO), "s");
                Expression nameProperty = Expression.Property(argParam, "POID");
                Expression namespaceProperty = Expression.Property(argParam, "SupplierMasterID");

                var val1 = Expression.Constant(txtSearchBox.Text);
                var val2 = Expression.Constant(txtSearchBox.Text);
                //expresttion 1 
                Expression e1 = Expression.Call(nameProperty, "Contains", null, val1);
                // expresstion 2
                Expression e2 = Expression.Call(namespaceProperty, "Contains", null, val2);
                var andExp = Expression.Or(e1, e2);


                // get expresttion to labda objet 
                var lambda1 = Expression.Lambda<Func<PO, bool>>(andExp, argParam);
                // pass object to query 
                var selected = from item in _PORepo.SearchFor(lambda1).ToList() select new { item.POID, item.SupplierName, item.Date };

                //check is record exist in selected item
                if (selected.Count() > 0)
                {
                    grdPOSearch.Show();
                    btnClose.Show();

                    grdPOSearch.DataSource = selected;
                }
                else
                {
                    grdPOSearch.DataSource = null;
                }

              
            }
            catch (Exception ex)
            {


            }

        }
Пример #4
0
        private void SearchOperation()
        {

            try
            {

                GenaricRepository<OperationPool> _OperationRepository = new GenaricRepository<OperationPool>(new ItrackContext());
                //create expression 
                 ParameterExpression argParam = Expression.Parameter(typeof(OperationPool), "s");
                Expression nameProperty = Expression.Property(argParam, "OperationPoolID");
                Expression namespaceProperty = Expression.Property(argParam, "OpationName");

              var val1 = Expression.Constant(txtOperationNo.Text);
                var val2 = Expression.Constant(txtOName.Text);
                //expresttion 1 
                Expression e1 = Expression.Call(nameProperty, "Contains", null, val1);
                // expresstion 2
                Expression e2 = Expression.Call(namespaceProperty, "Contains", null, val2);

                if (chkAnd.Checked == true) {
                    var andExp = Expression.And(e1, e2);

                    // get expresttion to labda objet 
                    var lambda1 = Expression.Lambda<Func<OperationPool, bool>>(andExp, argParam);
                    // pass object to query 
                    var selected = from item in _OperationRepository.SearchFor(lambda1).ToList() select new { item.OperationPoolID, item.OpationName, item.SMV, item.SMVType, item.PartName, item.MachineType };
                    lst.Clear();

                    foreach (var op in selected)
                    {

                        lst.Add(new OperationListSelection(op.OperationPoolID, op.OpationName, op.SMV, 0, false, op.SMVType, op.PartName, "None", op.MachineType));


                    }
                }
                else if (chkOr.Checked == true) {

                    var andExp = Expression.Or(e1, e2);

                    // get expresttion to labda objet 
                    var lambda1 = Expression.Lambda<Func<OperationPool, bool>>(andExp, argParam);
                    // pass object to query 
                    var selected = from item in _OperationRepository.SearchFor(lambda1).ToList() select new { item.OperationPoolID, item.OpationName, item.SMV, item.SMVType, item.PartName, item.MachineType };
                    lst.Clear();

                    foreach (var op in selected)
                    {

                        lst.Add(new OperationListSelection(op.OperationPoolID, op.OpationName, op.SMV, 0, false, op.SMVType, op.PartName, "None", op.MachineType));


                    }
                }
               
               

                
                
                
                
                //check is record exist in selected item
                if (lst.Count() > 0)
                {
                    grdOpList.Show();


                    grdOpList.DataSource = lst;
                    grdOpList.RefreshDataSource();
                }
                else
                {
                    grdOpList.DataSource = null;
                }


               




            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message, "Error - B-0007", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
Пример #5
0
        private void SearchItemType()
        
        {
             try

            {

              GenaricRepository<CustomeFieldSetup> _CustomFieldRepo = new GenaricRepository<CustomeFieldSetup>(new ItrackContext());
                //create expression 
                ParameterExpression argParam = Expression.Parameter(typeof(CustomeFieldSetup), "s");
                Expression nameProperty = Expression.Property(argParam, "ItemType");
                Expression namespaceProperty = Expression.Property(argParam, "CustomField1");

                var val1 = Expression.Constant(txtItemType.Text);
                var val2 = Expression.Constant(txtItemType.Text);
                //expresttion 1 
                Expression e1 = Expression.Call(nameProperty, "Contains", null, val1);
                // expresstion 2
                Expression e2 = Expression.Call(namespaceProperty, "Contains", null, val2);
                var andExp = Expression.Or(e1, e2);


                // get expresttion to labda objet 
                var lambda1 = Expression.Lambda<Func<CustomeFieldSetup, bool>>(andExp, argParam);
                // pass object to query 
                var selected = from item in _CustomFieldRepo.SearchFor(lambda1).ToList() select new {item.CustomeFieldSetupID ,item.ItemType };

                //check is record exist in selected item
                if (selected.Count() > 0)
                {
                    grdSearchItemType.Show();
                    btnClose.Show();

                    grdSearchItemType.DataSource = selected;
                }
                else
                {
                    grdSearchItemType.DataSource = null;
                }


            }
            catch (Exception ex)
            {


            }

        }
Пример #6
0
        //Search Items
        private void SearchItem()
        {
          try

            {

                splashScreenManager1.ShowWaitForm();
                GenaricRepository<Items> _ItemMasterRepo = new GenaricRepository<Items>(new ItrackContext());
                //create expression 
                ParameterExpression argParam = Expression.Parameter(typeof(Items), "s");
                Expression nameProperty = Expression.Property(argParam, "ItemsID");
                Expression namespaceProperty = Expression.Property(argParam, "CustomFiled1");

                var val1 = Expression.Constant(txtSearchBox.Text);
                var val2 = Expression.Constant(txtSearchBox.Text);
                //expresttion 1 
                Expression e1 = Expression.Call(nameProperty, "Contains", null, val1);
                // expresstion 2
                Expression e2 = Expression.Call(namespaceProperty, "Contains", null, val2);
                var andExp = Expression.Or(e1, e2);


                // get expresttion to labda objet 
                var lambda1 = Expression.Lambda<Func<Items, bool>>(andExp, argParam);
                // pass object to query 
                var selected = from item in _ItemMasterRepo.SearchFor(lambda1).ToList() select new { item.ItemsID,item.ItemType,item.CustomFiled1,item.CustomField2 };

                //check is record exist in selected item
                if (selected.Count() > 0)
                {
                    grdSearch.Show();
                    btnClose.Show();

                    grdSearch.DataSource = selected;
                }
                else
                {
                    grdSearch.DataSource = null;
                }

                splashScreenManager1.CloseWaitForm();
            }
           catch(Exception ex)
            {


            }

        }
Пример #7
0
        private void SearchCompany()
        {
            try
            {
                splashScreenManager1.ShowWaitForm();
                GenaricRepository<Company> _genaricrepositorycompany = new GenaricRepository<Company>(new ItrackContext());
                //create expression 
                ParameterExpression argParam = Expression.Parameter(typeof(Company), "s");
                Expression nameProperty = Expression.Property(argParam, "CompanyName");
                Expression namespaceProperty = Expression.Property(argParam, "CompanyName");

                var val1 = Expression.Constant(txtSearchBox.Text);
                var val2 = Expression.Constant(txtSearchBox.Text);
                //expresttion 1 
                Expression e1 = Expression.Call(nameProperty, "Contains", null, val1);
                // expresstion 2
                Expression e2 = Expression.Call(namespaceProperty, "Contains", null, val2);
                var andExp = Expression.Or(e1, e2);


                // get expresttion to labda objet 
                var lambda1 = Expression.Lambda<Func<Company, bool>>(andExp, argParam);
                // pass object to query 
                var selected = from item in _genaricrepositorycompany.SearchFor(lambda1).ToList() select new { item.CompanyID, item.CompanyName, item.CompanyAddress };

                //check is record exist in selected item
                if (selected.Count() > 0)
                {
                    grdCompany.Show();
                    btnClose.Show();

                    grdCompany.DataSource = selected;
                }
                else
                {
                    grdCompany.DataSource = null;
                }

                splashScreenManager1.CloseWaitForm();
            }
            catch (Exception ex)
            {


            }

        }