您好,我是ASP NET的初学者,我被要求隐藏"注册向导"小组在特定日期之前和之后的2周。我相信我们正在使用JSon来显示面板。我不确定如何实现这一点,因为无法找到任何东西。
module PrestigeWorldWide.Scripts.ViewModels {
export class IndexViewModel extends BaseViewModels.BaseViewModel {
public panels: KnockoutObservableArray<IPanelObject> = ko.observableArray<IPanelObject>();
public events: KnockoutObservableArray<FullCalendar.EventObject> = ko.observableArray<any>();
constructor() {
super();
this.panels.push({
Name: "My Transcript",
Desc: "View your unofficial QUB transcript",
Icon: "fa-file-text",
Link: "/PrestigeWorldwide/Grade/ViewTranscript"
});
this.panels.push({
Name: "Module Info",
Desc: "View the information on all modules including pre-requisites and course content",
Icon: "fa-folder-open",
Link: "/PrestigeWorldwide/Module/ModuleInfo"
});
this.panels.push({
Name: "Enrollment Wizard",
Desc: "Enroll for modules and enter further information about yourself - emergency contacts etc.",
Icon: "fa-magic",
Link: "/PrestigeWorldwide/Registration/Index"
});
this.getEvents();
}
getEvents() {
var url = "/PrestigeWorldwide/Class/GetStudentClasses";
this.loading(true);
$.ajax(url).done((events: FullCalendar.EventObject[]) => {
this.loading(false);
_.each(events, (event) => {
this.events.push(event);
});
});
}
}
export interface IPanelObject {
Name: string;
Desc: string;
Icon: string;
Link?: string;
}
}
答案 0 :(得分:0)
只需在添加面板之前添加日期检查:
DateTime cutOffDateStart = new DateTime() // Insert 2 weeks before here
DateTime cutOffDateEnd = new DateTime() // Insert 2 weeks after here
if (DateTime.Now >= cutOffDateStart && DateTime.Now < cutOffDateEnd)
{
panels.Add(new Panel()
{
Name = "Registration Wizard",
Desc = "Use this tool to enrol for the new semester.",
Icon = "fa-pencil"
});
}