SolvedPrivate

Linq - get results

Posted on 2013-12-02
1
49 Views
Last Modified: 2016-02-10
The4 following LinQ does not work at all. There are rows which do match, though no results given.

 IEnumerable<string> query = from s in AllTeamData  
                           where s.dbName == "CWILLI"
                           orderby s.dbName
                                        select s.dbName;

Class -->
public class DBTeams 
        {
            public DBTeams(string team, string name, string month, string aht, string efficiency, 
                string creditcount,string credit,string monitor, string scoreadhere, string overall,
                string calldur,string calldurout,string wrapin,string rating, string wrapout, string holdtime, string numofmons, string extn)
            {
                this.dbTeam = team;
                this.dbName = name;
                this.dbMonth = month;
                if (aht != "" && aht != null)
                {
                    this.dbAHT = decimal.Parse(aht);
                }
                if (efficiency != "" && efficiency != null)
                {
                    this.dbEffeciency = decimal.Parse(efficiency);
                }
                if (credit != "" && credit != null)
                {
                    this.dbCredit = decimal.Parse(credit);
                }
                if (creditcount != "" && creditcount != null)
                {
                    this.dbCreditCount = int.Parse(creditcount);
                }
                if (monitor != "" && monitor != null)
                {
                    this.dbMonitor = decimal.Parse(monitor);
                }
                if (scoreadhere !="" && scoreadhere != null)
                {
                this.dbScoreAdhere = decimal.Parse(scoreadhere);
                }
                if (overall != "" && overall != null)
                {
                    this.dbOverAll = decimal.Parse(overall);
                }
                if (calldur != "" && calldur != null)
                {
                    this.dbCallDur = decimal.Parse(calldur);
                }
                if (calldurout != "" && calldurout != null)
                {
                    this.dbCallDurOut = decimal.Parse(calldurout);
                }
                if (wrapin != "" && wrapin != null)
                {
                    this.dbWrapIn = decimal.Parse(wrapin);
                }
                if (rating != "" && rating != null)
                {
                    this.dbRating = decimal.Parse(rating);
                }
                if (wrapout != "" && wrapout != null)
                {
                    this.dbWrapOut = decimal.Parse(wrapout);
                }
                if (holdtime != "" && holdtime != null)
                {
                    this.dbHoldTime = decimal.Parse(holdtime);
                }
                if (numofmons != "" && numofmons != null)
                {
                    this.dbNumOfMons = int.Parse(numofmons);
                }
                this.dbExtn = extn;

            }
            public string dbTeam { get; set; }
            public string dbName { get; set; }
            public string dbMonth { get; set; }
            public decimal dbAHT { get; set; }
            
            public decimal dbEffeciency { get; set; }
            public decimal dbCredit { get; set; }
            public int dbCreditCount { get; set; }
            public decimal dbMonitor { get; set; }
            public decimal dbScoreAdhere { get; set; }
            public decimal dbOverAll { get; set; }
            public decimal dbCallDur { get; set; }
            public decimal dbCallDurOut { get; set; }
            public decimal dbWrapIn { get; set; }
            public decimal dbRating { get; set; }
            public decimal dbWrapOut { get; set; }
            public decimal dbHoldTime { get; set; }
            public int dbNumOfMons { get; set; }
            public string dbExtn { get; set; }

        }
        
    }

Open in new window


Load data from service-->
public void webService_GetSqlResultTableCompleted(object sender, WCFSvc1.GetSqlResultTableCompletedEventArgs e)
        {
            string xmlResult = e.Result;
            if (xmlResult == "")
            {
                MessageBox.Show("Error occured while executing SQL");
                return;
            }

            XmlSerializer serializer = new XmlSerializer(typeof(List<List<string>>));
            StringReader reader = new StringReader(xmlResult);
            List<List<string>> result = (List<List<string>>)serializer.Deserialize(reader);

            dataGrid1.Columns.Clear();
    
            List<DBTeams> AllTeamData = new List<DBTeams>();

            for (int i = 0; i < result[0].Count; i++)
            {
                    DataGridTextColumn textCol = new DataGridTextColumn { Header = result[0][i], Binding = new Binding("[" + i + "]") };
                    this.dataGrid1.Columns.Add(textCol);
             }
            result.RemoveAt(0); //remove captions

           for (int i = 0; i < result.Count; i++) // loop through data from service 
            {
                AllTeamData.Add(new DBTeams(result[i][1], result[i][2], result[i][3], result[i][4], result[i][5], result[i][6],
                    result[i][4], result[i][4],
                    result[i][7], result[i][8], result[i][9], result[i][10], result[i][11], result[i][12], result[i][13], result[i][14],
                    result[i][16], result[i][16]));
            }
          

           IEnumerable<string> query = from s in AllTeamData   
                           where s.dbName == "CWILLI"
                           orderby s.dbName
                                        select s.dbName;
           
        }

Open in new window

0
Comment
Question by:petel2k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
petel2k earned 0 total points
ID: 39689960
all set
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question