Hi all,
I have several queries I'd like a little help on.
1. I would like to enable/disable/hide some property editors depending on whether a DetailView is opened to add a new object
or is editing an existing object.
2. I'd like to have my views customized in code e.g. performing the following tasks:
a) adding a lookup editor to detail view and adding it to the layout.
b) adding a tabbed group in detail view and rearranging the layout.
3. I'd like to update one property based on the value of another which gets it value from the database. See commented
section. Also, I'd like to disable the LotNo property editor if the AutoGenerateLotNo is true (see 1 above), but I cant quite
get it right.
[DefaultClassOptions]
public class Account : BaseObject
{
bool mAutoGenerateLotNo;
[NonPersistent]
public bool AutoGenerateLotNo
{
get { return mAutoGenerateLotNo; }
set
{
SetPropertyValue("AutoGenerateLotNo", ref mAutoGenerateLotNo, value);
if (this.Session.IsNewObject(this) && this.AutoGenerateLotNo)
{
//Fetch the highest LotNo, increment it by one and assign it
//to LotNo i.e. 'Auto-Generate' the number
}
}
}
int mLotNo;
public int LotNo
{
get { return mLotNo; }
set { SetPropertyValue("LotNo", ref mLotNo, value); }
}
public override void AfterConstruction()
{
base.AfterConstruction();
this.AutoGenerateLotNo = true;
}
public Account() : this(Session.DefaultSession) { }
public Account(Session session) : base(session) { }
}
4. I have the following objects:
public enum TypeOfAuction { Main, Secondary };
[DefaultClassOptions]
public class AuctionType : BaseObject
{
DateTime mAuctionDate;
public DateTime AuctionDate
{
get { return mAuctionDate; }
set { SetPropertyValue("AuctionDate", ref mAuctionDate, value); }
}
TypeOfAuction mTypeOfAuction;
public TypeOfAuction TypeOfAuction
{
get { return mTypeOfAuction; }
set { SetPropertyValue("TypeOfAuction", ref mTypeOfAuction, value); }
}
Auction mAuction;
[Association("Auction.AuctionType", typeof(Auction))]
public Auction Auction
{
get { return mAuction; }
set { SetPropertyValue("Auction", ref mAuction, value); }
}
public AuctionType() : this(Session.DefaultSession) { }
public AuctionType(Session session) : base(session) { }
}
[DefaultClassOptions]
public class Auction : BaseObject
{
[Custom("Caption", "Auction Types")]
[Association("Auction.AuctionType"), Aggregated]
public XPCollection<AuctionType> AuctionTypeCollection
{
get { return GetCollection<AuctionType>("AuctionTypeCollection"); }
}
public Auction() : this(Session.DefaultSession) { }
public Auction(Session session) : base(session) { }
}
I would like each AuctionType in Auction to be unique i.e. for each TypeOfAuction (enum) value there should be only one
AuctionType and All enum values should be represented. How do I build this criteria?
How do I go about achieving all these? Any help would be greatly appreciated.
Regards,
Keith.