SolvedPrivate

Linq - get results

Posted on 2013-12-02
1
44 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
1 Comment
 

Accepted Solution

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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now