public async Task <CustomerProfile> GetUserInfo() //public async Task<ObservableCollection<CustomerProfile>> GetUserInfo() // public async Task<List<string>> GetUserInfo() { try { var app = App.Current as App; Dictionary <string, string> payload = new Dictionary <string, string>(); payload.Add("access_key", app.SecurityAccessKey); payload.Add("merchant_id", app.Merchantid); payload.Add("phone_number", app.UserPhoneNumber); CustomerProfile robject = await this.Get <CustomerProfile>(this.getAuthUrl("getcustInfo"), payload, null); if (robject != null) { return(robject); } else { return(null); } } catch (Exception ex) { throw ex; } }
public async void GetUserProfile() { try { CustomerProfile customerProfile = await ProfileDataService.Instance.GetUserInfo(); if (customerProfile != null) { Profile = customerProfile; } var GstStatus = await ProfileDataService.Instance.getGSTSettingDetails(); if (GstStatus != null) { if (GstStatus.GST_Active.ToLower() == "yes") { DisplayGstNumber = true; } else { DisplayGstNumber = false; } } } catch (Exception ex) { Debug.WriteLine(@"error " + ex.Message); } }
public async Task <CustomerProfile> GetCustomerProfileAsync(int customerId, int officeId) { var customer = await FindCustomerByIdAsync(customerId); if (customer == null) { throw new InvalidOperationException(string.Format("Заказчик с Id {0} не найден", customerId)); } var office = await FindOfficeByIdAsync(officeId); if (office == null) { throw new InvalidOperationException(string.Format("Офис с id {0} не найден", officeId)); } var orderLiteral = OrderNameMaker.MakeLiteral(customer, office); var defaultContact = GetDefaultContact(customerId); var result = new CustomerProfile { IsIndividual = customer.IsIndividual, OrderLiteral = orderLiteral, RoundingPolicyId = customer.RoundingPolicyId, DefaultContactPerson = defaultContact }; return(result); }
public PartialViewResult CustomerAddress() { CustomerProfile Profile = DataAccess.CustomerProfileDA.GetByUser(User.Identity.Name); ViewBag.CustomerProfile = Profile; return(PartialView("~/Views/UserAccount/Partials/CustomerAddressPartial.cshtml", DataAccess.CustomerAddressDA.GetCustomerAddress(Profile.ID))); }
protected override void OnPreLoad(EventArgs e) { if (Page.User.Identity.IsAuthenticated) { try { customer = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0]; customerexists = true; } catch { //no entry in Customer table for current member customerexists = false; } } try { customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customer.CustomerId)[0]; customerprofileexists = true; } catch { //no entery in CustomerProfile table for current member customerprofileexists = false; } }
public void SaveCustomerProfile(CustomerProfileModel customerProfile) { var profile = _customerProfileService.GetByCustomerId(customerProfile.CustomerId); if (profile == null) { profile = new CustomerProfile() { CustomerId = customerProfile.CustomerId, AboutMe = customerProfile.AboutMe, Website = customerProfile.Website, DateCreated = DateTime.Now, DateUpdated = DateTime.Now, }; _customerProfileService.Insert(profile); return; } else { profile.AboutMe = customerProfile.AboutMe; profile.Website = customerProfile.Website; profile.DateUpdated = DateTime.Now; _customerProfileService.Update(profile); return; } }
public void GetUserInfo() { CustomerProfile c = new CustomerProfile(); CustomerVM cvm = new CustomerVM(); using (SqlConnection con = new SqlConnection(_connectionString)) { try { con.Open(); SqlCommand sqlCommand = new SqlCommand("SELECT name, phonenumber, email, address where username ='******' "); SqlDataReader myReader = sqlCommand.ExecuteReader(); while (myReader.Read()) { string Name1 = (string)myReader["name"]; int Phone1 = (int)myReader["phonenumber"]; string Email1 = (string)myReader["email"]; string Address1 = (string)myReader["address"]; cvm.Name = Name1; cvm.PhoneNumber = Phone1; cvm.Email = Email1; cvm.Address = Address1; } con.Close(); } catch (SqlException e) { Console.WriteLine(e + "Kunne ikke udfylde listen"); } } }
public static void Run() { var addressmapper = new AddressProfile(); var categorymapper = new CategoryProfile(); var customermapper = new CustomerProfile(); var customerRolemapper = new CustomerRoleProfile(); var manufacturermapper = new ManufacturerProfile(); var picturemapper = new PictureProfile(); var productAttributemapper = new ProductAttributeProfile(); var productmapper = new ProductProfile(); var specificationAttributemapper = new SpecificationAttributeProfile(); var tierPricemapper = new TierPriceProfile(); var config = new MapperConfiguration(cfg => { cfg.AddProfile(addressmapper.GetType()); cfg.AddProfile(categorymapper.GetType()); cfg.AddProfile(customermapper.GetType()); cfg.AddProfile(customerRolemapper.GetType()); cfg.AddProfile(manufacturermapper.GetType()); cfg.AddProfile(picturemapper.GetType()); cfg.AddProfile(productAttributemapper.GetType()); cfg.AddProfile(productmapper.GetType()); cfg.AddProfile(specificationAttributemapper.GetType()); cfg.AddProfile(tierPricemapper.GetType()); }); AutoMapperConfig.Init(config); }
public async Task <IHttpActionResult> GetCustomerProfile(string phone) { phone = phone.Replace(" ", "");//ignore spaces var result = db.CustomerProfiles.Where(x => x.PhoneNumber == phone).Include(item => item.ContactAddresses).Select(q => q).ToList(); if (result.Count() == 0) //no records - add record { CustomerProfile customerProfile = new CustomerProfile { PhoneNumber = phone, }; Validate(customerProfile); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CustomerProfiles.Add(customerProfile); await db.SaveChangesAsync(); //return customerProfile; return(CreatedAtRoute("DefaultApi", new { phone = customerProfile.PhoneNumber }, customerProfile)); } //return result.FirstOrDefault(); var customerProf = result.FirstOrDefault(); return(CreatedAtRoute("DefaultApi", new { phone = customerProf.PhoneNumber }, customerProf)); }
public int AddCustomer(Customer customer, CustomerProfile profile) { using (SqlConnection connection = GetConnection()) { connection.Open(); SqlCommand sql = new SqlCommand(); String query = "INSERT INTO Company (name, created, modified) output INSERTED.ID VALUES (@name, @created, @modified)"; sql = new SqlCommand(query, connection); sql.Parameters.AddWithValue("@name", customer.Name); sql.Parameters.AddWithValue("@created", DateTime.Now); sql.Parameters.AddWithValue("@modified", DateTime.Now); int customerId = (int)sql.ExecuteScalar(); Console.WriteLine(customerId); query = "INSERT INTO Profile (customerId, responsibleParty, street, city, state, zip, phone, email) output INSERTED.ID VALUES (@customerId, @responsibleParty, @street, @city, @state, @zip, @phone, @email)"; sql = new SqlCommand(query, connection); sql.Parameters.AddWithValue("@customerId", customerId); sql.Parameters.AddWithValue("@responsibleParty", profile.ResponsibleParty); sql.Parameters.AddWithValue("@street", profile.Street); sql.Parameters.AddWithValue("@city", profile.City); sql.Parameters.AddWithValue("@state", profile.State); sql.Parameters.AddWithValue("@zip", profile.Zip); sql.Parameters.AddWithValue("@phone", profile.Phone); sql.Parameters.AddWithValue("@email", profile.Email); sql.ExecuteNonQuery(); return(customerId); } }
public async Task <CustomerProfile> UpdateCustomerAsync(CustomerCreateOrUpdate customer) { var u1 = _userRepository.DbSet .Include("People") .Include("People.Address") .Where(x => x.Userid.ToString() == customer.CustomerId).First(); var dateNow = DateTime.UtcNow; var people = _mapper.Map <CustomerCreateOrUpdate, People>(customer, u1.People); people.Modifiedon = dateNow; var user = _mapper.Map <CustomerCreateOrUpdate, User>(customer, u1); user.Modifiedon = dateNow; CustomerProfile cp = null; await Task.Factory.StartNew(() => { cp = _mapper.Map <User, CustomerProfile>(user); }); return(cp); }
public async Task<ActionResult> UploadDrivers() { try { CustomerProfile cProfile = new CustomerProfile(); if (userData.Roles.Contains(Roles.AccountAdmin)) { cProfile.CompanyID = userData.CompanyId; return View(cProfile); } else { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", userData.AccessToken); HttpResponseMessage responseMessage = await client.PostAsJsonAsync(_url + "Customer/GetCustomerProfileByUserID", ""); if (responseMessage.IsSuccessStatusCode) { var result = responseMessage.Content.ReadAsStringAsync().Result; statusResult = JsonConvert.DeserializeObject<StatusResult>(result); if (statusResult.Status.Equals(Status.Success.ToString())) { List<CustomerProfile> customerData = JsonConvert.DeserializeObject<List<CustomerProfile>>(statusResult.Result.ToString()); return View(BindDropDown(customerData, cProfile)); } } } return View("Error"); } catch (Exception ex) { throw ex; } }
private static IList <CustomerProfile> CreateAndSaveCustomerProfiles(IRepository repository) { IList <CustomerProfile> profiles = new List <CustomerProfile>(); FamilySituation[] situations = (FamilySituation[])Enum.GetValues(typeof(FamilySituation)); foreach (var situation in situations) { for (int i = 2; i < 6; i++) { int lowAge = i * 10; int highAge = lowAge + 10; CustomerProfile profile = new CustomerProfile(); profile.Situation = situation; profile.LowAge = lowAge; profile.HighAge = highAge; repository.Save(profile); profiles.Add(profile); } CustomerProfile profileExtra = new CustomerProfile { LowAge = 60, HighAge = 80, Situation = situation }; repository.Save(profileExtra); profiles.Add(profileExtra); } return(profiles); }
public ActionResult DeleteConfirmed(Guid id) { CustomerProfile customerProfile = db.CustomerProfiles.Find(id); db.CustomerProfiles.Remove(customerProfile); db.SaveChanges(); return(RedirectToAction("Index")); }
public static CustomerProfile GetCustomerProfileByID(int customerProfileID) { DataRow CustomerGetCustomerProfileByIdsRow = CustomerProfileDataAccess.GetInstance.GetCustomerProfileByID(customerProfileID); CustomerProfile TheCustomerProfile = DataRowToObject(CustomerGetCustomerProfileByIdsRow); return(TheCustomerProfile); }
public ActionResult ConfirmRegistration(CustomerProfile cp) { CustomerProfile cp1 = (CustomerProfile)Session["Customer"]; ICustManager ic = new CustomerManager(); ic.Register(cp1); return(RedirectToAction("Success")); }
// string ConnectionString = ConfigurationManager.ConnectionStrings["compusport.Data.ConnectionString"].ToString(); protected void Page_Load(object sender, EventArgs e) { bool AthleteAlreadyInList = false; customerid = DataRepository.CustomerProvider.GetByAspnetMembershipUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()))[0]; customerprofile = DataRepository.CustomerProfileProvider.GetByCustomerId(customerid.CustomerId)[0]; // currentUser = SiteUtils.GetCurrentSiteUser(); // mpuser = DataRepository.MpUsersProvider.GetByUserId(2); //mpuser = DataRepository.MpUsersProvider.GetByUserId(2); if (!IsPostBack) { //athletelist = DataRepository.MpUserRolesProvider.GetByRoleId(9); //userslist = DataRepository.MpUsersProvider.GetAll(); //userslist.Sort("Name"); customer = DataRepository.CustomerProvider.GetAll(); customer.Sort("FirstName"); // customer.Sort("LastName"); //customer.Sort("FirstName" + "LastName"); foreach (var item in customer) { //foreach (MpUserRoles a in athletelist) //{ // if (a.UserId == item.UserId) //{ cust = DataRepository.CustomerProvider.GetByCustomerId(item.CustomerId); // lessonlist = DataRepository.LessonProvider.GetByUserId(athlete.UserId); { if (DropDownList1.Items.Count > 0) { if (DropDownList1.Items.Contains(DropDownList1.Items.FindByValue(item.CustomerId.ToString()))) { AthleteAlreadyInList = true; } else { AthleteAlreadyInList = false; } } if (!AthleteAlreadyInList) { x++; DropDownList1.Items.Add(item.FirstName + " " + item.LastName); DropDownList1.Items[x].Value = item.CustomerId.ToString(); continue; } } } // } //} } }
public async Task <ActionResult> DeleteConfirmed(int id) { CustomerProfile customerprofile = await db.CustomerProfiles.FindAsync(id); db.CustomerProfiles.Remove(customerprofile); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
// // GET: /CustomerProfile/Details/5 public ActionResult Details(int id) { var model = new CustomerProfile(); model.id = id; model.Name = "Fai"; model.Lastname = "Nounnapasri"; return(View(model)); }
public POSItemDetail(CustomerProfile customerProfile, ItemProfile itemProfile, ItemOffer itemOffer, List <BalanceBarcodeAc> ListOfBalanceBarcodeConfiguration) { _customerProfile = customerProfile; _itemProfile = itemProfile; _itemOffer = itemOffer; _listOfBalanceBarcodeConfiguration = ListOfBalanceBarcodeConfiguration; _isOfferItem = itemOffer != null; _itemPrice = GetItemPrice(_customerProfile, _itemProfile, _itemOffer, _listOfBalanceBarcodeConfiguration); }
public StatusResult AddCustomer(CustomerProfile model) { StatusResult c = new Models.StatusResult(); try { if (!ModelState.IsValid) { var errors = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => x.Value.Errors.Select(y => y.ErrorMessage)).ToList(); Log.Error(Logfornet.LogMessage(model.CustomerName, "CreateCustomer", errors.ToArray(), "")); c.Status = Status.BadRequest.ToString(); c.Result = BadRequest(); return(c); } if (string.IsNullOrEmpty(model.CompanyLogo)) { Log.Error(Logfornet.LogMessage(model.CustomerName, "CreateCustomer", "Please upload company logo", "")); c.Status = Status.BadRequest.ToString(); c.Result = "Please upload companylogo"; return(c); } if (User.IsInRole(Roles.SuperAdmin) || User.IsInRole(Roles.PortalAdmin)) { Customer Cus = new Customer(); var res = Cus.AddCustomer(model, ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value); if (res != null) { Log.Info(Logfornet.LogMessage(model.CustomerName, "CreateCustomer", ErrorMessages.Success, "")); c.Status = Status.Success.ToString(); c.Result = res; return(c); } else { Log.Warn(Logfornet.LogMessage(model.CustomerName, "CreateCustomer", ErrorMessages.AlreadyExists, "")); c.Status = Status.Fail.ToString(); c.Result = "Aready Exists"; return(c); } } else { Log.Error(Logfornet.LogMessage(model.CustomerName, "CreateCustomer", ErrorMessages.NoAccessDenied, "")); c.Status = Status.NoAccess.ToString(); c.Result = "No Access"; return(c); } } catch (TFSqlException ex) { Log.Error(Logfornet.LogMessage(model.CustomerName, "CreateCustomer", ex.Message, ex.StackTrace)); c.Status = ExceptionStatus.SqlException.ToString(); c.StatusCode = (int)ExceptionStatus.SqlException; c.Result = ex.InnerException; return(c); } }
public List<TagDepenses> AggregateProfileTagsFromDB(CustomerProfile profile) { Dictionary<Tag, TagDepenses> depenses = new Dictionary<Tag, TagDepenses>(); foreach (var customer in profile.Customers) { MapTagDepenses(depenses, customer.TagDepenses); } //profile done return depenses.Select(x => new TagDepenses() { Tag = x.Key, Depenses = x.Value.Depenses / profile.Customers.Count() }).ToList(); }
private void IncreaseCharacterIndex() { characterIndex++; if (characterIndex == availableCharacters.Length) { characterIndex = 0; } selectedAdventurer = availableCharacters[characterIndex]; characterText.text = selectedAdventurer.characterName; }
public IActionResult Post([FromBody] CustomerProfile customerProfile) { Customer customer = new Customer(); customer.Map(customerProfile); customer.CreatedById = Guid.Parse(User.FindFirst(NameIdentifier).Value); _repositories.Customer.Create(customer); _repositories.Customer.Save(); return(CreatedAtRoute("GetCustomerById", new { id = customer.Id }, customer)); }
public IList <TagDepensesDto> GetTagDepensesForProfile(int profileId) { CustomerProfile profile = _repository.Load <CustomerProfile>(profileId); if (profile.TagsRepartition != null) { return(profile.TagsRepartition.Select(x => _dtoCreator.Create(x)).ToList()); } return(null); }
public async Task <PartialViewResult> Register() { ICustManager ic = new CustomerManager(); CustomerProfile cp = new CustomerProfile { CID = ic.GenerateID(ENType.Profile), }; return(PartialView(cp)); }
public IActionResult Put([FromBody] CustomerProfile customer, Guid id) { Customer dbCustomer = ((Customer)HttpContext.Items["entity"]); dbCustomer.Map(customer); dbCustomer.LastUpdatedById = Guid.Parse(User.FindFirst(NameIdentifier).Value); _repositories.Customer.Update(dbCustomer); _repositories.Customer.Save(); return(NoContent()); }
private void ChangeProfile() { myAnimator = GetComponent <Animator>(); myRigidBody = GetComponent <Rigidbody2D>(); myCustomerProfile = customerProfiles[Random.Range(0, customerProfiles.Count)]; myAnimator.runtimeAnimatorController = myCustomerProfile.animatorController; SpriteRenderer sr = GetComponent <SpriteRenderer>(); sr.sprite = myCustomerProfile.customerSprite; }
private void DecreaseCharacterIndex() { characterIndex--; if (characterIndex < 0) { characterIndex = availableCharacters.Length - 1; } selectedAdventurer = availableCharacters[characterIndex]; characterText.text = selectedAdventurer.characterName; }
public async Task <IActionResult> Index() { var loggedUser = await _userManagerService.FindByNameAsync(User.Identity.Name); CustomerProfile loggedProfile = _profileRepo.GetSingle(cProfile => cProfile.UserId == loggedUser.Id); IEnumerable <Package> packList = _packRepo.GetAll(); IEnumerable <Order> orderList = _orderRepo.Query(o => o.UserId == loggedUser.Id); List <Order> activeOrder = new List <Order>(); List <Order> inactiveOrder = new List <Order>(); foreach (var o in orderList) { if (o.DepartingDate >= DateTime.Now) { o.IsActive = true; activeOrder.Add(o); } else { o.IsActive = false; inactiveOrder.Add(o); } } DisplayCustomerProfileViewModel vm = new DisplayCustomerProfileViewModel { UserId = loggedUser.Id, UserName = loggedUser.UserName, Packages = packList, ActiveOrders = activeOrder, InactiveOrders = inactiveOrder }; if (loggedProfile != null) { if (loggedProfile.ImgPath == null) { vm.ImgPath = "admin\\person-solid.png"; } else { vm.ImgPath = loggedProfile.ImgPath; } } else { vm.ImgPath = "admin\\person-solid.png"; } return(View(vm)); }
public IHttpActionResult GetCustomerProfile(int id) { CustomerProfile customerProfile = db.CustomerProfiles.Find(id); if (customerProfile == null) { return(NotFound()); } return(Ok(customerProfile)); }
public LocationFinderItem (CustomerProfile person, LocationInfo address) { this.Type = LocationFinderItemType.Contact; this.DataItem = address; //this.Text = string.Format ("{0} {1}", person.FirstName, person.LastName); this.Detail = address.StreetAddress; this.FormattedAddress = address.FormattedAddress; this.Lat = address.Lat; this.Lng = address.Lng; }
public static Customer Create( string value_s, string value_s1, Advisor value_advisor, CustomerProfile value_customerProfile, string value_s2, string value_s3, DateTime value_dt, FamilySituation value_i, string value_s4, string value_s5, IList<UserTag> value_iList, IList<PaymentEvent> value_iList1_, IList<BusinessPartner> value_iList2_, IList<TagDepenses> value_iList3_, IList<CustomerImage> value_iList4_, IList<AuthToken> value_iList5_, int value_i1_, string value_s6, string value_s7, DateTime value_dt1, DateTime value_dt2, string value_s8, UserType value_i2_ ) { Customer customer = new Customer(); customer.Code = value_s; customer.PhoneNumber = value_s1; customer.Advisor = value_advisor; customer.CustomerProfile = value_customerProfile; customer.FirstName = value_s2; customer.LastName = value_s3; customer.BirthDate = value_dt; customer.Situation = value_i; customer.Password = value_s4; customer.PasswordSalt = value_s5; customer.Tags = value_iList; customer.PaymentEvents = value_iList1_; customer.Partners = value_iList2_; customer.TagDepenses = value_iList3_; customer.Images = value_iList4_; customer.Tokens = value_iList5_; ((UserIdentity)customer).Id = value_i1_; ((UserIdentity)customer).Identification = value_s6; ((UserIdentity)customer).Type = value_s7; ((UserIdentity)customer).ValidityEndDate = value_dt1; ((UserIdentity)customer).ValidityStartDate = value_dt2; ((UserIdentity)customer).Email = value_s8; ((UserIdentity)customer).UserType = value_i2_; return customer; }
public List<TagDepenses> AggregateProfileTags(CustomerProfile profile) { Dictionary<Tag, TagDepenses> depenses = new Dictionary<Tag, TagDepenses>(); foreach (var customer in profile.Customers) { var tagDepenses = AggregateCustomer(customer); MapTagDepenses(depenses, tagDepenses); customer.TagDepenses = tagDepenses; _repository.Update(customer); _repository.Flush(); } //profile done return depenses.Select(x => new TagDepenses() { Tag = x.Key, Depenses = x.Value.Depenses / profile.Customers.Count() }).ToList(); }
public static void Main(string [] args) { int merchantId=0; string apiToken=""; string url=""; long pan = 0; short expiry = 0; String firstName = null; String lastName = null; string storageTokenId = ""; string orderId = ""; long amount = 0; string method=""; if(args.Length >=5){ method=args[0]; url=args[1]; merchantId = Convert.ToInt32(args[2]); apiToken=args[3]; storageTokenId = args[4]; if(method.Equals("add")){ pan = Convert.ToInt64(args[5]); expiry = Convert.ToInt16(args[6]); firstName = args[7]; lastName = args[8]; } else if(method.Equals("delete")) { } else if (method.Equals("query")) { } else if (method.Equals("update")) { pan = Convert.ToInt64(args[5]); expiry = Convert.ToInt16(args[6]); firstName = args[7]; lastName = args[8]; } else if (method.Equals("purchase")) { orderId = args[5]; amount = Convert.ToInt64(args[6]); } System.Net.ServicePointManager.CertificatePolicy = new MyPolicy(); // Service HttpsCreditCardService ccService = new HttpsCreditCardService(merchantId, apiToken, url); AbstractReceipt resp=null; // invoke txn method if(method.Equals("add")){ CreditCard creditCard = new CreditCard(pan, expiry); CustomerProfile customerProfile = new CustomerProfile(); customerProfile.setFirstName(firstName); customerProfile.setLastName(lastName); PaymentProfile paymentProfile = new PaymentProfile(creditCard, customerProfile); Console.WriteLine("made profile"); resp = ccService.addToStorage(storageTokenId, paymentProfile); Console.WriteLine("got resp"); } else if (method.Equals("delete")){ resp = ccService.deleteFromStorage(storageTokenId); } else if (method.Equals("query")) { resp = ccService.queryStorage(storageTokenId); } else if (method.Equals("update")){ CreditCard creditCard = new CreditCard(pan, expiry); CustomerProfile customerProfile = new CustomerProfile(); customerProfile.setFirstName(firstName); customerProfile.setLastName(lastName); PaymentProfile paymentProfile = new PaymentProfile(creditCard, customerProfile); resp = ccService.updateStorage(storageTokenId, paymentProfile); } else if (method.Equals("purchase")){ resp = ccService.singlePurchase(orderId, storageTokenId, amount, null); } else { Console.WriteLine("args[0] must be add, delete, query, update, or purchase"); } if(resp.isApproved()){ Console.WriteLine("Response: {0}", resp.ToString()); } else { //display error Console.WriteLine("isApproved: {0}", resp.isApproved()); Console.WriteLine("Error Code: {0} Message: {1}",resp.getErrorCode(),resp.getErrorMessage()); } } else { Console.WriteLine("[Invalid Command]"); Console.WriteLine(""); Console.WriteLine("Usage:"); Console.WriteLine(""); Console.WriteLine("Add: add url(string) merchantId(int) apiToken(string) storageTokenId(string) pan(long) expiry(short) firstName(string) lastName(string)"); Console.WriteLine(" StorageGatewayTest add https://test.admeris.com/ccgateway/cc/processor.do 6 abcdefgh myStorageToken 4242424242424242 1210 John Smith"); Console.WriteLine("------------------------------------*---------------------------------------"); Console.WriteLine("Delete: delete url(string) merchantId(int) apiToken(string) storageTokenId(string)"); Console.WriteLine(" StorageGatewayTest delete https://test.admeris.com/ccgateway/cc/processor.do 6 abcdefgh myStorageToken"); Console.WriteLine("------------------------------------*---------------------------------------"); Console.WriteLine("Query: query url(string) merchantId(int) apiToken(string) storageTokenId(string)"); Console.WriteLine(" StorageGatewayTest query https://test.admeris.com/ccgateway/cc/processor.do 6 abcdefgh myStorageToken"); Console.WriteLine("------------------------------------*---------------------------------------"); Console.WriteLine("Update: update url(string) merchantId(int) apiToken(string) storageTokenId(string) expiry(short) firstName(string) lastName(string)"); Console.WriteLine(" StorageGatewayTest update https://test.admeris.com/ccgateway/cc/processor.do 6 abcdefgh myStorageToken 4111111111111111 1111 Jane Doe"); Console.WriteLine("------------------------------------*---------------------------------------"); Console.WriteLine("Purchase: purchase url(string) merchantId(int) apiToken(string) storageTokenId(string) order_id(string) amount_in_cents(long) "); Console.WriteLine(" StorageGatewayTest purchase https://test.admeris.com/ccgateway/cc/processor.do 6 abcdefgh myStorageToken order-001 100"); } }
private static IList<CustomerProfile> CreateAndSaveCustomerProfiles(IRepository repository) { IList<CustomerProfile> profiles = new List<CustomerProfile>(); FamilySituation[] situations = (FamilySituation[])Enum.GetValues(typeof(FamilySituation)); foreach (var situation in situations) { for (int i = 2; i < 6; i++) { int lowAge = i * 10; int highAge = lowAge + 10; CustomerProfile profile = new CustomerProfile(); profile.Situation = situation; profile.LowAge = lowAge; profile.HighAge = highAge; repository.Save(profile); profiles.Add(profile); } CustomerProfile profileExtra = new CustomerProfile { LowAge = 60, HighAge = 80, Situation = situation }; repository.Save(profileExtra); profiles.Add(profileExtra); } return profiles; }
private List<TagDepenses> AggregateProfileTags(CustomerProfile profile) { Dictionary<Tag, TagDepenses> depenses = new Dictionary<Tag, TagDepenses>(); foreach (var customer in profile.IndividualCustomers) { foreach (TagDepenses tagDepense in customer.TagDepenses) { if (depenses.ContainsKey(tagDepense.Tag)) { depenses[tagDepense.Tag].Depenses += tagDepense.Depenses; } else { depenses.Add(tagDepense.Tag, tagDepense); } } } //profile done return depenses.Select(x => new TagDepenses() { Tag = x.Key, Depenses = x.Value.Depenses / profile.IndividualCustomers.Count() }).ToList(); }