Ejemplo n.º 1
0
        /// <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();
            }
        }