[Test] // .ctor (String)
		public void Constructor2 ()
		{
			DBConcurrencyException dbce;
			string msg = "MONO";

			dbce = new DBConcurrencyException (msg);
			Assert.IsNull (dbce.InnerException, "#A:InnerException");
			Assert.AreSame (msg, dbce.Message, "#A:Message:" + dbce.Message);
			Assert.IsNull (dbce.Row, "#A:Row");
			Assert.AreEqual (0, dbce.RowCount, "#A:RowCount");

			dbce = new DBConcurrencyException ((string) null);
			Assert.IsNull (dbce.InnerException, "#B:InnerException");
			Assert.IsNotNull (dbce.Message, "#B:Message1");
			Assert.IsTrue (dbce.Message.IndexOf (typeof (DBConcurrencyException).FullName) != -1, "#B:Message2:" + dbce.Message);
			Assert.IsNull (dbce.Row, "#B:Row");

			Assert.AreEqual (0, dbce.RowCount, "#B:RowCount");

			dbce = new DBConcurrencyException (string.Empty);
			Assert.IsNull (dbce.InnerException, "#C:InnerException");
			Assert.AreEqual (string.Empty, dbce.Message, "#C:Message");
			Assert.IsNull (dbce.Row, "#C:Row");
			Assert.AreEqual (0, dbce.RowCount, "#C:RowCount");
		}
		[Test] // .ctor ()
		public void Constructor1 ()
		{
			DBConcurrencyException dbce = new DBConcurrencyException ();
			Assert.IsNull (dbce.InnerException, "InnerException");
			Assert.IsNotNull (dbce.Message, "Message1");
			Assert.IsNotNull (dbce.Message, "Message2:" + dbce.Message);
			Assert.IsNull (dbce.Row, "Row");
			Assert.AreEqual (0, dbce.RowCount, "RowCount");
		}
		[Test] // .ctor ()
		public void Constructor1 ()
		{
			DBConcurrencyException dbce = new DBConcurrencyException ();
			Assert.IsNull (dbce.InnerException, "InnerException");
			Assert.IsNotNull (dbce.Message, "Message1");
#if NET_2_0
			Assert.IsNotNull (dbce.Message, "Message2:" + dbce.Message);
#else
			Assert.AreEqual (new SystemException ().Message, dbce.Message, "Message2:" + dbce.Message);
#endif
			Assert.IsNull (dbce.Row, "Row");
#if NET_2_0
			Assert.AreEqual (0, dbce.RowCount, "RowCount");
#endif
		}
 private void EPDataGrid_RowDeleted(object sender, DataRowChangeEventArgs e)
 {
     try
     {
         if (_query != null && _query.Adapter != null)
         {
             _query.Adapter.Update(_query);
         }
     }
     catch (System.Data.DBConcurrencyException)
     {
         Requery();
     }
     catch (Exception er)
     {
         System.Data.DBConcurrencyException err = er as System.Data.DBConcurrencyException;
         if (err != null)
         {
         }
         FormLog.NotifyException(er);
     }
 }
		[Test] // .ctor (String, Exception)
		public void Constructor3 ()
		{
			Exception inner = new Exception ();
			DBConcurrencyException dbce;
			string msg = "MONO";

			dbce = new DBConcurrencyException (msg, inner);
			Assert.AreSame (inner, dbce.InnerException, "#A:InnerException");
			Assert.AreSame (msg, dbce.Message, "#A:Message:" + dbce.Message);
			Assert.IsNull (dbce.Row, "#A:Row");
			Assert.AreEqual (0, dbce.RowCount, "#A:RowCount");

			dbce = new DBConcurrencyException ((string) null, inner);
			Assert.AreSame (inner, dbce.InnerException, "#B:InnerException");
			Assert.IsTrue (dbce.Message.IndexOf (typeof (DBConcurrencyException).FullName) != -1, "#B:Message:" + dbce.Message);
			Assert.IsNull (dbce.Row, "#B:Row");
			Assert.AreEqual (0, dbce.RowCount, "#B:RowCount");

			dbce = new DBConcurrencyException (string.Empty, inner);
			Assert.AreSame (inner, dbce.InnerException, "#C:InnerException");
			Assert.AreEqual (string.Empty, dbce.Message, "#C:Message");
			Assert.IsNull (dbce.Row, "#C:Row");
			Assert.AreEqual (0, dbce.RowCount, "#C:RowCount");

			dbce = new DBConcurrencyException (msg, (Exception) null);
			Assert.IsNull (dbce.InnerException, "#D:InnerException");
			Assert.AreSame (msg, dbce.Message, "#D:Message:" + dbce.Message);
			Assert.IsNull (dbce.Row, "#D:Row");
			Assert.AreEqual (0, dbce.RowCount, "#D:RowCount");

			dbce = new DBConcurrencyException ((string) null, (Exception) null);
			Assert.IsNull (dbce.InnerException, "#E:InnerException");
			Assert.IsTrue (dbce.Message.IndexOf (typeof (DBConcurrencyException).FullName) != -1, "#E:Message:" + dbce.Message);
			Assert.IsNull (dbce.Row, "#E:Row");
			Assert.AreEqual (0, dbce.RowCount, "#E:RowCount");
		}
 // ���������� ���������� ��������, ���� �������� Insert, Update, Delete ������� 0 ������������ �����
 private static void HandleDBConcurrencyException(DBConcurrencyException dBConcurrencyException)
 {
     ShowExceptionDialog(dBConcurrencyException, "���������� ��������� �������� ��� ��� ��� ������ ���� �������������� ����� ����������� ��������������. �������� ���������� ���� ��� �������� ��������� ������ ������ � ��������� ������� �����������.", "����������� ���� ������ ��������", MessageBoxIcon.Information, true);
 }
		public void Row ()
		{
			DataTable dt = new DataTable ();
			DataRow rowA = dt.NewRow ();
			DataRow rowB = dt.NewRow ();

			DBConcurrencyException dbce = new DBConcurrencyException ();
			dbce.Row = rowA;
			Assert.AreSame (rowA, dbce.Row, "#A:Row");
			Assert.AreEqual (1, dbce.RowCount, "#A:RowCount");
			dbce.Row = rowB;
			Assert.AreSame (rowB, dbce.Row, "#B:Row");
			Assert.AreEqual (1, dbce.RowCount, "#B:RowCount");
			dbce.Row = null;
			Assert.IsNull (dbce.Row, "#C:Row");
			Assert.AreEqual (1, dbce.RowCount, "#C:RowCount");
		}
		[Test] // .ctor (String, Exception, DataRow [])
		public void Constructor4 ()
		{
			DataTable dt = new DataTable ();
			DataRow rowA = dt.NewRow ();
			DataRow rowB = dt.NewRow ();
			DataRow [] rows;
			Exception inner = new Exception ();
			DBConcurrencyException dbce;
			string msg = "MONO";

			rows = new DataRow [] { rowA, null, rowB };
			dbce = new DBConcurrencyException (msg, inner, rows);
			Assert.AreSame (inner, dbce.InnerException, "#A:InnerException");
			Assert.AreSame (msg, dbce.Message, "#A:Message:" + dbce.Message);
			Assert.AreSame (rowA, dbce.Row, "#A:Row");
			Assert.AreEqual (3, dbce.RowCount, "#A:RowCount");

			rows = new DataRow [] { rowB, rowA, null };
			dbce = new DBConcurrencyException ((string) null, inner, rows);
			Assert.AreSame (inner, dbce.InnerException, "#B:InnerException");
			Assert.IsTrue (dbce.Message.IndexOf (typeof (DBConcurrencyException).FullName) != -1, "#B:Message:" + dbce.Message);
			Assert.AreSame (rowB, dbce.Row, "#B:Row");
			Assert.AreEqual (3, dbce.RowCount, "#B:RowCount");

			rows = new DataRow [] { null, rowA };
			dbce = new DBConcurrencyException (string.Empty, inner, rows);
			Assert.AreSame (inner, dbce.InnerException, "#C:InnerException");
			Assert.AreEqual (string.Empty, dbce.Message, "#C:Message");
			Assert.IsNull (dbce.Row, "#C:Row");
			Assert.AreEqual (2, dbce.RowCount, "#C:RowCount");

			rows = new DataRow [] { rowA };
			dbce = new DBConcurrencyException (msg, (Exception) null, rows);
			Assert.IsNull (dbce.InnerException, "#D:InnerException");
			Assert.AreSame (msg, dbce.Message, "#D:Message:" + dbce.Message);
			Assert.AreSame (rowA, dbce.Row, "#D:Row");
			Assert.AreEqual (1, dbce.RowCount, "#D:RowCount");

			rows = null;
			dbce = new DBConcurrencyException (msg, (Exception) null, rows);
			Assert.IsNull (dbce.InnerException, "#E:InnerException");
			Assert.AreSame (msg, dbce.Message, "#E:Message:" + dbce.Message);
			Assert.IsNull (dbce.Row, "#E:Row");
			Assert.AreEqual (0, dbce.RowCount, "#E:RowCount");

			rows = null;
			dbce = new DBConcurrencyException ((string) null, (Exception) null, rows);
			Assert.IsNull (dbce.InnerException, "#F:InnerException");
			Assert.IsTrue (dbce.Message.IndexOf (typeof (DBConcurrencyException).FullName) != -1, "#F:Message:" + dbce.Message);
			Assert.IsNull (dbce.Row, "#F:Row");
			Assert.AreEqual (0, dbce.RowCount, "#F:RowCount");
		}
        internal static Exception UpdateConcurrencyViolation(StatementType statementType, int affected, int expected, DataRow[] dataRows)
        {
            string str;
            switch (statementType)
            {
                case StatementType.Update:
                    str = "ADP_UpdateConcurrencyViolation_Update";
                    break;

                case StatementType.Delete:
                    str = "ADP_UpdateConcurrencyViolation_Delete";
                    break;

                case StatementType.Batch:
                    str = "ADP_UpdateConcurrencyViolation_Batch";
                    break;

                default:
                    throw InvalidStatementType(statementType);
            }
            DBConcurrencyException e = new DBConcurrencyException(System.Data.Res.GetString(str, new object[] { affected.ToString(CultureInfo.InvariantCulture), expected.ToString(CultureInfo.InvariantCulture) }), null, dataRows);
            TraceExceptionAsReturnValue(e);
            return e;
        }
Beispiel #10
0
        private void onInvoiceDetailDBCError(DBConcurrencyException dbcx)
        {
            MDataSet.InvoiceDetailRow _invoiceDetailRow = dbcx.Row as MDataSet.InvoiceDetailRow;

            MDataSet.InvoiceDetailDataTable _invoiceDetailDataTable = new MDataSet.InvoiceDetailDataTable();
            if (_invoiceDetailRow.RowState == DataRowState.Deleted)
            {
                int _id = Convert.ToInt32(_invoiceDetailRow["ID", DataRowVersion.Original].ToString());

                this.invoiceDetailTableAdapter.FillById(_invoiceDetailDataTable, _id);

            }


            else
            {
               this.invoiceDetailTableAdapter.FillById(_invoiceDetailDataTable, (dbcx.Row as MDataSet.InvoiceDetailRow).ID);
           
             }
           
                     
            {   _invoiceDetailRow.ClearErrors();
                this.mDataSet.InvoiceDetail.Merge(_invoiceDetailDataTable, true);
          
            }

            MainForm.Log(" onInvoiceDetailDBCError " + "успешно");
        }
Beispiel #11
0
        private bool onInvoiceMasterDBCError(DBConcurrencyException dbcx)
        {
            try
            {
                MDataSet.InvoiceMasterDataTable _tmpTable = new MDataSet.InvoiceMasterDataTable();

               
                    this.invoiceMasterTableAdapter.FillByPeriodNum(_tmpTable, 0);
                
                    this.mDataSet.InvoiceMaster.Merge(_tmpTable, true);

                    this.invoiceMasterTableAdapter.Update(this.mDataSet.InvoiceMaster);
            }
            catch (Exception err)
            {
                MainForm.Log("onInvoiceMasterDBCError"+ err.Message);
                return false;
            }

            return true;

        }
Beispiel #12
0
 private void onReceiptMasterDBCError(DBConcurrencyException dbcx)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Beispiel #13
0
        //----------  Error   

        private void onDirectoryDBCError(DBConcurrencyException dbcx)
        {
            throw new Exception("The method or operation is not implemented.");
        }
Beispiel #14
0
        private void onInvoiceMasterDBCError(DBConcurrencyException dbcx)
        {
            if (this.RefreshData(dbcx.Row as MDataSet.InvoiceMasterRow))
                MessageBox.Show("Запись была изменена пользователем :" + (dbcx.Row as MDataSet.InvoiceMasterRow).AuthorLastModif,"Ошибка совмесного доступа",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);

        }
Beispiel #15
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);
          
            }
        }
Beispiel #16
0
        private void onReceiptMasterDBCError(DBConcurrencyException dbcx)
        {
            try
            {
                MDataSet.ReceiptMasterDataTable _tmp = new MDataSet.ReceiptMasterDataTable();


                this.receiptMasterTableAdapter.FillByPeriodNum(_tmp, 0);
                this.mDataSet.ReceiptMaster.Merge(_tmp);

                dbcx.Row.RowError = "";

            }
            catch (Exception err)

            {
                MessageBox.Show(err.Message);

                MainForm.Log("onReceiptMasterDBCError" + err.Message);
            }

        }