I'll do my best to explain:
The application main purpose is to retrieve information regarding
purchased items by a client. Each client has a masteraccount. He uses
this MasterAccount to purchase items. This is were I begin the hard
part. I must read the items, show them in a listview and allow the
user of my application to split each item into two or more subItems.
Each SubItem contains two more pieces of information that I simply
called 'TypeA' and 'TypeB'. When the user starts working the
information regarding 'TypeA', he is filling information regarding the
client divided into 4 'blocks' that I called SubTypes. Each SubType
contains several boolean variables. I need to read the information
contained in these boolean variables, multiply it by a factor directly
related to each variable and by the amount spent on the original item.
The result is calculated at the subItem level. These values are stored
inside a sql server 2000 db.
Pseudocode:
bvA = Client.MasterAccount.PurchasedItems[].Subitems[].TypeA.SubType0.BoolVarA;
foreach (purchasedItem)
foreach (SubItem)
TypeA.CalcValues {
Calc_SubType0 {
bvA(0/1) * Factor_bvA * Amount($)
bvB(0/1) * Factor_bvB * Amount($)
bvC(0/1) * Factor_bvC * Amount($)
}
Calc_SubType1 {
bvD(0/1) * Factor_bvD * Amount($)
bvE(0/1) * Factor_bvE * Amount($)
bvF(0/1) * Factor_bvF * Amount($)
bvG(0/1) * Factor_bvG * Amount($)
bvH(0/1) * Factor_bvH * Amount($)
}
Calc_SubType2 {
(...)
}
(...)
}
TypeB.CalcValues {
(...)
}
The manager of my project doesn't agree with this structure because it
will create a lot of objects and consume lots of memory each time a
user decides to open a client account, and the application is supposed
to allow the user to open as many clients has he wishes. I'm also not
happy with it but a better solution hasn't occurred to me yet. Any
suggestions?
Thank you
Hugo
"Dan Bass" <Not Listed> wrote in message news:<e3**************@TK2MSFTNGP14.phx.gbl>...
Could you explain briefly what you're trying to do, rather than explaining
how you're trying to do it...
From evaluating a problem, we can the provide recommendations, opinions and
ideas as to where you could go.
Thanks
Dan.
"hufel" <hu*********@yahoo.com> wrote in message
news:5c**************************@posting.google.c om... Hi,
I'm doing my first big project in C# and I'm stuck with a problem that
I believe has a simple and efficient solution for it (I just haven't
bumped into it yet...). The concept is the following:
//Users manage clients. When the system creates the client it must
fetch the information from the DB and allow some modifications:
Client client = new Client("test");
MasterAccount ma = new MasterAccount(1324651);
client.MasterAccount = ma;
PurchaseItems pi = client.MasterAccount.GetPurchasedItems();
FillListview(pi);
// when a user selects a line in the listview, he must have the
possibility to split each line into two or more lines:
pi[0].Subitem[0..n]
// Each Subitem contains in turn two variables that will in turn be
instanced into two new classes:
Subitem si = pi[0].Subitem[0];
si.TypeA = new Type();
si.TypeB = new Type();
//TypeA and TypeB are of the same type. But in turn contain more class
variables inside
si.TypeA.SubType0
si.TypeA.SubType1
si.TypeA.SubType2
si.TypeA.SubType3
//The SubTypes contain only bool variables and a method.
My problem is that this is a representation in a "object oriented way"
(I think) of what the user sees on screen, but in terms of
calculations and memory comsumption it is not efficient, although it
is flexible enough to make future modification easy.
The problem is that now I'm stuck with this concept, and although I'm
trying to model other solutions in UML, I am not getting anywhere in
order to improve this. A friend suggested storing the values in arrays
and looping through it in order to calculate the values but I dislike
the idea due to (in my opinion) complicated implementation and the
fact that the code becomes much more difficult to understand and
modify in the future.
Please correct me if I'm wrong, through ideas in, whatever...
I welcome all suggestions.
PS. I thought about using patterns, like the singleton pattern or the
flyweight pattern, however I haven't seen real live examples and so I
don't understand how I could use them in my application.
Thank in advance
Hugo