for an Example of setting default values when the object is created
If there is a current object, which should be specified by default when you create another object, you can override Edit, where to check, what is the status of a load data is defined as ObjectStatus.Created
, and then install the current object of interest in the field and to reflect the changes on the form using EditManager
.
public override void Edit(ICSSoft.STORMNET.DataObject dataobject, string contpath, string propertyname, object tag)
{
base.Edit(dataobject, contpath, propertyname, tag); //call the base method
if (dataobject != null)
{
if (dataobject.GetStatus() == ObjectStatus.Created) //check that the object is not yet persisted
{
((Покупка)dataobject).МагазинПокупки = Магазин.CurrentShop; //set a current object
EditManager.Change("Shop"); //display changes on the form
}
}
}