Ejemplo n.º 1
0
        public static DataTable getCallLetters_Flagship(DataTable Table)
        {
            DataTable RTable = new DataTable();

            RTable.Columns.Add("Flagship", typeof(String));
            RTable.Columns.Add("Repeater Station", typeof(String));
            RTable.Columns.Add("State", typeof(String));
            RTable.Columns.Add("City", typeof(String));
            RTable.Columns.Add("Freq", typeof(String));
            RTable.Columns.Add("Member Status", typeof(String));
            RTable.Columns.Add("Metro", typeof(String));
            RTable.Columns.Add("DMA", typeof(String));

            DataSet RDataSet = new DataSet();

            RDataSet.Tables.Add(Table);

            int    row             = RDataSet.Tables[0].Rows.Count;
            int    col             = RDataSet.Tables[0].Columns.Count;
            string FlagshipStation = "";

            for (int x = 0; x < row; x++)
            {
                DataRow r = RTable.NewRow();
                RTable.Rows.Add(r);
                for (int y = 0; y < col; y++)
                {
                    if (y == 0)
                    {
                        //string temp = (RDataSet.Tables[0].Rows[x][y].ToString());
                        long?StationId = ((RDataSet.Tables[0].Rows[x][y]) as long?);
                        if (StationId.HasValue)
                        {
                            DataTable tempDataTable = CRCDataAccess.Get_CallLetters(StationId);
                            DataSet   tempDataset   = new DataSet();
                            tempDataset.Tables.Add(tempDataTable);
                            FlagshipStation = tempDataset.Tables[0].Rows[0][0].ToString();
                            //FlagshipStation = CRCDataAccess.Get_CallLetters(StationId);
                            RTable.Rows[x][y] = FlagshipStation;
                            FlagshipStation   = "";
                        }
                        else
                        {
                            RTable.Rows[x][y] = FlagshipStation;
                        }
                    }
                    else
                    {
                        RTable.Rows[x][y] = RDataSet.Tables[0].Rows[x][y];
                    }
                }
            }

            return(RTable);
        }