public async Task <JsonResult> All() { UserCredential credential; CancellationToken cancellationToken; //get all the task for the current user, var l = new List <GanttTaskModel>(); var result = await new AuthorizationCodeMvcApp(this, new AppFlowMetaData()). AuthorizeAsync(cancellationToken); if (result.Credential != null) { credential = result.Credential; // Create Google Sheets API service. var service = new SheetsService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName, }); // Define request parameters. String spreadsheetId = "1ea3HupjO8snbOxzHIW2mDVT-pX4GsRE5lnJZXHSv4sA"; String range = "Sheet1!A:I"; SpreadsheetsResource.ValuesResource.GetRequest request = service.Spreadsheets.Values.Get(spreadsheetId, range); // Prints the names and majors of students in a sample spreadsheet: // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit ValueRange response = request.Execute(); IList <IList <Object> > values = response.Values; if (values != null && values.Count > 0) { // foreach (var row in values) for (int i = 1; i < values.Count - 1; i++) { var row = values[i]; // Print columns A and E, which correspond to indices 0 and 4. Console.WriteLine("{0}, {1}", row[0], row[1]); var t = new GanttTaskModel() { ID = Convert.ToInt32(row[0]), End = DateTime.Parse(row[3].ToString()), Expanded = true,// Convert.ToBoolean(row[6]), OrderID = 1, ParentID = Convert.ToInt32(row[7]), PercentComplete = Convert.ToDecimal(row[4]), Start = DateTime.Parse(row[2].ToString()), Summary = Convert.ToBoolean(row[6]), Title = row[1].ToString() }; l.Add(t); } } else { // Console.WriteLine("No data found."); } // Console.Read(); } return(Json(l, JsonRequestBehavior.AllowGet)); }
public void AddTask(GanttTaskModel task) { AddTask(task); }
public GanttTaskViewModel(GanttTaskModel task) { _task = task; }