SolvedPrivate

Linq - get results

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

627 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