public List <PurchaseProductTypeProperty> Search(PurchaseProductTypeProperty dataItem)
        {
            List <PurchaseProductTypeProperty> _result = new List <PurchaseProductTypeProperty>();

            try
            {
                _resultData = _models.Search(dataItem);
                if (_resultData.StatusOnDb == true)
                {
                    if (_resultData.ResultOnDb.Rows.Count > 0)
                    {
                        for (int i = 0; i < _resultData.ResultOnDb.Rows.Count; i++)
                        {
                            PurchaseProductTypeProperty _purchaseProductTypeProperty = new PurchaseProductTypeProperty
                            {
                                PRODUCT_TYPE = new ProductTypeProperty
                                {
                                    PRODUCT_SUB_CODE = _resultData.ResultOnDb.Rows[i]["PRODUCT_SUB_CODE"].ToString(),
                                    PRODUCT_TITLE    = _resultData.ResultOnDb.Rows[i]["PRODUCT_TITLE"].ToString(),
                                },
                                PURCHASE = new PurchaseProperty
                                {
                                    ID          = _resultData.ResultOnDb.Rows[i]["PURCHASE_ID"].ToString(),
                                    PURCHASE_NO = _resultData.ResultOnDb.Rows[i]["PURCHASE_NO"].ToString(),
                                },
                                MODEL = new ModelProperty
                                {
                                    MODEL_NO = _resultData.ResultOnDb.Rows[i]["MODEL_NO"].ToString(),
                                },
                                PART_NO = new PartNoProperty
                                {
                                    PART_NO = _resultData.ResultOnDb.Rows[i]["PART_NO"].ToString(),
                                },
                                PURCHASE_FFTCODE = new PurchaseFftCodeProperty
                                {
                                    FFT_CODE = new FftCodeProperty
                                    {
                                        FFT_CODE = _resultData.ResultOnDb.Rows[i]["FFT_CODE"].ToString(),
                                    }
                                }
                            };
                            _result.Add(_purchaseProductTypeProperty);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(_result);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(_result);
            }
        }
Esempio n. 2
0
        public string Search(PurchaseProductTypeProperty dataItem)
        {
            sql = @"SELECT tb_2.ID as PURCHASE_ID ,
                            tb_2.PURCHASE_NO ,
                            tb_3.PRODUCT_SUB_CODE ,
                            tb_3.PRODUCT_TITLE ,
                            tb_4.PART_NO ,
                            tb_5.MODEL_NO ,
                            tb_7.FFT_CODE 
                            from purchase_product_type tb_1 inner join purchase tb_2 on tb_1.PURCHASE_ID = tb_2.ID inner join product_type tb_3 on tb_1.PRODUCT_TYPE_ID = tb_3.ID  
                            inner join part_no tb_4 on tb_4.ID = tb_2.PART_NO_ID 
                            inner join model tb_5 on tb_5.ID = tb_2.MODEL_ID  
                            inner join purchase_fft_code tb_6 on tb_2.ID = tb_6.PURCHASE_ID 
                            inner join fft_code tb_7 on tb_6.FFT_CODE_ID = tb_7.ID 
                            where tb_3.PRODUCT_SUB_CODE ='dataItem.PRODUCT_TYPE.PRODUCT_SUB_CODE'";

            sql = sql.Replace("dataItem.PRODUCT_TYPE.PRODUCT_SUB_CODE", dataItem.PRODUCT_TYPE.PRODUCT_SUB_CODE);

            return(sql);
        }
Esempio n. 3
0
 public OutputOnDbProperty Search(PurchaseProductTypeProperty dataItem)
 {
     _resultData = _services.Search(dataItem);
     return(_resultData);
 }