if (param.action == "insert" || (param.action == "batch" && param.added != null)) // this block of code will execute while inserting the appointments
{
var value = param.action == "insert" ? param.value : param.added[0];
DateTime startTime = Convert.ToDateTime(value.StartTime);
DateTime endTime = Convert.ToDateTime(value.EndTime);
var currentTimeZone = TimeZone.CurrentTimeZone;
Appointment appoint = new Appointment()
{
StartTime = startTime,
EndTime = endTime,
Subject = value.Subject,
Description = value.Description,
Recurrence = value.Recurrence,
AllDay = value.AllDay,
RecurrenceRule = value.RecurrenceRule,
};
db.Appointments.InsertOnSubmit(appoint);
db.SubmitChanges();
}
|
if (param.action == "insert" || (param.action == "batch" && param.added != null)) // this block of code will execute while inserting the appointments
{
var value = param.action == "insert" ? param.value : param.added[0];
//int intMax = db.Appointments.ToList().Count > 0 ? db.Appointments.ToList().Max(p => p.Id) : 1;
DateTime startTime = Convert.ToDateTime(value.StartTime);
DateTime endTime = Convert.ToDateTime(value.EndTime);
var currentTimeZone = TimeZone.CurrentTimeZone;
Appointment appoint = new Appointment()
{
Id = value.Id,
StartTime = startTime,
EndTime = endTime,
Subject = value.Subject,
Description = value.Description,
Recurrence = value.Recurrence,
AllDay = value.AllDay,
RecurrenceRule = value.RecurrenceRule,
};
db.Appointments.InsertOnSubmit(appoint);
db.SubmitChanges();
}
|