BlueSky.Services.UIControllerService.DataSourceExists C# (CSharp) Method

DataSourceExists() private method

Check if DataSet is already open in one of the tabs
private DataSourceExists ( System.IO.DataSource ds ) : bool
ds System.IO.DataSource
return bool
        private bool DataSourceExists(DataSource ds)
        {
            bool dsexists = false;
            
            foreach (TabItem ti in docGroup.Items)
            {

                if ((ti.Tag as DataSource).FileName.ToLower().Equals(ds.FileName.ToLower()) &&
                    (ti.Tag as DataSource).SheetName.ToLower().Equals(ds.SheetName.ToLower())    //29Apr2015 Sheetname
                    )
                {
                    dsexists = true;
                    docGroup.SelectedItem = ti;
                    break;
                }
            }
            return dsexists;
        }