Click here to Skip to main content
15,920,632 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
Generaldisable smartcard pin dialog in CmsSigner and get valid pkcs7 message Pin
krazysmile27-Mar-08 4:37
krazysmile27-Mar-08 4:37 
GeneralRe: disable smartcard pin dialog in CmsSigner and get valid pkcs7 message Pin
krazysmile3-Apr-08 1:29
krazysmile3-Apr-08 1:29 
GeneralIMAP Select command for selecting Sent Items folder. Pin
Sivasankari Jayaraj27-Mar-08 2:11
Sivasankari Jayaraj27-Mar-08 2:11 
GeneralRe: IMAP Select command for selecting Sent Items folder. Pin
Pete O'Hanlon27-Mar-08 2:29
mvePete O'Hanlon27-Mar-08 2:29 
GeneralRe: IMAP Select command for selecting Sent Items folder. Pin
a123_12327-Mar-08 23:36
a123_12327-Mar-08 23:36 
GeneralRe: IMAP Select command for selecting Sent Items folder. Pin
Pete O'Hanlon28-Mar-08 0:47
mvePete O'Hanlon28-Mar-08 0:47 
GeneralRe: IMAP Select command for selecting Sent Items folder. Pin
a123_12331-Mar-08 18:42
a123_12331-Mar-08 18:42 
QuestionObject Consistency - Part II Pin
Zavullon26-Mar-08 22:46
Zavullon26-Mar-08 22:46 
Hi,
I am the same user that post the original post - "Object Consistency". (now logged with my real user name). again please excuse me for my english Roll eyes | :rolleyes:

Thanks all of you guys Big Grin | :-D , all of your posts are very informative, but i will sharp my question.

i will introduce you into my original problem from my real project.

there is a IRentable interface that represents any real life object that can be rent.
concrete rentable items like car, motocycle, or book are inherit from it.

there is also an abstract class RentProgram that describes the rules of renting
an item. for each particular rent item there is concrete rent program like MotocycleRentProgram,
all of them are inherit from RentProgram.

in addition there is an abstract class Order that contains among all others a rent item (IRentable)
and a rent program (RentProgram). for each concrete rentable item there are some specific properties
that will be exist in concrete class inheriting from Order like CarOrder.

for example when real car is returned without full fueltank, a penalty must be taken.
a cost for that penalty (fuelTankPenaltyCost) is a property of CarRentProgram, on the other hand
a status of car's fueltank (isFuelTankFull) is a part of CarOrder object end assigned by car operator
when the order is finalized.

my question is very specific. how you can ensure that every concrete order like CarOrder, MotocycleOrder and etc
will be consistent. i mean how you can ensure for example that object of type CarOrder will only contains Cars in it's
IRentable variable and only CarRentProgram in it's RentProgram variable.

that constraint must be applied for each relation of objects of the same group:
[concrete order] - [concrete rent item] - [concrete rent program]

for example:

[CarOrder] - [Car] - [CarRentProgram]
[MotocycleOrder] - [Motocycle] - [MotocycleRentProgram]
[BookOrder] - [Book] - [BookRentProgram]

assume that every concrete order can be updated over time so the constraint must be kept also
after updating methods of Order class like UpdateRentProgram(RentProgram rentProgram).

here is the class structure to complement my question:
thanks in advance Wink | ;)

abstract class Order<br />
{<br />
        protected Custumer custumer;<br />
<br />
        protected DateTime deliveryDate;<br />
        protected DateTime returnDate;        <br />
        protected Office deliveryOffice;<br />
        protected Office returnOffice;<br />
        protected DateTime realReturnDate;<br />
        protected Office realReturnOffice;<br />
<br />
        protected IRentable rentableItem;<br />
        protected RentProgram rentProgram;<br />
<br />
        protected List<payment> payments;<br />
<br />
        protected double damageCost;<br />
        protected String damageComments;<br />
<br />
        protected bool isFiniliezed = false;<br />
<br />
	...<br />
}<br />
<br />
abstract class RentProgram<br />
{<br />
	public abstract double CalculateCost(Order order);<br />
	<br />
	...<br />
}<br />
<br />
class CarOrder : Order<br />
{<br />
        protected double kilometers;<br />
        protected bool isFuelTankFull;<br />
<br />
	...<br />
}<br />
<br />
class MotocycleOrder : Order<br />
{<br />
        protected double kilometers;     <br />
	protected bool isAlarmPresent;<br />
	...<br />
}<br />
<br />
<br />
class Car : IRentable<br />
{<br />
        protected int id;<br />
        protected CarClass carClass;<br />
        protected double kilometers;<br />
        protected String name; <br />
<br />
	...<br />
}<br />
<br />
class Motocycle : IRentable<br />
{<br />
        protected int id;    <br />
        protected String name;<br />
        protected double kilometers;<br />
<br />
	...<br />
}<br />
<br />
<br />
class CarRentProgram : RentProgram<br />
{           <br />
        protected CostDescriptor costPerKilometer;<br />
        protected CostDescriptor costPerTime;<br />
        protected double insuranceCost;<br />
        protected double fuelTankPenaltyCost;<br />
        protected double dropChargeCost;<br />
<br />
	...<br />
}<br />
<br />
class MotocycleRentProgram : RentProgram<br />
{<br />
        protected CostDescriptor costPerTime;<br />
	protected double gadgetsCost;<br />
	protected double alarmDeviceCost; <br />
<br />
	...<br />
}</payment>


D'Oh! | :doh:
GeneralRe: Object Consistency - Part II Pin
Pete O'Hanlon27-Mar-08 0:46
mvePete O'Hanlon27-Mar-08 0:46 
GeneralRe: Object Consistency - Part II [modified] Pin
Zavullon27-Mar-08 2:33
Zavullon27-Mar-08 2:33 
GeneralRe: Object Consistency - Part II Pin
Pete O'Hanlon27-Mar-08 3:04
mvePete O'Hanlon27-Mar-08 3:04 
Questiondelay signing Pin
Ahmad Adnan26-Mar-08 3:49
Ahmad Adnan26-Mar-08 3:49 
General[Duplicate Post]Re: delay signing Pin
Scott Dorman26-Mar-08 4:09
professionalScott Dorman26-Mar-08 4:09 
Questiondelay signing Pin
Ahmad Adnan26-Mar-08 3:48
Ahmad Adnan26-Mar-08 3:48 
QuestionHow to shuttle callbacks from a C++ exe to a .NET DLL (or events from dll to exe) Pin
FiddlerMD25-Mar-08 10:53
FiddlerMD25-Mar-08 10:53 
AnswerRe: How to shuttle callbacks from a C++ exe to a .NET DLL (or events from dll to exe) Pin
led mike25-Mar-08 11:04
led mike25-Mar-08 11:04 
General.NET Framework Class Library Pin
JBAK_CP25-Mar-08 10:20
JBAK_CP25-Mar-08 10:20 
GeneralRe: .NET Framework Class Library Pin
led mike25-Mar-08 10:28
led mike25-Mar-08 10:28 
GeneralRe: .NET Framework Class Library Pin
JBAK_CP25-Mar-08 10:50
JBAK_CP25-Mar-08 10:50 
GeneralRe: .NET Framework Class Library Pin
led mike25-Mar-08 10:55
led mike25-Mar-08 10:55 
GeneralRe: .NET Framework Class Library Pin
Scott Dorman25-Mar-08 15:39
professionalScott Dorman25-Mar-08 15:39 
GeneralRe: .NET Framework Class Library Pin
Mark Salsbery25-Mar-08 16:01
Mark Salsbery25-Mar-08 16:01 
GeneralTracing internal method calls in aspect oriented programming Pin
mercurysmiles20-Mar-08 23:59
mercurysmiles20-Mar-08 23:59 
QuestionHow to sign the soap body in WCF Pin
konkola19-Mar-08 22:51
konkola19-Mar-08 22:51 
AnswerRe: How to sign the soap body in WCF Pin
MrMundial21-Apr-10 4:31
MrMundial21-Apr-10 4:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.