public void TestDeleteNotAllowed()
        {
            DataView TestView = new DataView(dataTable);

            TestView.AllowDelete = false;
            TestView.Delete(0);
        }
        public void RowStateFilter_2()
        {
            DataSet   dataset = new DataSet("new");
            DataTable dt      = new DataTable("table1");

            dataset.Tables.Add(dt);
            dt.Columns.Add("col1");
            dt.Columns.Add("col2");
            dt.Rows.Add(new object [] { 1, 1 });
            dt.Rows.Add(new object [] { 1, 2 });
            dt.Rows.Add(new object [] { 1, 3 });
            dataset.AcceptChanges();

            DataView dataView = new DataView(dataset.Tables [0]);

            // 'new'  table in this sample contains 6 records
            dataView.AllowEdit   = true;
            dataView.AllowDelete = true;
            string v;

            // Editing the row
            dataView [0] ["col1"]   = -1;
            dataView.RowStateFilter = DataViewRowState.ModifiedOriginal;
            v = dataView [0] [0].ToString();
            AssertEquals("ModifiedOriginal.Count", 1, dataView.Count);
            AssertEquals("ModifiedOriginal.Value", "1", v);

            // Deleting the row
            dataView.Delete(0);
            dataView.RowStateFilter = DataViewRowState.Deleted;

            v = dataView [0] [0].ToString();
            AssertEquals("Deleted.Count", 1, dataView.Count);
            AssertEquals("Deleted.Value", "1", v);
        }
Beispiel #3
0
 public void TestDeleteOutOfBounds()
 {
     Assert.Throws <IndexOutOfRangeException>(() =>
     {
         DataView TestView = new DataView(_dataTable);
         TestView.Delete(100);
     });
 }
Beispiel #4
0
 private void удалеиеЗаписиToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Вы действительно хотите удалить набор " + (currentRow + 1) + "?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
     {
         isChangesSaved = false;
         dv1.Delete(currentRow);
     }
 }
Beispiel #5
0
 /// <summary>
 ///     Deletes a record from the movie table by a composite primary key.
 /// </summary>
 public void Delete(string id)
 {
     _dataView.RowFilter = $"Id='{id}'";
     _dataView.Sort      = "Id";
     _dataView.Delete(0);
     _dataView.RowFilter = "";
     Save();
 }
Beispiel #6
0
 private void MN_SIL_Click(object sender, EventArgs e)
 {
     int[] GETROW = GRDW_HAKLARI.GetSelectedRows();
     for (int i = GETROW.Length - 1; i >= 0; i--)
     {
         dv_DAHIL_KULLANICILAR.Delete(Convert.ToUInt16(GETROW[i]));
     }
 }
Beispiel #7
0
 private void удалитьЗаписьToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Вы действительно хотите удалить информацию этого автора?", "Удаление данных", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
     {
         isChangesSaved = false;
         dv1.Delete(currentRow);
     }
 }
Beispiel #8
0
 /// <summary>
 /// Deletes a record from the Category table by a composite primary key.
 /// </summary>
 public static void Delete(string id)
 {
     dv.RowFilter = "id='" + id + "'";
     //dv.Sort = "id";
     dv.Delete(0);
     dv.RowFilter = "";
     save();
 }
Beispiel #9
0
 /// <summary>
 /// Deletes a record from the Category table by a composite primary key.
 /// </summary>
 public static void Delete(Guid guid)
 {
     dv.RowFilter = "guid='" + guid + "'";
     dv.Sort      = "guid";
     dv.Delete(0);
     dv.RowFilter = "";
     Save();
 }
        private void InitializeManualCode()
        {
            var SecurityPermissionRequired = new List <string>();

            SecurityPermissionRequired.Add(TSecurityChecks.SECURITYPERMISSION_FINANCEREPORTING);
            FPetraUtilsObject.ApplySecurity(SecurityPermissionRequired);

            // remove from the combobox all ledger numbers which the user does not have permission to access
            DataView cmbLedgerDataView = (DataView)cmbLedger.cmbCombobox.DataSource;

            for (int i = 0; i < cmbLedgerDataView.Count; i++)
            {
                string LedgerNumberStr;

                // postgresql
                if (cmbLedgerDataView[i].Row[0].GetType().Equals(typeof(int)))
                {
                    LedgerNumberStr = ((int)cmbLedgerDataView[i].Row[0]).ToString("0000");
                }
                else // sqlite
                {
                    LedgerNumberStr = ((Int64)cmbLedgerDataView[i].Row[0]).ToString("0000");
                }

                if (!UserInfo.GUserInfo.IsInModule("LEDGER" + LedgerNumberStr))
                {
                    cmbLedgerDataView.Delete(i);
                    i--;
                }
            }

            FPetraUtilsObject.SetStatusBarText(grdDetails, Catalog.GetString("Use the mouse or navigation keys to select a data row to view"));

            // set the currency code to be blank initially
            txtGiftTotal.CurrencyCode       = String.Empty;
            txtGiftTotal.NumberValueDecimal = 0.0m;

            lblRecordCounter.Text = "";
            pnlPostedOnlyNote.Top = 0;

            // correct the tab indexes
            int TabOrder = dtpDateFrom.TabIndex;

            dtpDateFrom.TabIndex  = txtRecipient.TabIndex;
            txtRecipient.TabIndex = TabOrder;

            cmbMotivationGroup.RemoveDescriptionLabel();
            cmbMotivationDetail.RemoveDescriptionLabel();

            // catch enter on all controls, to trigger search
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CatchEnterKey);

            // catch enter on grid to view the selected transaction
            this.grdDetails.EnterKeyPressed += new Ict.Common.Controls.TKeyPressedEventHandler(this.ViewTransaction);

            // focus on txtDonor
            this.ActiveControl = txtDonor;
        }
Beispiel #11
0
        public string GetComponent(string BuildingID, string Location_Renamed)
        {
            string str = Conversions.ToString(-1);

            try
            {
                this.dtComponents = mdUtility.DB.GetDataTable("SELECT System_Component.[SYS_COMP_ID], RO_Component.COMP_DESC FROM RO_Component INNER JOIN (Building_System INNER JOIN System_Component ON Building_System.[BLDG_SYS_ID] = System_Component.[SYS_COMP_BLDG_SYS_ID]) ON RO_Component.[COMP_ID] = System_Component.[SYS_COMP_COMP_LINK] WHERE (((System_Component.[SYS_COMP_ID]) Not In (SELECT [SYS_COMP_ID] FROM Components_by_location WHERE Components_by_location.[Facility_ID]={" + BuildingID + "} AND SAMP_DATA_LOC={" + Strings.Replace(mdUtility.fMainForm.tvInspection.GetNodeByKey(Location_Renamed).Tag.ToString(), "'", "''", 1, -1, CompareMethod.Binary) + "})) AND ((Building_System.[BLDG_SYS_BLDG_ID])={" + BuildingID + "}) AND ((System_Component.BRED_Status)<>'D' Or (System_Component.BRED_Status) Is Null)) ORDER BY RO_Component.COMP_DESC;");
                if (this.dtComponents.Rows.Count == 0)
                {
                    int num = (int)Interaction.MsgBox((object)"There are no components to attach.  Please switch\rto the inventory screen and add them.", MsgBoxStyle.OkOnly, (object)"Attach Components to Inspection");
                    str = Conversions.ToString(-1);
                }
                else
                {
                    UltraTreeNode nodeByKey = mdUtility.fMainForm.tvInspection.GetNodeByKey(Location_Renamed);
                    if (nodeByKey.Nodes.Count > 0)
                    {
                        UltraTreeNode ultraTreeNode = nodeByKey.Nodes[0];
                        int           count         = nodeByKey.Nodes.Count;
                        int           num           = 1;
                        while (num <= count)
                        {
                            if (ultraTreeNode.Tag != null)
                            {
                                DataView dataView = new DataView(this.dtComponents);
                                dataView.RowFilter = "[sys_comp_id]= '" + Strings.Replace(ultraTreeNode.Tag.ToString(), "'", "''", 1, -1, CompareMethod.Binary) + "'";
                                while (dataView.Count > 0)
                                {
                                    dataView.Delete(0);
                                }
                                ultraTreeNode = ultraTreeNode.GetSibling(NodePosition.Next);
                            }
                            checked { ++num; }
                        }
                    }
                    this.cboComponents.DisplayMember = "COMP_DESC";
                    this.cboComponents.ValueMember   = "SYS_COMP_ID";
                    this.cboComponents.DataSource    = (object)this.dtComponents;
                    if (this.cboComponents.Items.Count == 0)
                    {
                        int num = (int)Interaction.MsgBox((object)"There are no components to attach.  Please switch\rto the inventory screen and add them.", MsgBoxStyle.OkOnly, (object)"Attach Components to Inspection");
                        str = Conversions.ToString(-1);
                    }
                    else
                    {
                        int num = (int)this.ShowDialog();
                        str = !this.m_bUserCanceled ? this.m_strComponentID : Conversions.ToString(-1);
                    }
                }
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                mdUtility.Errorhandler(ex, nameof(frmAttachComponent), nameof(GetComponent));
                ProjectData.ClearProjectError();
            }
            return(str);
        }
Beispiel #12
0
 public void TestDeleteClosed()
 {
     Assert.Throws <IndexOutOfRangeException>(() =>
     {
         DataView TestView = new DataView(_dataTable);
         TestView.Dispose(); // Close the table
         TestView.Delete(0); // cannot access to item at 0.
     });
 }
Beispiel #13
0
        public void TestDelete()
        {
            DataView TestView = new DataView(dataTable);

            TestView.Delete(0);
            DataRow r = TestView.Table.Rows [0];

            Assertion.Assert("Dv #1", !((string)r ["itemId"] == "item 1"));
        }
Beispiel #14
0
 public void TestDeleteNotAllowed()
 {
     Assert.Throws <DataException>(() =>
     {
         DataView TestView    = new DataView(_dataTable);
         TestView.AllowDelete = false;
         TestView.Delete(0);
     });
 }
Beispiel #15
0
        /// <summary>
        /// Deletes a project records and decendents, Stages, Events, EventAttributes by tracing the
        /// Project record's children and grandchildren and deleteing from bottom to top.
        /// </summary>
        /// <param name="biz"></param>
        private static void DeleteAProjectRecord(Project project)
        {
            //if (project.RecordCount > 0)
            if (!project.IsEmpty)
            {
                int projectId = int.Parse(project[project.PrimaryKeyName].ToString());
                //ProjectStage stages = new ProjectStage();
                //stages.GetByParent(projectId);
                DataView   stages    = BusinessObject.GetByParentAsDataView <ProjectStage>(projectId);
                List <int> stageList = new List <int>();
                foreach (DataRow stageRecord in stages.Table.Rows)
                {
                    int stageId = int.Parse(stageRecord[ProjectStage.StageId].ToString());
                    //ProjectStageEvent events = new ProjectStageEvent();
                    //events.GetByParent(stageId);
                    DataView   events    = BusinessObject.GetByParentAsDataView <ProjectStageEvent>(stageId);
                    List <int> eventList = new List <int>();
                    foreach (DataRow eventRecord in events.Table.Rows)
                    {
                        int eventId = int.Parse(eventRecord[ProjectStageEvent.StageEventId].ToString());
                        //ProjectEventAttribute eventAttributes = new ProjectEventAttribute();
                        //eventAttributes.GetByParent(eventId);
                        DataView   eventAttributes = BusinessObject.GetByParentAsDataView <ProjectEventAttribute>(eventId);
                        List <int> attList         = new List <int>();
                        foreach (DataRow attRecord in eventAttributes.Table.Rows)
                        {
                            int attId = int.Parse(attRecord[ProjectEventAttribute.EventAttributeId].ToString());
                            attList.Add(attId);
                        }
                        foreach (int key in attList)
                        {
                            eventAttributes.Delete(key);
                        }
                        eventList.Add(eventId);

                        //// Delete All Event Attributes
                        //eventAttributes.Delete();
                    }
                    foreach (int key in eventList)
                    {
                        events.Delete(key);
                    }
                    stageList.Add(stageId);
                }
                foreach (int key in stageList)
                {
                    stages.Delete(key);
                }

                project.Delete(projectId);
                //// Delete Stage after its events have been deleted
                //stages.Delete();
            }
            //// Finally Delete Project
            //project.Delete();
        }
Beispiel #16
0
        ///<summary>Handle edit->delete command from menu</summary>
        public void OnDeleteActivated(object o, EventArgs args)
        {
            if (dataBook.NPages == 0)
            {
                return;
            }
            DataView dv = ((DataViewDisplay)dataBook.CurrentPageWidget).View;

            dv.Delete();
        }
Beispiel #17
0
 public void TestDelete()
 {
     Assert.Throws <DeletedRowInaccessibleException>(() =>
     {
         DataView TestView = new DataView(_dataTable);
         TestView.Delete(0);
         DataRow r = TestView.Table.Rows[0];
         Assert.True(!((string)r["itemId"] == "item 1"));
     });
 }
Beispiel #18
0
        private void removeExpiredRows(DataTable table, string expiredColumnName)
        {
            string   filter = string.Format(CultureInfo.InvariantCulture, "{0} < #{1}#", expiredColumnName, DateTime.UtcNow);
            DataView view   = new DataView(table, filter, null, DataViewRowState.CurrentRows);

            for (int i = view.Count - 1; i >= 0; i--)
            {
                view.Delete(i);
            }
        }
        private void btnDeleteDetailColumn_Click(object sender, EventArgs e)
        {
            DataView dv = (DataView)gdDetail.DataSource;

            if (gridView2.GetFocusedDataSourceRowIndex() > -1)
            {
                dv.Delete(gridView2.GetFocusedDataSourceRowIndex());
                gdDetail.DataSource = dv;
                gdDetail.RefreshDataSource();
            }
        }
Beispiel #20
0
        public void deleterow(DataView dataView, int currentRow)
        {
            string textofcurrentRow = dataView[currentRow]["recordName"].ToString();

            if (MessageBox.Show("Would you like to delete person " + textofcurrentRow, "form closing", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                dataView.Delete(currentRow);
                MyNotebook form = new MyNotebook();
                form.dgv1.DataSource = dataView;
            }
        }
Beispiel #21
0
        private void OdstranitStylZTabulky(string sID)
        {
            DataView dv = new DataView(mdtStyly);

            dv.AllowDelete = true;
            dv.RowFilter   = String.Format("StylID = '{0}'", sID);
            if (dv.Count == 1)
            {
                dv.Delete(0);
            }
        }
Beispiel #22
0
        /// <summary>
        /// 刪除檢視表中所有的資料列。
        /// </summary>
        /// <param name="dataView">檢視表。</param>
        /// <param name="isAcceptChanges">是否同意變更。</param>
        public static void DeleteRows(DataView dataView, bool isAcceptChanges)
        {
            for (int N1 = dataView.Count - 1; N1 >= 0; N1 += -1)
            {
                dataView.Delete(N1);
            }

            if (isAcceptChanges)
            {
                dataView.Table.AcceptChanges();
            }
        }
Beispiel #23
0
        public static void Delete(string categoryID)
        {
            dv.RowFilter = "SrNo='" + categoryID + "'";

            dv.Sort = "SrNo";

            dv.Delete(0);

            dv.RowFilter = "";

            save();
        }
Beispiel #24
0
        /// <summary>
        /// Delete rows from database with specified filter;
        /// </summary>
        /// <param name="filter">string</param>
        /// <returns>bool</returns>
        public bool Delete(string filter)
        {
            DataView dataView = new DataView(table);

            dataView.RowFilter   = filter;
            dataView.AllowDelete = true;
            while (dataView.Count > 0)
            {
                dataView.Delete(0);
            }
            return(true);
        }
Beispiel #25
0
        /// <summary>
        /// 取选择变化后的对应表
        /// </summary>
        /// <param name="p_dtDef">关联表</param>
        /// <param name="p_strFilter">关联表的过滤字段</param>
        /// <param name="p_intFilterValue">关联表过滤的值</param>
        /// <param name="p_strKeyName">对应的关键字段</param>
        public void GetChange(ref DataTable p_dtDef, string p_strFilter, object p_objFilterValue, string p_strKeyName)
        {
            if (p_dtDef.Columns[p_strKeyName].DataType == typeof(String))
            {
                GetChange2(ref p_dtDef, p_strFilter, p_objFilterValue, p_strKeyName);
                return;
            }
            DataTable dt = (gdLeft.DataSource as DataView).Table;

            dt.AcceptChanges();
            string sf = p_dtDef.Columns[p_strFilter].DataType == typeof(String) ? "{0}='{1}'" : "{0}={1}";

            DataRow[] drs = p_dtDef.Select(string.Format(sf, p_strFilter, p_objFilterValue));
            var       q1  = from def in drs
                            select def.Field <decimal>(p_strKeyName);

            var q2 = from s in dt.AsEnumerable()
                     select s.Field <decimal>(p_strKeyName);

            //新增的
            var add = q2.Except(q1);

            foreach (decimal d in add)
            {
                DataRow r = p_dtDef.NewRow();
                if (p_dtDef.Columns[p_strFilter].DataType == typeof(String))
                {
                    r[p_strFilter] = Convert.ToString(p_objFilterValue);
                }
                else
                {
                    r[p_strFilter] = weCare.Core.Utils.Function.Dec(p_objFilterValue);
                }
                r[p_strKeyName] = d;
                p_dtDef.Rows.Add(r);
            }

            //删除的
            var      dele = q1.Except(q2);
            DataView dv   = p_dtDef.DefaultView;

            dv.RowFilter = string.Format(sf, p_strFilter, p_objFilterValue);
            dv.Sort      = p_strKeyName;
            foreach (decimal d in dele)
            {
                int r = dv.Find(d);
                if (r != -1)
                {
                    dv.Delete(r);
                }
            }
        }
Beispiel #26
0
        public void delImportCar(string sSimNum)
        {
            DataView view = new DataView(this.m_dtImportCar, string.Format("SimNum='{0}'", sSimNum), "", DataViewRowState.CurrentRows);

            if (view.Count > 0)
            {
                if (this.lbImportCar.SelectedValue.ToString() == sSimNum)  ///ToString
                {
                    this.setTrackingCar();
                }
                view.Delete(0);
            }
        }
Beispiel #27
0
        private void CleanDS()
        {
            DataRow row = null;

            for (int i = 0; i < exportDS.Table.Rows.Count; i++)
            {
                row = exportDS.Table.Rows[i];
                if (row[0].ToString() == "__SubHeading")
                {
                    exportDS.Delete(i);
                }
            }
        }
Beispiel #28
0
        private void Delete_PaymentDetails(string sClaimRefNo, string sRegNo, InterestReimbursement oIR)
        {
            DataView dv = oIR.DtIntePaymentDetails.DefaultView;

            dv.RowFilter = "ClaimRefNo='" + sClaimRefNo.Trim() + "' And RegNo='" + sRegNo.Trim() + "'";

            for (int i = 0; i < dv.Count; i++)
            {
                dv.Delete(0);
            }
            oIR.DtIntePaymentDetails.AcceptChanges();
            dv.RowFilter = null;
        }
Beispiel #29
0
        [Test] public void AllowDelete()
        {
            DataTable dt = DataProvider.CreateParentDataTable();
            DataView  dv = new DataView(dt);

            // AllowDelete - default value
            Assert.AreEqual(true, dv.AllowDelete, "DV6");

            // AllowDelete - true
            dv.AllowDelete = true;
            Assert.AreEqual(true, dv.AllowDelete, "DV7");

            // AllowDelete - false
            dv.AllowDelete = false;
            Assert.AreEqual(false, dv.AllowDelete, "DV8");

            dv.AllowDelete = false;
            // AllowDelete false- Exception
            try
            {
                dv.Delete(0);
                Assert.Fail("DV9: Delete Failed to throw DataException");
            }
            catch (DataException) {}
            catch (AssertionException exc) { throw  exc; }
            catch (Exception exc)
            {
                Assert.Fail("DV10: Delete. Wrong exception type. Got:" + exc);
            }

            dv.AllowDelete = true;
            int RowsCount = dv.Count;

            // AllowDelete true- Exception
            dv.Delete(0);
            Assert.AreEqual(RowsCount - 1, dv.Count, "DV11");
        }
Beispiel #30
0
 public static void Delete(string categoryID)
 {
     SelectAll();
     dv.RowFilter = "id='" + categoryID + "'";
     if (dv.Count == 0)
     {
         MessageBox.Show("Record was not found,please check the XML");
         dv.RowFilter = "";
         return;
     }
     dv.Sort = "id";
     dv.Delete(0);
     dv.RowFilter = "";
     save();
 }
Beispiel #31
0
        public void AllowDelete()
        {
            DataTable dt = DataProvider.CreateParentDataTable();
            DataView dv = new DataView(dt);

            // AllowDelete - default value
            Assert.Equal(true, dv.AllowDelete);

            // AllowDelete - true
            dv.AllowDelete = true;
            Assert.Equal(true, dv.AllowDelete);

            // AllowDelete - false
            dv.AllowDelete = false;
            Assert.Equal(false, dv.AllowDelete);

            dv.AllowDelete = false;
            // AllowDelete false- Exception
            Assert.Throws<DataException>(() =>
            {
                dv.Delete(0);
            });

            dv.AllowDelete = true;
            int RowsCount = dv.Count;
            // AllowDelete true- Exception
            dv.Delete(0);
            Assert.Equal(RowsCount - 1, dv.Count);
        }
Beispiel #32
0
        public void RowStateFilter_2()
        {
            DataSet dataset = new DataSet("new");
            DataTable dt = new DataTable("table1");
            dataset.Tables.Add(dt);
            dt.Columns.Add("col1");
            dt.Columns.Add("col2");
            dt.Rows.Add(new object[] { 1, 1 });
            dt.Rows.Add(new object[] { 1, 2 });
            dt.Rows.Add(new object[] { 1, 3 });
            dataset.AcceptChanges();

            DataView dataView = new DataView(dataset.Tables[0]);

            // 'new'  table in this sample contains 6 records
            dataView.AllowEdit = true;
            dataView.AllowDelete = true;
            string v;

            // Editing the row
            dataView[0]["col1"] = -1;
            dataView.RowStateFilter = DataViewRowState.ModifiedOriginal;
            v = dataView[0][0].ToString();
            Assert.Equal(1, dataView.Count);
            Assert.Equal("1", v);

            // Deleting the row
            dataView.Delete(0);
            dataView.RowStateFilter = DataViewRowState.Deleted;

            v = dataView[0][0].ToString();
            Assert.Equal(1, dataView.Count);
            Assert.Equal("1", v);
        }
Beispiel #33
0
 public void TestDelete()
 {
     Assert.Throws<DeletedRowInaccessibleException>(() =>
     {
         DataView TestView = new DataView(_dataTable);
         TestView.Delete(0);
         DataRow r = TestView.Table.Rows[0];
         Assert.True(!((string)r["itemId"] == "item 1"));
     });
 }
Beispiel #34
0
 public void TestDeleteOutOfBounds()
 {
     Assert.Throws<IndexOutOfRangeException>(() =>
     {
         DataView TestView = new DataView(_dataTable);
         TestView.Delete(100);
     });
 }
Beispiel #35
0
 public void TestDeleteNotAllowed()
 {
     Assert.Throws<DataException>(() =>
     {
         DataView TestView = new DataView(_dataTable);
         TestView.AllowDelete = false;
         TestView.Delete(0);
     });
 }
Beispiel #36
0
 public void TestDeleteClosed()
 {
     Assert.Throws<IndexOutOfRangeException>(() =>
     {
         DataView TestView = new DataView(_dataTable);
         TestView.Dispose(); // Close the table
         TestView.Delete(0); // cannot access to item at 0.
     });
 }
Beispiel #37
0
        public void TestDeleteAndCount()
        {
            DataSet dataset = new DataSet("new");
            DataTable dt = new DataTable("table1");
            dataset.Tables.Add(dt);
            dt.Columns.Add("col1");
            dt.Columns.Add("col2");
            dt.Rows.Add(new object[] { 1, 1 });
            dt.Rows.Add(new object[] { 1, 2 });
            dt.Rows.Add(new object[] { 1, 3 });

            DataView dataView = new DataView(dataset.Tables[0]);

            Assert.Equal(3, dataView.Count);
            dataView.AllowDelete = true;

            // Deleting the first row
            dataView.Delete(0);

            Assert.Equal(2, dataView.Count);
        }
Beispiel #38
0
        public void Delete()
        {
            //create the source datatable
            DataTable dt = DataProvider.CreateChildDataTable();

            //create the dataview for the table
            DataView dv = new DataView(dt);

            int CountView = dv.Count;
            int CountTable = dt.Rows.Count;

            DataRowView drv = dv[0];

            // Delete - DataView Row Count
            dv.Delete(0);
            Assert.Equal(dv.Count, CountView - 1);

            // Delete - Table Row Count 
            Assert.Equal(dt.Rows.Count, CountTable);

            // Delete - check table
            Assert.Equal(dt, drv.Row.Table);
        }