//-------------------------------------------------------------------------------------------------------------------------------------- /// <summary>Se llama cuando se oprime el botón de borrar una venta</summary> private void btnDelVenta_Click(object sender, EventArgs e) { var ret = MessageBox.Show("Si borra la venta, no quedrá constancia en el sistema\r\n¿Estas seguro?", "Aviso", MessageBoxButtons.YesNo); if (ret == DialogResult.Yes) { var Row1 = Datos.BD.Ventas.FindByid(NowVentId); if (Row1 == null) { MessageBox.Show("No se encontro el item a borrar"); return; } Row1.Delete(); foreach (DataRow Row2 in tbVentas.Rows) { if ((int)Row2[0] == NowVentId) { Row2.Delete(); break; } } SetWorkMode(0); RefreshEstadisticas(); Datos.SetChanges("VentaDelete"); } }
/// <summary> /// Updates denominator table /// </summary> /// <param name="denominatorColIndex"></param> /// <param name="appliedColIndexes"></param> public void UpdateDenominatorTable(int denominatorColIndex, string appliedColIndexes) { DataRow NewRow; DataTable TempTable; String TempAppliedColIndex = string.Empty; // update denominator column info if (this._DenominatorTable != null) { // delete already mapped row where denominator column is equal to denominator column index foreach (DataRow Row in this._DenominatorTable.Select(DenominatorColumns.DenominatorColumn + " = '" + denominatorColIndex.ToString() + "'")) { Row.Delete(); } // delete already mapped row where denominator column is equal to applied column indexes foreach (string appliedColIndex in DICommon.SplitString(appliedColIndexes, ",")) { if (TempAppliedColIndex.Length > 0) { TempAppliedColIndex += ","; } TempAppliedColIndex = "'" + appliedColIndex + "'"; } foreach (DataRow Row1 in this._DenominatorTable.Select(DenominatorColumns.DenominatorColumn + " IN ( " + TempAppliedColIndex + ")")) { Row1.Delete(); } // delete already mapped row where applied column is equal to denominator column foreach (DataRow Row2 in this._DenominatorTable.Select(DenominatorColumns.AppliedColumn + " = '" + denominatorColIndex + "'")) { Row2.Delete(); } // add denominator column index and applied columns indexes foreach (string appliedColIndex in DICommon.SplitString(appliedColIndexes, ",")) { NewRow = this._DenominatorTable.NewRow(); NewRow[DenominatorColumns.DenominatorColumn] = denominatorColIndex.ToString(); NewRow[DenominatorColumns.AppliedColumn] = appliedColIndex; this._DenominatorTable.Rows.Add(NewRow); } this._DenominatorTable.AcceptChanges(); } }