public async Task <JsonResult> GetReport(string type, List <int> userIDs, DateTime reportDate) { if (string.IsNullOrEmpty(type)) { return(null); } string result = string.Empty; ITaskReport iReport = null; //根据类型不同创建不同的工厂 if (type == "daily") { iReport = new daily(); } else if (type == "weekly") { iReport = new weekly(); } else if (type == "monthly") { iReport = new monthly(); } result = await iReport.CreateReport(userIDs, reportDate); return(Json(result)); }
// you can use an IObjectSpace parameter in method logics to perform Object Space specific actions public static ITaskReport CreateReport(ITask task, IObjectSpace objectSpace, string text) { ITaskReport report = objectSpace.CreateObject <ITaskReport>(); report.Text = text; return(report); }