Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Team,
I have written the code as follows:
List<IZteBbh> singleCellRecords = duplicateRecords.Where(item => (item.CombinedMaster as ICombinedMaster).Id.ToString() == cellId).ToList();
                    //// Check for same records.
                    List<IZteBbh> blankRecords = new List<IZteBbh>();
                    for (int count = 0; count < singleCellRecords.Count; count++)
                    {
                        //// Check for blank 
                        bool isBlank = singleCellRecords[count].Ru60Ru02 == string.Empty
                                         && singleCellRecords[count].NumberOfTrxs == 0
                                         && singleCellRecords[count].EquippedTrxs == 0
                                         && singleCellRecords[count].SdcchSlots == 0
                                         && singleCellRecords[count].PdtchTs == 0
                                         && singleCellRecords[count].HrEnable == false
                                         && singleCellRecords[count].AmrThreshold == 0
                                         && singleCellRecords[count].AvailableTchFullHalfChannel == 0
                                         && singleCellRecords[count].DesinedCapacity == 0
                                         && singleCellRecords[count].AvailableTchFr == 0
                                         && singleCellRecords[count].DesinedCapacityFr == 0
                                         && singleCellRecords[count].NoOfSdcchAvailable == 0
                                         && singleCellRecords[count].NoOfSdcchTimeSlots == 0
                                         && singleCellRecords[count].PeakOfSdcchUsed == 0
                                         && singleCellRecords[count].NoOfAvailableTch == 0
                                         && singleCellRecords[count].PeakOfTchOrFUsed == 0
                                         && singleCellRecords[count].NoOfPdch == 0
                                         && singleCellRecords[count].NoOfPdchSwitchable == 0
                                         && singleCellRecords[count].NoOfPdchUsed == 0
                                         && singleCellRecords[count].TotalValidateAttempts == 0
                                         && singleCellRecords[count].TotalEstablishedCalls == 0
                                         && singleCellRecords[count].CssrPerc == 0
                                         && singleCellRecords[count].DroppedCalls == 0
                                         && singleCellRecords[count].DroppedCallsRate == 0
                                         && singleCellRecords[count].HandOverAttempts == 0
                                         && singleCellRecords[count].SuccessfulHandOverAttempts == 0
                                         && singleCellRecords[count].HandOverSuccessRate == 0
                                         && singleCellRecords[count].HandOverFailureRate == 0
                                         && singleCellRecords[count].RandomAccessSuccessRate == 0
                                         && singleCellRecords[count].SdcchBlks == 0
                                         && singleCellRecords[count].SdcchCongInTime == 0
                                         && singleCellRecords[count].TchBlks == 0
                                         && singleCellRecords[count].TchCongInTime == 0
                                         && singleCellRecords[count].CongHandovers == 0
                                         && singleCellRecords[count].DirectedRetryCalls == 0
                                         && singleCellRecords[count].SdcchDrps == 0
                                         && singleCellRecords[count].DynSdcchUsed == 0
                                         && singleCellRecords[count].TchDrps == 0
                                         && singleCellRecords[count].ErlMinDrop == 0
                                         && singleCellRecords[count].Fr == 0
                                         && singleCellRecords[count].Hr == 0
                                         && singleCellRecords[count].AmrFr == 0
                                         && singleCellRecords[count].AmrHr == 0
                                         && singleCellRecords[count].TchAssignSuccessRate == 0
                                         && singleCellRecords[count].VoiceErlangs == 0
                                         && singleCellRecords[count].RadioNtwUtiliztaionRate == 0
                                         && singleCellRecords[count].TbfSuccessRateUl == 0
                                         && singleCellRecords[count].TbfSuccessRateDl == 0
                                         && singleCellRecords[count].UlGprsThroughputRlc == 0
                                         && singleCellRecords[count].DlGprsThroughputRlc == 0
                                         && singleCellRecords[count].UlEGprsThroughputRlc == 0
                                         && singleCellRecords[count].DlEGprsThroughputRlc == 0
                                         && singleCellRecords[count].RrRescCongRateNomDlBlocking == 0
                                         && singleCellRecords[count].RrRescCongRateDeNomDlBlocking == 0
                                         && singleCellRecords[count].RrRescCongRateDlBlockingRate == 0
                                         && singleCellRecords[count].RrRescCongRateNomUlBlocking == 0
                                         && singleCellRecords[count].RrRescCongRateDeNomUlBlocking == 0
                                         && singleCellRecords[count].RrRescCongRateUlBlockingRate == 0
                                         && singleCellRecords[count].AbisRescCongRate == 0
                                         && singleCellRecords[count].UppbdDspRescCongRate == 0
                                         && singleCellRecords[count].GprsRlcPayloadUplink == 0
                                         && singleCellRecords[count].GprsRlcPayloadDownlink == 0
                                         && singleCellRecords[count].EGprsRlcPayloadUplink == 0
                                         && singleCellRecords[count].EGprsRlcPayloadDownlink == 0
                                         && singleCellRecords[count].SdcchBlocking == 0
                                         && singleCellRecords[count].SdcchDrp == 0
                                         && singleCellRecords[count].TtslTchBlkRate == 0
                                         && singleCellRecords[count].NoOfStatTs == 0
                                         && singleCellRecords[count].NoOfDynTs == 0
                                         && singleCellRecords[count].MaxNoOfUsedPdch == 0
                                         && singleCellRecords[count].AvgNoOfUsedPdch == 0
                                         && singleCellRecords[count].NoOfForceConerDynFromPdchToTchByBsc == 0
                                         && singleCellRecords[count].DataErlang == 0
                                         && singleCellRecords[count].VoiceDataErlangs == 0
                                         && singleCellRecords[count].SdBlkNom == 0
                                         && singleCellRecords[count].SdBlkDeNom == 0
                                         && singleCellRecords[count].SdDropNom == 0
                                         && singleCellRecords[count].SdDropDeNom == 0
                                         && singleCellRecords[count].TchBlkNom == 0
                                         && singleCellRecords[count].TchBlkDeNom == 0
                                         && singleCellRecords[count].TchDropNom == 0
                                         && singleCellRecords[count].TchDropDeNom == 0
                                         && singleCellRecords[count].HosrNom == 0
                                         && singleCellRecords[count].HosrDeNom == 0
                                         && singleCellRecords[count].NoOfDynPdchPreemptionForCsService == 0
                                         && singleCellRecords[count].CcrVoiceServicesNom1 == 0
                                         && singleCellRecords[count].CcrVoiceServicesDeNom1 == 0
                                         && singleCellRecords[count].CcrVoiceServicesNom2 == 0
                                         && singleCellRecords[count].CcrVoiceServicesDeNom2 == 0
                                         && singleCellRecords[count].CcrVoiceServicesNom3 == 0
                                         && singleCellRecords[count].CcrVoiceServicesDeNom3 == 0
                                         && singleCellRecords[count].CcrVoiceServicesNom4 == 0
                                         && singleCellRecords[count].CcrVoiceServicesDeNom4 == 0
                                         && singleCellRecords[count].TasrNom == 0
                                         && singleCellRecords[count].TasrDeNom == 0
                                         && singleCellRecords[count].UlQualNom == 0
                                         && singleCellRecords[count].UlQualDeNom == 0
                                         && singleCellRecords[count].DlQualNom == 0
                                         && singleCellRecords[count].DlQualDeNom == 0
                                         && singleCellRecords[count].RachNom == 0
                                         && singleCellRecords[count].RachDeNom == 0;
                        
                        if (isBlank)
                        {
                            ////blankRecords.Add(singleCellRecords[count]);
                            blankRecords.Remove(singleCellRecords[count]);
                        }
                    }

What i need to find is ,if i found any duplicate records with same value ,then i want to ignore the second record .As in if condition i wrote
C#
if (isBlank)
                        {
                            ////blankRecords.Add(singleCellRecords[count]);
                            blankRecords.Remove(singleCellRecords[count]);
                        }

but how can i ignore the second data from that count.
Please advice
Thanks
Harshal
Posted
Comments
Richard MacCutchan 20-May-14 9:12am    
Seriously; a single statement with that many separate expressions to be evaluated?
ugo.marchesini 20-May-14 14:11pm    
Add a isBlank ( public bool isBlank() ) method in IZteBbh class which perform the same test could help readability.
Maciej Los 20-May-14 16:06pm    
Reposting the same question won't help you to find solution...
http://www.codeproject.com/Questions/775593/Implementation-of-business-logic-in-my-code
SRS(The Coder) 21-May-14 1:16am    
Please put the condition check in a separate method which will take argument of type 'IZteBbh' and return true or false by checking its blankness.

Then only call this method in the IF condition here.

Just for improvement of readability, re-usability and reduce the number of lines of code in a single method.

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