Domanda

recently our boss ask me to make a web base reservation of room for meeting..

and he said its database has to be MySQL with windows authentication

so after goggling for about 2 days ive decided to use the fullcalendar because its an open source

and i found a good article about using fullcalendar in mvc-4

http://www.codeproject.com/Articles/638674/Full-calendar-A-complete-web-diary-system-for-jQue

but his database backend is MSSQL..but lucky i happen to change it to MySQL but the problem is when i try to query using entity framework linq i got an exception which says the Function AddMinutes doesn't exist in MySQL

but when i try MSSQL database backend it works but not in MySQL backend.

here is the sample of my project https://drive.google.com/file/d/0B7vFDG3kiOeCenpqdTFlOEFPajg/edit?usp=sharing

ive comment out the query

var rslt = ent.appointments; //.Where( s => s.DateTimeScheduled >= fromDate && System.Data.Objects.EntityFunctions.AddMinutes( s.DateTimeScheduled, s.AppointmentLength ) <= toDate );
                                                        //.GroupBy( s => System.Data.Objects.EntityFunctions.TruncateTime( s.DateTimeScheduled ) )
                                                        //.Select( x => new { DateTimeScheduled = x.Key, Count = x.Count( ) } );

it is in the function

public static List<AppointmentEventsModel> LoadAppointmentSummaryInDateRange( double start, double end )

please guide me if im doing wrong... thanks in advance

È stato utile?

Soluzione

Use the DATE_ADD function for MySQL instead. See here http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add

if you hardcode the appointment length, that part of the query would look like,

... && DATE_ADD(s.DateTimeScheduled, INTERVAL 30 MINUTE) <= toDate ...
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top