Asp.net DataProcessor and Schedule question

in the MVC example - a data processor is setup as:

            var dp = new dataProcessor("/Calendar/Save");
            dp.init(scheduler);
            dp.setTransactionMode("POST", false);

and then there is a CalendarController file with:

    public ActionResult Data()
    {

        PencilsDataContext data = new PencilsDataContext();
        return View(data.Events);
    }

    public ActionResult Save(Event changedEvent, FormCollection actionValues)
    {
        String action_type = actionValues["!nativeeditor_status"];
        Int64 source_id = Int64.Parse(actionValues["id"]);
        Int64 target_id = source_id;


        PencilsDataContext data = new PencilsDataContext();
        try
        {
            switch (action_type)
            {
                case "inserted":
                    changedEvent.event_details = actionValues["event_details"];
                    changedEvent.section2_id = 1;
                    data.Events.InsertOnSubmit(changedEvent);
                    break;
                case "deleted":
                    changedEvent = data.Events.SingleOrDefault(ev => ev.event_id == source_id);
                    data.Events.DeleteOnSubmit(changedEvent);
                    break;
                default: // "updated"
                    changedEvent = data.Events.SingleOrDefault(ev => ev.event_id == source_id);
                    changedEvent.event_details = actionValues["event_details"];                        
                    UpdateModel(changedEvent);
                    break;
            }
            data.SubmitChanges();
            target_id = changedEvent.event_id;
        }
        catch
        {
            action_type = "error";
        }

        return View(new CalendarActionResponseModel(action_type, source_id, target_id));
    }

I would REALLY appreciate an exmple of this using just straight forward .NET (non-mvc) code:

I have spent hours on hours trying to use the PHP examples to figure this out but I don’t use (nor ever have) PHP so I cannot relate the two together…

thanks,

You can check

dhtmlx.com/docs/products/dhtmlxC … ndex.shtml
dhtmlx.com/x/download/regula … 09_net.zip
docs.dhtmlx.com/doku.php?id=dhtm … tornet:toc

This is server side solution, for .NET, which doesn’t use MVC

Thanks for the quick reply but I guess my question forgot to mention that I had a look at the DHTMLXconnector and I could not find any examples in .NET that gave me the save flexability for the CRUD actions simular to :

switch (action_type)
{
case “inserted”:
changedEvent.event_details = actionValues[“event_details”];
changedEvent.section2_id = 1;
data.Events.InsertOnSubmit(changedEvent);
break;
case “deleted”:
changedEvent = data.Events.SingleOrDefault(ev => ev.event_id == source_id);
data.Events.DeleteOnSubmit(changedEvent);
break;
default: // “updated”
changedEvent = data.Events.SingleOrDefault(ev => ev.event_id == source_id);
changedEvent.event_details = actionValues[“event_details”];
UpdateModel(changedEvent);
break;
}

This is my frustration - I need to be able to catch the CRUD before that update in order to work with the data before the connector update the database

Check “custom server side events”
docs.dhtmlx.com/doku.php?id=dhtm … ex_updates

Basically you can define custom server side handlers, which will be activated for insert|update|delete actions. In above article they just alters some data, but you can place custom saving logic in them.

Be sure to call
e.DataAction.SetCompleted();
from them, to stop default auto-processing.

Thanks Stanislav,

I will start working on this using your suggestion