public JsonResult Save(Int64 id, Int64 qboId)
 {
     Invoicedto invoicedto = id > 0 ? new InvoiceRepository().Get(this, id) : new Invoicedto();
     invoicedto.timeQboId = qboId;
     invoiceService = new InvoiceService(invoicedto);
     invoicedto = invoiceService.GenerateInvoice(invoicedto);
     invoicedto = invoiceService.UpdateDatabase(invoicedto);
     //invoicedto = invoiceService.FillCreatedInvoice(invoicedto);
     invoiceRepository = new InvoiceRepository();
     invoicedto = invoiceRepository.Save(this, invoicedto);
     object data = new
     {
         Id = invoicedto.Id
     };
     return Json(data, JsonRequestBehavior.AllowGet);
 }
 public ActionResult Load(Int64 id)
 {
     TimeActivitydto timeActivitydto = id > 0 ? new TimeActivityRepository().Get(this, id) : new TimeActivitydto();
     invoicedto.oAuthTokens = timeActivitydto.oAuthTokens;
     invoicedto.CustomerList = timeActivitydto.CustomerList;
     invoicedto.CompanyId = invoicedto.oAuthTokens.Realmid;
     invoicedto.ConnectionString = timeActivitydto.Syncdto.ConnectionString;
     invoicedto.TimeActivityDto = timeActivitydto;
     invoiceService = new InvoiceService(invoicedto);
     invoicedto = invoiceService.LoadPending(invoicedto);
     invoicedto = invoiceService.LoadInvoiced(invoicedto);
     invoiceRepository = new InvoiceRepository();
     invoicedto = invoiceRepository.Save(this, invoicedto);
     multiplemodels = new Multiplemodels();
     multiplemodels.TimeActivityModel = timeActivitydto;
     multiplemodels.InvoiceModel = invoicedto;
     multiplemodels.SyncObjectsModel = invoicedto.TimeActivityDto.Syncdto;
     multiplemodels.IsConnected = timeActivitydto.oAuthTokens.IsConnected;
     multiplemodels.IsReadyTimeentry = true;
     multiplemodels.IsReadytoInvoice = true;
     multiplemodels.IsReadySync = false;
     return View("Invoices", multiplemodels);
 }
 /// <summary>
 /// View is resposible for rendering the final view
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult View(Int64 id)
 {
     Invoicedto invoicedto = id > 0 ? new InvoiceRepository().Get(this, id) : new Invoicedto();
     invoiceService = new InvoiceService(invoicedto);
     invoicedto = invoiceService.LoadPending(invoicedto);
     invoicedto = invoiceService.LoadInvoiced(invoicedto);
     multiplemodels = new Multiplemodels();
     multiplemodels.TimeActivityModel = invoicedto.TimeActivityDto;
     multiplemodels.InvoiceModel = invoicedto;
     multiplemodels.SyncObjectsModel = invoicedto.TimeActivityDto.Syncdto;
     multiplemodels.IsReadySync = multiplemodels.SyncObjectsModel.IsEmployeeSync | multiplemodels.SyncObjectsModel.IsCustomerSync | multiplemodels.SyncObjectsModel.IsServiceItemSync;
     multiplemodels.IsReadyTimeentry = true;
     multiplemodels.IsReadytoInvoice = false;
     return View("Invoices", multiplemodels);
 }