Ejemplo n.º 1
0
        public bool RefreshData(MDataSet.InvoiceDetailRow sourceRow)
        {
            MDataSet.InvoiceDetailDataTable  _invoiceDetailDataTable = new MDataSet.InvoiceDetailDataTable();

            try
            {
                this.invoiceDetailTableAdapter.FillNew(_invoiceDetailDataTable);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                Log("RefreshData (MDataSet.InvoiceDetailRow sourceRow) "  + err.Message + " " + err.Source + err.InnerException.Message);  
  
                return false;
            }
            finally
            {
                this.mDataSet.InvoiceDetail.Merge(_invoiceDetailDataTable, true);
            }
            return true;
             
        }
Ejemplo n.º 2
0
        public bool RefreshData(MDataSet.InvoiceMasterRow sourceRow) 
        {
            if (sourceRow == null) return false;

           MDataSet.InvoiceMasterDataTable _invoiceMasterDataTable=new MDataSet.InvoiceMasterDataTable();
           MDataSet.InvoiceDetailDataTable _invoiceDetailDataTable = new MDataSet.InvoiceDetailDataTable();
           MDataSet.RemainsDataTable _remainsDataTable = new MDataSet.RemainsDataTable();

            try
             {


               this.RemainsTableAdapter.FillByInvoiceMasterID(_remainsDataTable, sourceRow.ID);
               this.invoiceMasterTableAdapter.FillNew(_invoiceMasterDataTable);
               this.invoiceDetailTableAdapter.FillByInvoiceMasterRef(_invoiceDetailDataTable,sourceRow.ID);

              
             }
             catch (Exception err)
             {
                 MessageBox.Show(err.Message);
                 Log("RefreshData(MDataSet.InvoiceMasterRow sourceRow) " + err.Message + " " + err.Source);  
  
                 return false;
             }
             finally
             {
                  this.mDataSet.Remains.Merge(_remainsDataTable);
                  this.mDataSet.InvoiceMaster.Merge(_invoiceMasterDataTable);
                  this.mDataSet.InvoiceDetail.Merge(_invoiceDetailDataTable); 
            

            }
            return true;

        }
Ejemplo n.º 3
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;



        }
Ejemplo n.º 4
0
        public bool FillTableStockDocuments(MDataSet.InvoiceMasterDataTable source, DateTime begin)
        {
            MDataSet.InvoiceMasterDataTable _tmpMaster = new MDataSet.InvoiceMasterDataTable();
            MDataSet.InvoiceDetailDataTable _tmpDetail = new MDataSet.InvoiceDetailDataTable();




            try
            {
                this.invoiceMasterTableAdapter.FillByPeriod(_tmpMaster, begin);
                this.invoiceDetailTableAdapter.FillByPeriod(_tmpDetail, begin);

            }

            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 + err.InnerException.Message);  
  
                return false;
            }
            finally
            {
                this.mDataSet.InvoiceMaster.Merge(_tmpMaster);
                this.mDataSet.InvoiceDetail.Merge(_tmpDetail);

            }
            return true;



        }
Ejemplo n.º 5
0
        public bool FillTableNewDocuments(MDataSet.InvoiceMasterDataTable source)
        {
            MDataSet.InvoiceMasterDataTable _tmpMaster = new MDataSet.InvoiceMasterDataTable();
            MDataSet.InvoiceDetailDataTable _tmpDetail = new MDataSet.InvoiceDetailDataTable();
            MDataSet.RemainsDataTable _tmpRemains = new MDataSet.RemainsDataTable();

            try
            {
                this.RemainsTableAdapter.Fill(_tmpRemains);
         
                this.invoiceMasterTableAdapter.Fill(_tmpMaster);
                this.invoiceDetailTableAdapter.Fill(_tmpDetail);

            }

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

                    caughtGlobalError(sqlerr);

                Log("FillTableNewDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message);  
  

                return false;
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);

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

                return false;
            }
            finally
            {
                this.mDataSet.Remains.Merge(_tmpRemains);
                this.mDataSet.InvoiceMaster.Merge(_tmpMaster);
                this.mDataSet.InvoiceDetail.Merge(_tmpDetail);

            }
            return true;
       

        
        }
Ejemplo n.º 6
0
        private void onInvoiceDetailDBCError(DBConcurrencyException dbcx)
        {
            MDataSet.InvoiceDetailRow _invoiceDetailRow = dbcx.Row as MDataSet.InvoiceDetailRow;


            MDataSet.InvoiceDetailDataTable _invoiceDetailDataTable = new MDataSet.InvoiceDetailDataTable();

            this.invoiceDetailTableAdapter.FillById(_invoiceDetailDataTable, (dbcx.Row as MDataSet.InvoiceDetailRow).ID);

            MDataSet.InvoiceDetailRow rowInDB = (_invoiceDetailDataTable.Rows[0] as MDataSet.InvoiceDetailRow);

            /*Сравнить изменения*/

            if (( Convert.ToDecimal(_invoiceDetailRow["Quantity", DataRowVersion.Original] )!= rowInDB.Quantity) |
                (Convert.ToDecimal(_invoiceDetailRow["PriceRetailNDS", DataRowVersion.Original]) != rowInDB.PriceRetailNDS))
            {
                /*** Отменить **/
                string strInDB = "Запись была изменена пользователем: \n";

                string strMessage;

                strInDB += rowInDB.AuthorLastModif.ToString() + "\n";

                strMessage = strInDB + "\n";
                MessageBox.Show(strMessage + "Изменения отменены ", "Ошибка совмесного доступа",
                MessageBoxButtons.OK,MessageBoxIcon.Warning);
                this.mDataSet.InvoiceDetail.Merge(_invoiceDetailDataTable);
            }
            else
            {   _invoiceDetailRow.ClearErrors();
                this.mDataSet.InvoiceDetail.Merge(_invoiceDetailDataTable, true);
          
            }
        }