Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Returning Fields

Posted on 2013-05-13
1
Medium Priority
?
146 Views
Last Modified: 2013-05-16
I have a view in SQL Server 2005. In ASP.NET I have a method that returns the totals for two fields in that view. I now want a control that will return certain fields with their data (there will be several records).

The method that returns the Totals is...
        private decimal GetTotalsBilling(
            TradingPerspectiveType tradingPerspective, string sideTypeName, TotalsType totals)
        {
            IEnumerable<TagSummaryView> items =
                this.TagSummaryItems.Where(
                    view => view.TradingPerspective == TradingPerspectiveType.Billing && view.Name == sideTypeName);
            return items.Sum(view => totals == TotalsType.Principal ? view.Principal : view.Quantity);
        }


I modified the view to display the fields/properties in the TagSummaryView as ...
        private string GetContract(string sideTypeName)
        {
            IEnumerable<TagSummaryView> items =
                this.TagSummaryItems.Where(
                    view => view.TradingPerspective == TradingPerspectiveType.Contract && view.Name == sideTypeName);
            return items.ToString();
        }


Clearly wrong to all except me.

The fields I want to return include TagTypeName, Quantity, Principal.
0
Comment
Question by:rawilken
[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:
rawilken earned 0 total points
ID: 39162880
This is what I have now...

Properties for the lists...
        private List<TagSummaryView> BuyList = new List<TagSummaryView>();

Method for the list
        private List<TagSummaryView> GetBilling(
            TradingPerspectiveType tradingPerspective, string sideTypeName)
        {
            IEnumerable<TagSummaryView> items = this.TagSummaryItems.Where(
                    view => view.TradingPerspective == TradingPerspectiveType.Billing && view.Name == sideTypeName);
            foreach (TagSummaryView tag in items)
            {
                BuyList.Add(tag);
            }
            return BuyList;
        }

Method to return the list to the web page...
        public List<TagSummaryView> BillingBuyList
        {
            get
            {
                return this.GetBilling(TradingPerspectiveType.Billing, "Buy");
            }
        }


This is still not working correctly, AND I only want to return some of the fields from the TagSummaryView - specifically TagTypeName, Quantity and Principal. There are other fields that are not needed.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
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…
Suggested Courses

718 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