Solved

Returning Fields

Posted on 2013-05-13
1
141 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
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

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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