1

我正在构建一个将数据发布到谷歌日历的事件系统。我正在使用 jquery 1.4.2、fullcalendar 1.4.5 和 asp.net MVC 2。我正在为入口系统使用 jquery ui 模式对话框。用于 from 和 to 字段的 Jquery ui datepicker。选择时间字段的框。我已经在 GCalEvent 类中为 startDate、startTime、endDate 和 endTime 尝试了字符串和 DateTime 格式。

我收到一个空引用,其中包含传递给控制器​​ Action 方法的日期。

var gcalevent = {
     'eventID': $('#eventID').val(),
     'eventURL': $('#eventURL').val(),
     'date': {
         'startDate': $("#from").val(),
         'startTime': $('#eventStartHour option:selected').val() + ":"
                      + $('#eventStartMin option:selected').val()
                      + $('#eventStartAMPM option:selected').val(),
         'endDate': $('#to').val(),
         'endTime': $('#eventEndHour option:selected').val() + ":"
                    + $('#eventEndMin option:selected').val()
                    + $('#eventEndAMPM option:selected').val()
     },
     'allDay': $('#chkAllDay').attr('checked'),
     'where': $('#eventWhere').val(),
     'eventTitle': $('#eventTitle').val(),
     'eventDescription': $('#eventDescription').val()
};

$.post("/home/AddRepeatingEvent", gcalevent, addEventCallback);

public void AddNonRepeatingEvent(Models.GCalEvent gcalevent)
    {
        IGCalRepository _gcalrepo;
        GCalRepository gcalrepo = new GCalRepository();
        _gcalrepo = gcalrepo;
        //_gcalrepo.AddEvent(gcalevent);
        GetGoogleEventURL(gcalevent.eventID.ToString());
    }

public enum Days
{
    Sun,
    Mon,
    Tue,
    Wed,
    Thur,
    Fri,
    Sat
}
public enum DefaultCalendarView
{
    Month,
    Day,
    Week
}
public enum OrderType
{
    First,
    Second,
    Third,
    Fourth,
    Last
}
public abstract class RepeatBaseType
{      
}
public class GCalEvent
{
    public string title { get; set; }
    public string description { get; set; }
    public string where { get; set; }
    public bool repeated { get; set; }
    public bool allDay { get; set; }
    public DefaultCalendarView defaultCalendarView { get; set; }
    public GCalEventDate date { get; set; }
    public RepeatBaseType repeatType { get; set; }
    public string eventID { get; set; }
    public string eventURL { get; set; }

}
public class GCalEventDate
{
    public string startDate { get; set; }
    public string startTime { get; set; }
    public string endDate {get;set;}
    public string endTime  {get;set;}        
}
internal class Duration
{
    int Days { get; set; }
    int Hours { get; set; }
    int Minutes { get; set; }
}
public class RepeatedDaily: RepeatBaseType
{
    public int Days { get; set; }
}
public class RepeatedWeekly : RepeatBaseType
{
    public int Weeks { get; set; }        
    public Days[] days { get; set; }
}
public class RepeatedMonthly : RepeatBaseType
{
    public int Months { get; set; }
    public RepeatedMonthlyType repeatedMonthlyType { get; set; }       
}
public class RepeatedYearly : RepeatBaseType
{
  public int Years {get;set;}
}
public abstract class RepeatedMonthlyType
    {                    
    }
public class RepeatedMonthlyDayOfWeek : RepeatedMonthlyType
{
    public Days[] DayOfWeek { get; set; }
    public OrderType orderType { get; set; }
}
public class RepeatedMonthlyDayOfMonth : RepeatedMonthlyType
{
    public DateTime DayOfMonth { get; set; }
}

这是我第一次尝试使用抽象类。谢谢您的帮助。

4

0 回答 0