Esempio n. 1
0
        public bool FillTableStockDocuments(MDataSet.InvoiceMasterDataTable source, int numPeriods)
        {

            MDataSet.InvoiceMasterDataTable _tmpMaster = new MDataSet.InvoiceMasterDataTable();
            MDataSet.InvoiceDetailDataTable _tmpDetail = new MDataSet.InvoiceDetailDataTable();
            MDataSet.RemainsDataTable _rem = new MDataSet.RemainsDataTable();
            MDataSet.ProductDataTable _prod = new MDataSet.ProductDataTable();
         
            
            try
            {
                this.invoiceMasterTableAdapter.FillByPeriodNum(_tmpMaster, numPeriods);
                
                this.mDataSet.InvoiceMaster.Merge(_tmpMaster);

                foreach (MDataSet.InvoiceMasterRow mr in  _tmpMaster)
                {
                    this.invoiceDetailTableAdapter.FillByInvoiceMasterRef(_tmpDetail, mr.ID);
                   

                    this.RemainsTableAdapter.FillByInvoiceMasterID(_rem, mr.ID);
                   
                    foreach (MDataSet.RemainsRow _remrow in _rem)
                    {
                        if (_remrow.ProductRow == null)
                        {
                            this.productTableAdapter.FillById(_prod, _remrow.ProductRef);
                            this.mDataSet.Product.Merge(_prod);
                        }

                       
                    } 
                    this.mDataSet.Remains.Merge(_rem);
                    this.mDataSet.InvoiceDetail.Merge(_tmpDetail);
                }
             
            }
            catch (SqlException sqlerr)
            {
                if (sqlerr.Class < 17)
                {
                    MessageBox.Show(sqlerr.Message);
                }
                else

                    caughtGlobalError(sqlerr);

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



        }
Esempio n. 2
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;
        }
Esempio n. 3
0
        public bool RefreshData(MDataSet.ProductDataTable dataTable, int id)
        {
            MDataSet.ProductDataTable _ProductDataTable = new MDataSet.ProductDataTable();

            try
            {
                this.productTableAdapter.FillById(_ProductDataTable,id);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);

                Log("(RefreshData(MDataSet.ProductDataTable dataTable, int id)" + err.Message + " " + err.Source + err.InnerException.Message);

                return false;
            }
            finally
            {
                this.mDataSet.Product.Merge(_ProductDataTable);
            }
            return true;

        
        
        }