Exemplo n.º 1
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);
          
            }
        }
Exemplo n.º 2
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;



        }
Exemplo n.º 3
0
        public bool RefreshData(MDataSet.InvoiceDetailRow sourceRow)
        {
            MDataSet.InvoiceDetailDataTable  _invoiceDetailDataTable = new MDataSet.InvoiceDetailDataTable();

            try
            {
                this.invoiceDetailTableAdapter.FillByInvoiceMasterRef(_invoiceDetailDataTable,sourceRow.InvoiceMasterRef);
            }
            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;
             
        }