|
Sir the code you provided here is good but it is not flexible and as a result this can not be used in any scenario of pivot data re-presentation. your provided code is fixed and not dynamic.
can you please provide a extension method which convert any list to Pivot where i can supply those columns name on which grouping will be performed.
if possible please share anything similar code which really help me sir.
Thank you.
|
|
|
|
|
I have already provided you with such a code, but you rejected it because you've limited yourself to working in an obsolete version of the framework. A fact which you didn't mention until after I had given you the answer!
I've also given you a fixed version for your stated requirement that works in your chosen obsolete framework version.
And now you want me to spend even more time rewriting the dynamic version of the code to work in your chosen obsolete framework version, when you appear to have put precisely zero effort into solving your own problem?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
My intension is not give any problem to anyone. i could not do that to customize the function body which can take multiple fields for grouping and that why i posted that question here and i thought some one will help.
anyway thanks for your help sir. cheers.
|
|
|
|
|
I assume you are going to pay Richard for the work. He has gone above and beyond to help you and you are demanding more and more. If you want the code writing for you, pay for it. Don't expect it for free.
|
|
|
|
|
You are very lucky to have any responses from a mind like Richard Deeming's !
Now, it's time for you to get to work.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
What is the meaning of forum....it is place where people discuss their problem and other give suggestion & answer if possible.
when a person do not know the answer or have negative mind or sluggish then those people come with excuse like this one.... "Now, it's time for you to get to work."
Cheers.
|
|
|
|
|
I am calling a store procedure and SP return data pivot way like below sample
+-----------------+--------------------+-------------+-------------------+----------+----------+-----------+----------+
| Section | LineItem | Broker Code | Broker Name | 2012 FYA | 2013 FYA | 1Q 2014A | 2Q 2014A |
+-----------------+--------------------+-------------+-------------------+----------+----------+-----------+----------+
| Consensus Model | Net Revenue | ZB | B Securities | | | 204.45 | 205.00 |
| Consensus Model | Net Revenue | TU | Cantor Fitzgerald | 101.33 | | 204.45 | 201.00 |
| Consensus Model | Cost of Goods Sold | ZB | B Securities | | | 204.45 | 205.00 |
| Consensus Model | Cost of Goods Sold | TU | Cantor Fitzgerald | 101.33 | | 204.45 | 201.00 |
+-----------------+--------------------+-------------+-------------------+----------+----------+-----------+----------+
i easily can store the data into datatable but i am interested to know how could i store data into List<t> which return store procedure.
i do not want to use Datatable in the middle to hold SP return data.
this is my class where i like to store the above pivot data
public class Data
{
public string Section { get; set; }
public string Lineitem { get; set; }
public string BrokerCode { get; set; }
public string BrokerName { get; set; }
public string Period { get; set; }
public string PeriodValue { get; set; }
}
Thanks
|
|
|
|
|
Your class is designed to store the un-pivoted data. You'll need to change your query so that it doesn't pivot the data before you load it.
The alternative would be to redesign your class:
public class Header
{
public string Section { get; set; }
public string LineItem { get; set; }
public string BrokerCode { get; set; }
public string BrokerName { get; set; }
public List<PeriodTotal> Periods { get; set; }
}
public class PeriodTotal
{
public string Period { get; set; }
public decimal PeriodValue { get; set; }
}
var result = new List<Header>();
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
string section = reader.GetString(0);
string lineItem = reader.GetString(1);
string brokerCode = reader.GetString(2);
string brokerName = reader.GetString(3);
var periods = new List<PeriodTotal>();
for (int index = 4; index < reader.FieldCount; index++)
{
periods.Add(new PeriodTotal { Period = reader.GetName(index), PeriodValue = reader.GetDecimal(index) });
}
result.Add(new Header
{
Section = section,
LineItem = lineItem,
BrokerCode = brokerCode,
BrokerName = brokerName,
Periods = periods,
});
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sir, i can not change the SP which return data in pivot format. please guide me how to change class design which can hold pivot data?
suppose i used to store data into datatable from SP and datatable can store pivot data and later can't we use LINQ to extrac data from datatable and populate my class which i have posted here.
if possible can you please show me the way. thanks
|
|
|
|
|
Read my answer again. I've already shown you!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sir i understand that you are trying to say change my query in store procedure of sql server as a result query should not return data in pivot style. am i correct ?
thanks
|
|
|
|
|
Yes. Your class is designed to store the un-pivoted data. Whilst you could potentially write code to take the pivoted data and convert it back to the format your class is expecting, it would be far simpler to not pivot the data in the first place.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Please guide me
How to activate the second Telegram password with C#
|
|
|
|
|
You have already posted this in QA:
Enable two-step verification telegram with C#[^]
And as Bill said there, you haven't provided anywhere near enough detail for anyone to help you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i searched lot google to know what is default measurement unit of EPPlus but found no info. anyone can tell me what is default measurement unit of EPPlus ?
is it point, inches, pixel ?
how to change default unit in EPPlus ? share some idea. thanks
|
|
|
|
|
If you have a valid license you can contact their support and ask them.
|
|
|
|
|
|
I assume you are talking about eMeasurementUnits[^] here. You can't change a default because it's just that, a default. If what you are after is changing the measurement unit, then that is set via ExcelVmlMeasurementUnit[^].
|
|
|
|
|
Hello.
I'm trying to get text data from another program.
The window handle was found.
Please check the image link.
CLICK Here - Attach Image Link
But I'm not sure what to do next.
Should I use something similar to the GetDlgCtrlID method?
I do not know.
The return is -1.
Please advise.
thank you.
|
|
|
|
|
|
Hello, here I have finished my Super Market management application, but what worries me is that I am blocked is that after the installation of Setup on the pc when the user will start for the 1st time who has a form that he needs. '' register company information (shop, pharmacy, supermarket, etc.)
Ex: Store name, address, telephone etc. and the name & password for the system administrator. After entering this information, when the user is going to run the program again, he now goes to the "Login" form.
Please if anyone has an idea please help me
|
|
|
|
|
Your question is not clear.
I suspect what you are asking is how you differentiate the following
1. Setup
2. Application.
There are two choices.
1. The application on start up checks for completed information. If not there then ask for it. Otherwise continue.
2. The setup itself always requests the information. You cannot finish the set up without providing the information. If the information is not provided then there is no application to run (again because the set up did not complete.)
|
|
|
|
|
To be honest, if you can't work this out on your own, then I wouldn't trust your app to be of any use to anyone in the real world.
All you need to do is add a simple boolean to wherever you are storing the store information and check it when you start up. If it's set, you go to login. If it isn't, you go to the "Enter the initial info" form, and then set it to true ready for next time.
How come you can't work that out for yourself after writing a whole supermarket management app? It's trivial compared with stock management, product ordering, cash and electronic payment handling, staff monitoring, pricing control (including legal requirements on increased / decreased price display / charge order and timing), tax handling, theft prevention, and more ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Is this a commercial application or a school project? If it's a commercial application, I would strongly suggest that you need to invest time in an identity management solution; my preferred choice is Keycloak.
|
|
|
|
|
I am measuring voltage and passing it into a C# desktop application. I need to have a graphical representation of that voltage, something similar to a linear volume meter would be perfect.
Currently I've taken a trackbar and am writing the voltage value to it. It's not ideal though. Has some issues. Certainly there's a better way to do this?
|
|
|
|