Solved

Returning Fields

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

772 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