private void CreateTask(BillingAccount billingAccount) { // This creates a new task based on the billing account, and then stores into the task repo ScrapeTask newTask = scrapeTaskFactory.NewScrapeTask(billingAccount); taskRepo.SaveScrapeTask(newTask); }
public void CreateStatement_ExpectValid() { //Arrange string localStatementIdString = "STMT01"; StatementId localStatementId = new StatementId(localStatementIdString); SpecificFieldsFactory localfactory = new SpecificFieldsFactory(); string[] listspecificfields = { "Credit Card", "12" }; StatementType localStatementType = new StatementType(localfactory, "CreditCardProvider", listspecificfields); StatementSpecificFields localspecificfields = localStatementType.getSpecificFields(); int localstatementAccountnumber = 1234567; string localstatementAccountholdername = "Bruce"; DateTime localstatementDate = DateTime.Now; StatementCommonFields localStatementCommonFields = new StatementCommonFields(localstatementAccountnumber, localstatementAccountholdername, localstatementDate); APSUser localAPSUser = new APSUser(new APSUserId("1"), "testusername", "testpassword"); BillingAccount localBillingAccount = new BillingAccount(new BillingAccountId("1"), new BillingCompanyId("1"), "testusername", "testpassword", localAPSUser); //Act Statement localStatement = new Statement(localStatementId, localStatementCommonFields, localStatementType, localspecificfields, localAPSUser, localBillingAccount); //Assert Assert.AreEqual(localStatement.StatementId, localStatementId); Assert.AreEqual(localStatement.StatementCommonFields, localStatementCommonFields); Assert.AreEqual(localStatement.StatementType, localStatementType); Assert.AreEqual(localStatement.StatementSpecificFields, localspecificfields); Assert.AreEqual(localStatement.APSUser, localAPSUser); Assert.AreEqual(localStatement.BillingAccount, localBillingAccount); }
public bool Create(BillingAccount b) { bool result = false; if (b != null) { bvb_BillingAccount x = new bvb_BillingAccount(); CopyModelToData(x, b); try { if (context != null) { context.bvb_BillingAccounts.InsertOnSubmit(x); context.SubmitChanges(); result = true; // Copy back to model so we get new ID number CopyDataToModel(x, b); } } catch { result = false; } } return result; }
public GetPatientResp GetPatient(long customerId, BillingAccount billingAccount) { try { var client = new KareoServicesClient(); var requestHeader = new RequestHeader { ClientVersion = ClientVersion, CustomerKey = billingAccount.CustomerKey, User = billingAccount.UserName, Password = billingAccount.Password }; var getPatientReq = new GetPatientReq { RequestHeader = requestHeader, Filter = new SinglePatientFilter { ExternalID = customerId.ToString() } }; var getPatientResp = client.GetPatient(getPatientReq); client.Close(); return(getPatientResp); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static void CRUDExample(CorrigoService service) { if (service == null) { return; } Console.WriteLine("BillingAccount is Readonly - NonCreatable, NonDeletable, NonUpdatable"); BillingAccount ba = Create.Execute(service); var billingAccounts = Read.RetrieveMultiple(service); Read.RetrieveByQuery(service); if (billingAccounts != null && billingAccounts.Length > 0) { Read.Retrieve(service, billingAccounts[0].Id); Delete.Execute(service, billingAccounts[0].Id); // BillingAccount is Readonly - NonCreatable, NonDeletable, NonUpdatable Update.Restore(service, (BillingAccount)billingAccounts[0]); // BillingAccount is Readonly - NonCreatable, NonDeletable, NonUpdatable Update.Execute(service, (BillingAccount)billingAccounts[0]); // BillingAccount is Readonly - NonCreatable, NonDeletable, NonUpdatable } }
// BillingAccount is Readonly - NonCreatable, NonDeletable, NonUpdatable public static void Execute(CorrigoService service, BillingAccount toUpdate) { if (toUpdate == null || service == null) { return; } toUpdate.DisplayAs = (toUpdate.DisplayAs ?? "") + "."; Console.WriteLine(); Console.WriteLine($"Updating BillingAccount with id={toUpdate.Id.ToString()}"); var resultUpdate = service.Execute(new UpdateCommand { Entity = toUpdate, PropertySet = new PropertySet { Properties = new[] { "DisplayAs" } } }); if (resultUpdate == null) { Console.WriteLine("Update of BillingAccount failed"); return; } if (resultUpdate.ErrorInfo != null && !string.IsNullOrEmpty(resultUpdate.ErrorInfo.Description)) { Console.WriteLine(resultUpdate.ErrorInfo.Description); Console.WriteLine("Update of BillingAccount failed"); return; } Console.WriteLine("BillingAccount is updated"); }
public bool Update(BillingAccount a) { bool result = false; if (a != null) { try { var x = (from n in context.bvb_BillingAccounts where n.Id == a.Id select n).SingleOrDefault(); if (x != null) { CopyModelToData(x, a); context.SubmitChanges(); result = true; } } catch { result = false; } } return result; }
public static void Restore(CorrigoService service, BillingAccount toRestore) { if (toRestore == null || service == null) { return; } Console.WriteLine(); Console.WriteLine($"Restoring BillingAccount with id={toRestore.Id.ToString()}"); var restoreResult = service.Execute(new RestoreCommand { EntitySpecifier = new EntitySpecifier { Id = toRestore.Id, EntityType = EntityType.BillingAccount } }); if (restoreResult == null) { Console.WriteLine("Update of BillingAccount failed"); return; } if (restoreResult.ErrorInfo != null && !string.IsNullOrEmpty(restoreResult.ErrorInfo.Description)) { Console.WriteLine(restoreResult.ErrorInfo.Description); Console.WriteLine("Restore of BillingAccount failed"); return; } Console.WriteLine("BillingAccount is restored"); }
public ScrapeTask NewScrapeTask(BillingAccount billingAccount) { // This method builds a new task with its dependencies and returns it to the caller // All build logic is encapsulated in this method // Values are derived from the billingAccount object // The 3 rule types are created to exist with the task for future use, which could be // a retry after a scrape failed, and so on. // For the purposes of this prototype, some fake values will be entered StatementLifeCycleRule lifeCycleRule = new StatementLifeCycleRule(30, 5, 2); List <RetryAfterUnsuccessfulScrapeRule> retryRules = new List <RetryAfterUnsuccessfulScrapeRule>(); retryRules.Add(new RetryAfterUnsuccessfulScrapeRule(ScheduleErrorType.APSError, 5)); retryRules.Add(new RetryAfterUnsuccessfulScrapeRule(ScheduleErrorType.NoNewStatementError, 6)); retryRules.Add(new RetryAfterUnsuccessfulScrapeRule(ScheduleErrorType.ScraperError, 7)); List <WindowPeriodRule> windowPeriods = new List <WindowPeriodRule>(); windowPeriods.Add(new WindowPeriodRule(new TimeOfDay(1, 0, 0), new TimeOfDay(6, 0, 0))); windowPeriods.Add(new WindowPeriodRule(new TimeOfDay(19, 0, 0), new TimeOfDay(23, 0, 0))); ScrapeTask newTask = new ScrapeTask(Guid.NewGuid().ToString(), billingAccount.BillingAccountId.ToString(), windowPeriods, retryRules, lifeCycleRule); return(newTask); }
public ActionResult DeleteConfirmed(int id) { BillingAccount billingAccount = db.BillingAccounts.Find(id); db.BillingAccounts.Remove(billingAccount); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary>Snippet for GetBillingAccount</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetBillingAccountResourceNames() { // Create client CloudBillingClient cloudBillingClient = CloudBillingClient.Create(); // Initialize request argument(s) BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"); // Make the request BillingAccount response = cloudBillingClient.GetBillingAccount(name); }
public BillingAccount GetBillingAccountFromDB(ConnectedServices _googleConnect) { var oauth2Service = _googleConnect.GetOauth2Service(); var userInfo = oauth2Service.Userinfo.Get().Execute(); Client client = db.Clients.SingleOrDefault(c => c.Email == userInfo.Email); BillingAccount billingAccount = db.BillingAccounts.SingleOrDefault(b => b.Id == client.BillingAccountId); return(billingAccount); }
private static void CopyModelToData(bvb_BillingAccount data, BillingAccount model) { data.Email = model.Email; data.Id = model.Id; data.BillingZipCode = model.BillingZipCode; string json = MerchantTribe.Web.Json.ObjectToJson(model.CreditCard); string key = MerchantTribe.Web.Cryptography.KeyManager.GetKey(0); data.CreditCard = MerchantTribe.Web.Cryptography.AesEncryption.Encode(json, key); }
/// <summary>Snippet for CreateBillingAccount</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateBillingAccount() { // Create client CloudBillingClient cloudBillingClient = CloudBillingClient.Create(); // Initialize request argument(s) BillingAccount billingAccount = new BillingAccount(); // Make the request BillingAccount response = cloudBillingClient.CreateBillingAccount(billingAccount); }
/// <summary>Snippet for GetBillingAccount</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetBillingAccount() { // Create client CloudBillingClient cloudBillingClient = CloudBillingClient.Create(); // Initialize request argument(s) string name = "billingAccounts/[BILLING_ACCOUNT]"; // Make the request BillingAccount response = cloudBillingClient.GetBillingAccount(name); }
public GetChargesResp GetClaim(BillingAccount billingAccount, long eventId, DateTime eventDate) { var client = new KareoServicesClient(); var requestHeader = new RequestHeader { ClientVersion = ClientVersion, CustomerKey = billingAccount.CustomerKey, User = billingAccount.UserName, Password = billingAccount.Password }; var getChargesReq = new GetChargesReq { RequestHeader = requestHeader, Filter = new ChargeFilter() { PracticeName = billingAccount.Name, BatchNumber = eventId.ToString(), FromServiceDate = eventDate.AddDays(-1).ToShortDateString(), ToServiceDate = eventDate.AddDays(1).ToShortDateString() }, Fields = new ChargeFieldsToReturn() { ID = true, EncounterID = true, PatientID = true, ProcedureCode = true, ProcedureName = true, Units = true, TotalCharges = true, AdjustedCharges = true, Receipts = true, PatientBalance = true, InsuranceBalance = true, TotalBalance = true, Status = true, PatientFirstBillDate = true, PatientLastBillDate = true } }; var getChargesResp = client.GetCharges(getChargesReq); if (getChargesResp.ErrorResponse.IsError) { throw new Exception(getChargesResp.ErrorResponse.ErrorMessage); } if (!getChargesResp.SecurityResponse.SecurityResultSuccess) { throw new Exception(getChargesResp.SecurityResponse.SecurityResult); } client.Close(); return(getChargesResp); }
/// <summary>Snippet for GetBillingAccountAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetBillingAccountResourceNamesAsync() { // Create client CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync(); // Initialize request argument(s) BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"); // Make the request BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(name); }
/// <summary>Snippet for CreateBillingAccountAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task CreateBillingAccountAsync() { // Create client CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync(); // Initialize request argument(s) BillingAccount billingAccount = new BillingAccount(); // Make the request BillingAccount response = await cloudBillingClient.CreateBillingAccountAsync(billingAccount); }
/// <summary>Snippet for GetBillingAccountAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetBillingAccountAsync() { // Create client CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync(); // Initialize request argument(s) string name = "billingAccounts/[BILLING_ACCOUNT]"; // Make the request BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(name); }
public ActionResult Edit([Bind(Include = "Id,BillingAccountName,Description")] BillingAccount billingAccount) { if (ModelState.IsValid) { db.Entry(billingAccount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(billingAccount)); }
public async Task <ActionResult> MyProjects(CancellationToken cancellationToken) { var _googleConnect = new ConnectedServices(this, cancellationToken); var _isAutorize = await _googleConnect.Authorize(); if (_isAutorize == false) { return(RedirectToAction("Index", "Home")); } // get user Email var oauth2Service = _googleConnect.GetOauth2Service(); var userInfo = oauth2Service.Userinfo.Get().Execute(); Client client = db.Clients.SingleOrDefault(c => c.Email == userInfo.Email); if (client == null) { // logout User - todo - below seems not working. var AuthResult = _googleConnect.GetAuthResult(); AuthResult.Credential = null; Session.Abandon(); //-------------------------// // Inform the user - his email has no billing account assigned. return(RedirectToAction("EmailNoBillingAccount", "GoogleProjects", new { email = userInfo.Email })); } BillingAccount billingAccount = db.BillingAccounts.SingleOrDefault(b => b.Id == client.BillingAccountId); var billingNumber = "billingAccounts/" + billingAccount.BillingAccountName; var projects = RetriveProjects(_googleConnect); var linkedProjects = RetriveProjectsInBilling(_googleConnect, billingNumber); foreach (Project project in projects) { var _linkProject = linkedProjects.SingleOrDefault(p => p.ProjectId == project.ProjectId); project.IsLinked = false; project.IsLinkedText = "No"; if (_linkProject != null) { project.IsLinked = true; project.IsLinkedText = "Yes"; project.TableTrClass = "success"; project.TableRadioButton = "disabled"; } } return(View(projects)); }
public void AddBillingAccount(BillingAccount billingAccount) { if (billingAccount != null) { _billingAccounts.Add(billingAccount); } else { throw new ArgumentNullException(); } }
public ActionResult Create([Bind(Include = "Id,BillingAccountName,Description")] BillingAccount billingAccount) { if (ModelState.IsValid) { db.BillingAccounts.Add(billingAccount); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(billingAccount)); }
private static void CopyDataToModel(bvb_BillingAccount data, BillingAccount model) { model.Email = data.Email; model.Id = data.Id; model.BillingZipCode = data.BillingZipCode; string key = MerchantTribe.Web.Cryptography.KeyManager.GetKey(0); if (data.CreditCard.Trim().Length > 2) { string json = MerchantTribe.Web.Cryptography.AesEncryption.Decode(data.CreditCard, key); model.CreditCard = MerchantTribe.Web.Json.ObjectFromJson<MerchantTribe.Payment.CardData>(json); } }
private void SaveCustomerBillingAccount(BillingAccount billingAccount, long patientId, long customerId) { var customerBillingAccount = new CustomerBillingAccount() { BillingAccountId = billingAccount.Id, BillingPatientId = patientId, CustomerId = customerId, DateCreated = DateTime.Now }; _customerBillingAccountRepository.Save(customerBillingAccount); }
public bool InsertBillingAccount(BillingAccount BA) { try { FakeData.BillingAccounts.Add(BA); return(true); } catch { return(false); } }
/// <summary>Snippet for GetBillingAccount</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetBillingAccountRequestObject() { // Create client CloudBillingClient cloudBillingClient = CloudBillingClient.Create(); // Initialize request argument(s) GetBillingAccountRequest request = new GetBillingAccountRequest { BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"), }; // Make the request BillingAccount response = cloudBillingClient.GetBillingAccount(request); }
/// <summary>Snippet for CreateBillingAccount</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateBillingAccountRequestObject() { // Create client CloudBillingClient cloudBillingClient = CloudBillingClient.Create(); // Initialize request argument(s) CreateBillingAccountRequest request = new CreateBillingAccountRequest { BillingAccount = new BillingAccount(), }; // Make the request BillingAccount response = cloudBillingClient.CreateBillingAccount(request); }
// BillingAccount is Readonly - NonCreatable, NonDeletable, NonUpdatable public static BillingAccount Execute(CorrigoService service) { Console.WriteLine(); Debug.Print("Creating BillingAccount"); Console.WriteLine("Creating BillingAccount"); var toCreate = new BillingAccount { DisplayAs = "Test Name" + $".ByWSDK.{DateTime.Now.ToShortDateString()} {DateTime.Now.ToShortTimeString()}", Number = "Test BA Number" }; var resultData = service.Execute(new CreateCommand { Entity = toCreate }); if (resultData == null) { Debug.Print("Creation of new BillingAccount failed"); Console.WriteLine("Creation of new BillingAccount failed"); Console.WriteLine(); return(null); } var commandResponse = resultData as OperationCommandResponse; int?id = (commandResponse != null && commandResponse.EntitySpecifier != null) ? commandResponse.EntitySpecifier.Id : null; if (id.HasValue && resultData.ErrorInfo == null) { toCreate.Id = id.Value; Debug.Print($"Created new BillingAccount with Id={id.ToString()}"); Console.WriteLine($"Created new BillingAccount with Id={id.ToString()}"); Console.WriteLine(); return(toCreate); } Debug.Print("Creation of new BillingAccount failed"); Console.WriteLine("Creation of new BillingAccount failed"); Console.WriteLine(); if (resultData.ErrorInfo != null && !string.IsNullOrEmpty(resultData.ErrorInfo.Description)) { Debug.Print(resultData.ErrorInfo.Description); Console.WriteLine(resultData.ErrorInfo.Description); } return(null); }
public BillingAccount FindOrCreate(BillingAccount a) { foreach (BillingAccount b in Accounts) { if (b.Email == a.Email) { return b; } } a.Id = Accounts.Count + 1; Accounts.Add(a); return a; }
public ActionResult Link(LinkBillingAccountViewModel Model) { if (ModelState.IsValid) { APSUser MyUser = AccountRepo.GetUserAccountByUserID(FakeData.UserID); BillingAccount BA = new BillingAccount(new BillingAccountId(Guid.NewGuid().ToString()), new BillingCompanyId(Model.CompanyID), Model.Username, Model.Password, MyUser); BillingAccountRepo.InsertBillingAccount(BA); return(RedirectToAction("Index")); } ViewBag.CompanyID = new SelectList(FakeData.BillingCompanies, "BillingCompanyId.IdString", "CompanyName"); return(View(Model)); }
public BillingAccount FindOrCreate(string email) { foreach (BillingAccount b in Accounts) { if (b.Email == email.Trim().ToLowerInvariant()) { return b; } } BillingAccount a = new BillingAccount(); a.Email = email.Trim().ToLowerInvariant(); a.Id = Accounts.Count + 1; Accounts.Add(a); return a; }
public List<BillingAccount> FindAll() { List<BillingAccount> result = new List<BillingAccount>(); try { var x = context.bvb_BillingAccounts.ToList(); if (x != null) { foreach (bvb_BillingAccount n in x) { BillingAccount m = new BillingAccount(); CopyDataToModel(n, m); result.Add(m); } } } catch { result = new List<BillingAccount>(); } return result; }
public void Insert(string Name,double Defaultperdiemrate,bool IsDeleted,DateTime? CreatedOn,string CreatedBy,DateTime? ModifiedOn,string ModifiedBy,double Defaultmileagerate) { BillingAccount item = new BillingAccount(); item.Name = Name; item.Defaultperdiemrate = Defaultperdiemrate; item.IsDeleted = IsDeleted; item.CreatedOn = CreatedOn; item.CreatedBy = CreatedBy; item.ModifiedOn = ModifiedOn; item.ModifiedBy = ModifiedBy; item.Defaultmileagerate = Defaultmileagerate; item.Save(UserName); }
public BillingAccount FindById(long id) { BillingAccount result = null; try { var x = (from n in context.bvb_BillingAccounts where n.Id == id select n).SingleOrDefault(); if (x != null) { result = new BillingAccount(); CopyDataToModel(x, result); } } catch { result = null; } return result; }
public bool Update(BillingAccount a) { foreach (BillingAccount ba in Accounts) { if (ba.Id == a.Id) { ba.Email = a.Email; ba.CreditCard = a.CreditCard; } } return true; }
public BillingAccount FindByEmail(string email) { BillingAccount result = null; try { var x = (from n in context.bvb_BillingAccounts where n.Email == email.Trim().ToLowerInvariant() select n).SingleOrDefault(); if (x != null) { result = new BillingAccount(); CopyDataToModel(x, result); } } catch { result = null; } return result; }
public BillingAccount FindOrCreate(string email) { BillingAccount b = FindByEmail(email); if (b != null) { if (b.Id > 0) { return b; } } b = new BillingAccount(); b.Email = email.Trim().ToLowerInvariant(); if (Create(b)) { return b; } return null; }
public BillingAccount FindOrCreate(BillingAccount a) { BillingAccount b = FindByEmail(a.Email); if (b != null) { if (b.Id > 0) { return b; } } if (Create(a)) { return a; } return null; }