Solved

Returning Fields

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

22 Experts available now in Live!

Get 1:1 Help Now