Example #1
0
        public void RunRec(string FAFilePath, string MSFilePath)
        {
            try
            {
                this.FAFilePath = FAFilePath;
                this.MSFilePath = MSFilePath;

                //Clear DataSet
                this.dsRECON.Clear();

                //MSMtM msObj = new MSMtM();
                //msObj.Load(MSFilePath);
                //dsRECON.MSPosMV.Load(msObj.Table.CreateDataReader());

                //FAMtM faObj = new FAMtM();
                //faObj.Load(FAFilePath);
                //DataTableReader dtrdr = faObj.Table.CreateDataReader();
                //this.dsRECON.FAPosMV.Load(dtrdr, LoadOption.OverwriteChanges);
                Side side1 = new Side(SideEnum.Side1, "FA Position File");
                side1.LoadCSVFile(FAFilePath);

                Side side2 = new Side(SideEnum.Side2, "MS Pos. File");
                side2.LoadCSVFile(MSFilePath);

                //Run The Recon Object
                // Declare the Recon Manager
                reconObj.Date = GetDate();
                //reconObj.DeletePrevious(reconObj.Date);

                /*****
                 * Need to load the sides with file names.
                 * Need to grab pull a key map, from either a database or a file, and load it into a file.  The reconobject should
                 * store the details of the particular reconciliation, ReconLabel, and pull its reconciliation.
                 */
                reconObj.CompareTables(side1, side2, new KeyMap());
                this.dgSide1.DataSource = side1.Table;
                this.dgSide2.DataSource = side2.Table;

                //Load the Status Bar with Data
                this.LoadToolStrip();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        public string WhereKeysNotNullExpression(Side side)
        {
            foreach (Filter f in _keys)
            {
                string SideColName = "";
                //Get Column Mapping Names of Both Sides
                if (side.SideEnum == SideEnum.Side1)
                    SideColName = this.getSide1(f.FilterID);
                else if (side.SideEnum == SideEnum.Side2)
                    SideColName = this.getSide2(f.FilterID);

                //Replace expression with side statements
                //makes sedol = sedol.value ==> sedol1 = sedol.value
                f.FilterName = SideColName;
                f.SqlOperator = SqlOperators.NotEqual;
                f.FilterValue = "";
            }
            this.BuildExpression();
            return this._filterstr;
        }
Example #3
0
        // Need to tell which sides are being passed.
        public void CompareTables(Side side1, Side side2, KeyMap km)
        {
            this._TotalOuterRecords = 0;
            this._TotalUnmatched = 0;

            //Should grab empty select
            DataRow[] OuterRows = side1.Table.Select();
            this._TotalOuterRecords = OuterRows.Length;

            //Traverse Outer Table And Compare rows by the keys
            foreach (DataRow OuterRow in OuterRows)
            {
                //Check for items in InnerRow.col = OuterRow.value

                //Figure out if OuterRow is Side1 or Side2
                //SideEnum whichSide = Utility.Lookup.LookupSideEnum(OuterRow.Table.ExtendedProperties["Side"].ToString());

                //Declare a side object with rows to build the expression.
                Side side = new Side(OuterRow, side1.SideEnum);
                string exp = km.getExpression(side);
                DataRow[] InnerRows = side2.Table.Select(exp);

                //Found Match On Key
                if (InnerRows.Length > 0)
                {
                    //One to one Match
                    if (InnerRows.Length == 1)
                    {
                        InnerRows[0]["FK"] = OuterRow["RowId"];
                        OuterRow["MatchCount"] = 1;
                        RaiseMatchEvent(OuterRow, InnerRows);
                    }
                    else  //Many to One
                    {
                        if (Config.AllowOneToMany)
                        {
                            RaiseMatchEvent(OuterRow, InnerRows);
                            OuterRow["MatchCount"] = InnerRows.Length;

                            foreach (DataRow InnerRow in InnerRows)
                            {
                                //AddToDiffTable(OuterRow, InnerRow);
                                //Points each Inner Row Foreign Key to the Outer Row ID
                                //Need a way to flag the rows that have one to many..
                                InnerRow["FK"] = OuterRow["RowId"];
                            }
                        }
                        else
                        {
                            //Process Unmatched.. Flag as Many to One
                        }
                    }
                    System.Diagnostics.Debug.WriteLine("Found Item" + OuterRow[0].ToString());
                }

                //Not Found
                else
                {
                    //Process Unmatched OuterRow
                    this._TotalUnmatched++;
                }
            }
        }
Example #4
0
        /// <summary>
        /// Takes two data rows, and changes the name value pairs of the where expression to have the column of side 1 = value of side 2
        /// Side1.ColumnName = Side2[ColumnName] 
        /// </summary>
        /// <param name="side">Determines the value</param>
        /// <returns></returns>
        public string getExpression(Side side)
        {
            string exp = _filterstr;
            //Traverse Each Key and Replace the sides with the Columns of the Sides
            foreach (Filter f in _keys)
            {
                string s1 = this.getSide1(f.FilterID);
                string s2 = this.getSide2(f.FilterID);

                //Replace expression with side statements
                // FilterName = FilerValue
                //makes sedol = sedol.value ==> sedol1 = dr[sedol2.ColumnName.value]
                if (side.SideEnum == SideEnum.Side1)
                {
                    f.FilterName = "["+s2+"]";
                    f.FilterValue = side.Row[s1].ToString();
                }
                else //Side2's value should be shown
                {
                    f.FilterName = "["+s1+"]";;
                    f.FilterValue = side.Row[s2].ToString();
                }
            }
            //Reapplies the And | Or conditions to the statement
            this.BuildExpression();
            return _filterstr;
        }
Example #5
0
        public void CompareTablesMine(Side side1, Side side2, KeyMap km)
        {
            //Run Compare Tables twice, to go both ways of finding the matches.
            //base.CompareTables(side1.Table, side2.Table, new KeyMap());
            //base.CompareTables(side2.Table, side1.Table, new KeyMap());

            //Need to come up with Diffs algorithm
            this.CalcDiffs();
        }