예제 #1
0
        /*FillNew + Merge + FillDetailsById*/
        public bool RefreshData(MDataSet.ReceiptMasterRow sourceRow) 
        {
            MDataSet.ReceiptMasterDataTable _ReceiptMasterDataTable = new MDataSet.ReceiptMasterDataTable();
            MDataSet.ReceiptDetailDataTable _ReceiptDetailDataTable = new MDataSet.ReceiptDetailDataTable();
          MDataSet.ProductDataTable _productDataTable = new MDataSet.ProductDataTable();
           

            
            try
            {  this.receiptMasterTableAdapter.FillNew(_ReceiptMasterDataTable);

                this.receiptDetailTableAdapter.FillByReceiptMasterRef(_ReceiptDetailDataTable, sourceRow.ID);
                foreach (MDataSet.ReceiptDetailRow detrow in _ReceiptDetailDataTable)
                {
                    if (detrow.ProductRow == null)
                    {


                        this.productTableAdapter.FillById(_productDataTable,detrow.ProductRef);
              
                    
                    
                    }

                    this.mDataSet.Product.Merge(_productDataTable);
                
                }



            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                Log("RefreshData(MDataSet.ReceiptMasterRow sourceRow)  ERROR" + err.Message + " " + err.Source + err.InnerException.Message);  
  
                return false;
            }
            finally
            {
                this.mDataSet.ReceiptMaster.Merge(_ReceiptMasterDataTable);
                this.mDataSet.ReceiptDetail.Merge(_ReceiptDetailDataTable);
                this.mDataSet.ReceiptMaster.AcceptChanges();
                this.mDataSet.ReceiptDetail.AcceptChanges();
            }
            return true;
        }
예제 #2
0
        /*MDataset, документы на складе, из открытого периода, новые, X дней*/
        public bool FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source,DateTime begin)
        {
            MDataSet.ReceiptMasterDataTable _tmpMaster = new MDataSet.ReceiptMasterDataTable();
            MDataSet.ReceiptDetailDataTable _tmpDetail = new MDataSet.ReceiptDetailDataTable();

            


            try
            {
                this.receiptMasterTableAdapter.FillByPeriod(_tmpMaster,begin);
                this.receiptDetailTableAdapter.FillByPeriod(_tmpDetail,begin);

            }

            catch (SqlException sqlerr)
            {
                if (sqlerr.Class < 17)
                {
                    MessageBox.Show(sqlerr.Message);
                }
                else

                    caughtGlobalError(sqlerr);


                Log("FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message);  
  
                return false;
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);

                Log("FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + err.Message + " " + err.Source +err.InnerException.Message);  
  

                return false;
            }
            finally
            {
                this.mDataSet.ReceiptMaster.Merge(_tmpMaster);
                this.mDataSet.ReceiptDetail.Merge(_tmpDetail);

            }
            return true;



        }