Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Team,

I am using Linq Expression in my code but i not getting the result which i want.Please have a look on my comment line . I want a advice from you.
My requirement is if i found the same cellid then it will read the records in which columns having the values are not empty.

public IEntityCollectionBase GetZteBbhRecords(IEntityBase xmlConfiguration)
       {
           IDataReader dataReader = null;
           ExcelDataAccess excelDataAccess = null;
           IEntityCollectionBase zteBbhRecords = Kaizen2GEntityCreator.GetZteBbhEntityCollection();
           try
           {
               IXmlConfiguration xmlConfig = xmlConfiguration as IXmlConfiguration;
               Logger.Write("Inside ZteBbhDataManager.GetZteBbhRecords()", xmlConfig.LogTypeInfo);
               excelDataAccess = CommonDataManager.GetDataAccess(xmlConfig);
               dataReader = excelDataAccess.ExecuteReader();
               IZteBbh zteBbhEntity = null;
               while (dataReader.Read())
               {
                   zteBbhEntity = Kaizen2GEntityCreator.GetZteBbhEntity();
                   zteBbhEntity = CommonDataManager.GetEntityFromExcelRow(dataReader, xmlConfig, zteBbhEntity) as IZteBbh;
                   if (zteBbhEntity != null)
                   {
                       if ((zteBbhEntity.CombinedMaster as ICombinedMaster).CellId > 0
                         && !(zteBbhEntity.CombinedMaster as ICombinedMaster).CellName.ToUpper().Contains("TEST"))
                       {
                           // match the record for same CellId.here i need to check
                           // string[] matchID = zteBbhRecords.Cast<IZteBbh>().Select(zteBbh => (zteBbh.CombinedMaster as ICombinedMaster).CellId.ToString()).GroupBy(item => item).Where(items => items.Count() > 1).Select(item => item.Key).ToArray();

                           if ((zteBbhEntity.CombinedMaster as ICombinedMaster).Circle.Trim().ToUpper() == "ROTN")
                           {
                               (zteBbhEntity.CombinedMaster as ICombinedMaster).Circle = "ROTN-ZTE";
                           }
                           else if ((zteBbhEntity.CombinedMaster as ICombinedMaster).Circle.Trim().ToUpper() == "AP")
                           {
                               (zteBbhEntity.CombinedMaster as ICombinedMaster).Circle = "AP-ZTE";
                           }

                           zteBbhEntity.FileLogId = xmlConfig.FileLogId;
                           zteBbhEntity.HandOverSuccessRate = zteBbhEntity.HandOverSuccessRate * 100;
                           zteBbhEntity.HandOverFailureRate = zteBbhEntity.HandOverFailureRate * 100;
                           zteBbhEntity.RandomAccessSuccessRate = zteBbhEntity.RandomAccessSuccessRate * 100;
                           zteBbhEntity.TbfSuccessRateUl = zteBbhEntity.TbfSuccessRateUl * 100;
                           zteBbhEntity.TbfSuccessRateDl = zteBbhEntity.TbfSuccessRateDl * 100;
                           zteBbhRecords.Add(zteBbhEntity);
                       }
                   }
               }

               Logger.Write("Exiting ZteBbhDataManager.GetZteBbhRecords()", xmlConfig.LogTypeInfo);
           }
           catch (Exception exception)
           {
               throw exception;
           }
           finally
           {
               dataReader.CloseDataReader();
               excelDataAccess.CloseConnection();
           }

           return zteBbhRecords;
       }
Posted
Comments
Sampath Lokuge 16-May-14 6:19am    
Which out put do you expect there ? Can we have more info ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900