Hello,
I am currently using dhtmlxConnector.NET.dll but I would like to do some extra validation and insert some data in custom tables before/after an event(appointment) is created.
How can I achieved this? Basically I want to validate something before creation of the appointment(“beforeUpdate” event ?) and create a record in another table (log) after an appointment is inserted/updated.
Any idea is highly appreciated.
Thanks in advance,
Cristian
hi,
check grid validation sample in connectors package
there is BeforeInsert and Inserted events
[code]public override IdhtmlxConnector CreateConnector(HttpContext context)
{
dhtmlxGridConnector connector = new dhtmlxGridConnector(
“BookStore”,
“sales, title, author, price, instore, shipping, bestseller, pub_date”,
“book_id”,
dhtmlxDatabaseAdapterType.SqlServer2005,
ConfigurationManager.ConnectionStrings[“SamplesDatabase”].ConnectionString
);
connector.Inserted += new EventHandler(connector_AfterProcessing);
connector.BeforeInsert += new EventHandler(connector_BeforeProcessing);
return connector;
}
void connector_BeforeProcessing(object sender, DataActionProcessingEventArgs e)
{
if (string.IsNullOrEmpty(e.DataAction.Data[(TableField)"title"]))
e.DataAction.SetInvalid("Book title cannot be empty!");
if (string.IsNullOrEmpty(e.DataAction.Data[(TableField)"author"]))
e.DataAction.SetInvalid("Book author cannot be empty!");
}
void connector_AfterProcessing(object sender, DataActionProcessingEventArgs e)
{
//e.DataAction.PostoperationalPrimaryKeyValue - new item id
}
[/code]
Thanks Aliaksandr, your solution works prefectly.
public override IdhtmlxConnector CreateConnector(HttpContext context)
{
//return new dhtmlxSchedulerConnector(
dhtmlxSchedulerConnector connector = new dhtmlxSchedulerConnector(
"BookStore",
"sales, title, author, price, instore, shipping, bestseller, pub_date",
"book_id".....
);
connector.Inserted += new EventHandler<DataActionProcessingEventArgs>(connector_AfterProcessing);
connector.BeforeInsert += new EventHandler<DataActionProcessingEventArgs>(connector_BeforeProcessing);
return connector;
}