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);
 }
 public InvoiceService(Invoicedto invoicedto)
 {
     dataserviceFactory = new DataserviceFactory(invoicedto.oAuthTokens);
     dataService = dataserviceFactory.getDataService();
     invoiceRepository = new InvoiceRepository();
 }