Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            eventList    = new ArrayList();
            futureEvents = new ArrayList();
            DataView events = (DataView)eventSearchDataSource.Select(DataSourceSelectArguments.Empty);

            foreach (DataRowView row in events)
            {
                CustomerEvent customerEvent = new CustomerEvent();
                customerEvent.eventDatetime    = (DateTime)row["event_datetime"];
                customerEvent.eventDescription = (string)row["description"];
                eventList.Add(customerEvent);

                if (DateTime.Now.Date == customerEvent.eventDatetime)
                {
                    // today has event
                    selectedEventDescription.Text = customerEvent.eventDescription;
                }

                if (DateTime.Now.Date < customerEvent.eventDatetime)
                {
                    // future event
                    futureEvents.Add(customerEvent);
                }
            }

            futureEventList.DataSource = futureEvents;
            futureEventList.DataBind();
        }
        public async Task LoggEvent(CustomerEvent customerEvent)
        {
            var data    = JsonConvert.SerializeObject(customerEvent);
            var message = new Message(Encoding.UTF8.GetBytes(data));

            await _queueClient.SendAsync(message);
        }
Exemplo n.º 3
0
        public HttpResponseMessage PostCustomer(CustomerEvent customer)
        {
            var                 url        = Environment.GetEnvironmentVariable("CustomerEventUrl");
            HttpClient          httpClient = new HttpClient();
            HttpResponseMessage response;

            try
            {
                var content = JsonConvert.SerializeObject(customer);
                if (null != content)
                {
                    var stringContent = new StringContent(content, UnicodeEncoding.UTF8, "application/json");
                    var result        = httpClient.PostAsync(url, stringContent);
                    response = result.Result;
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, "Customer details entered succesfully");
                    }
                    return(response);
                }
                else
                {
                    throw new Exception("Failed to serialize object!");
                }
            }
            catch (Exception ex)
            {
                response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex);
                return(response);
            }
        }
Exemplo n.º 4
0
        public JsonResult EventCreate(string Name, string Address, string DateOfBirth, string Email, string Gender, string MobileNumber, string MonthlyGamingExpense, string EventName)
        {
            try
            {
                using (var db = new LiteDatabase(@"Mineski.db"))
                {
                    // Get customer collection
                    var customerEvents = db.GetCollection <CustomerEvent>("customerEvents");

                    var customerEventData = new CustomerEvent
                    {
                        Address              = Address,
                        DateOfBirth          = DateOfBirth,
                        Email                = Email,
                        Gender               = Gender,
                        MobileNumber         = MobileNumber,
                        MonthlyGamingExpense = MonthlyGamingExpense,
                        Name      = Name,
                        EventName = EventName
                    };

                    // Insert new customer document (Id will be auto-incremented)
                    customerEvents.Insert(customerEventData);
                }
            }
            catch (Exception exception)
            {
                return(Json(new { success = false, responseText = exception.Message }));
            }

            return(Json(new { success = true }));
        }
Exemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            CustomerEvent customerEvent = db.CustomerEvents.Find(id);

            db.CustomerEvents.Remove(customerEvent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
        public Task <Customer> CreateAsync(Customer customer)
        {
            CustomerEvent e = new CustomerEvent(customer.Id, customer.Name, customer.Created);

            _events.AddEvent(e);
            _customers.Add(customer);
            return(Task.FromResult(customer));
        }
Exemplo n.º 7
0
        public async Task <ActionResult> PostCustomerEvent(CustomerEvent customerEvent)
        {
            var producer = new ProducerBuilder <Null, string>(_producerConfig).Build();
            await producer.ProduceAsync(customerEvent.EventType.ToString(), new Message <Null, string> {
                Value = customerEvent.Data
            });

            return(null);
        }
        public void SaveEvent(CustomerEvent ce)
        {
            var newEvent = new CustomerEventEF();

            newEvent.CustomerId  = ce.Id;
            newEvent.DateCreated = ce.DateCreated;
            newEvent.RequestType = ce.RequestType;

            _customerEventContext.CustomerEvents.Add(newEvent);
            _customerEventContext.SaveChanges();
        }
Exemplo n.º 9
0
        private void actionpopupCustomerMeeting_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            Customer     customer = (Customer)View.CurrentObject;
            IObjectSpace space    = View.ObjectSpace.CreateNestedObjectSpace();

            CustomerEvent meeting = space.CreateObject <CustomerEvent>();

            meeting.Customer = space.GetObject <Customer>(customer);

            e.View = Application.CreateDetailView(space, meeting);
        }
 private void Button_DeleteCustomer_Click(object sender, RoutedEventArgs e)
 {
     if (this.DataGrid_Customer.SelectedCells.Count > 0)
     {
         HuaHaoERP.Model.CustomerModel data = this.DataGrid_Customer.SelectedCells[0].Item as HuaHaoERP.Model.CustomerModel;
         if (MessageBox.Show("确认删除用户:" + data.Name + "?", "警告", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             new ViewModel.Customer.CustomerConsole().MarkDelete(data);
             CustomerEvent.OnUpdateDataGrid();
         }
     }
 }
Exemplo n.º 11
0
 public ActionResult Edit([Bind(Include = "EventId,CustomerId")] CustomerEvent customerEvent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customerEvent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerId = new SelectList(db.Customers, "CustomerId", "FirstName", customerEvent.CustomerId);
     ViewBag.EventId    = new SelectList(db.Events, "EventId", "EventName", customerEvent.EventId);
     return(View(customerEvent));
 }
Exemplo n.º 12
0
        public static void InvokeEvent()
        {
            IEventAggregator aggregator = new EventAggregator();
            CustomerEvent    customer   = new CustomerEvent();

            aggregator.Subscribe(customer);
            ClientEvent client    = new ClientEvent();
            Publisher   publisher = customer.createPublisher(aggregator);

            aggregator.Subscribe(client);
            publisher.updateInfo(2);

            Console.ReadLine();
        }
Exemplo n.º 13
0
        // GET: CustomerEvents/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CustomerEvent customerEvent = db.CustomerEvents.Find(id);

            if (customerEvent == null)
            {
                return(HttpNotFound());
            }
            return(View(customerEvent));
        }
Exemplo n.º 14
0
        // GET: CustomerEvents/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CustomerEvent customerEvent = db.CustomerEvents.Find(id);

            if (customerEvent == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CustomerId = new SelectList(db.Customers, "CustomerId", "FirstName", customerEvent.CustomerId);
            ViewBag.EventId    = new SelectList(db.Events, "EventId", "EventName", customerEvent.EventId);
            return(View(customerEvent));
        }
Exemplo n.º 15
0
        public async Task <ActionResult> Join(Event joinEvent, int id)
        {
            joinEvent = new Event();
            string              userId   = User.Identity.GetUserId();
            Customer            customer = db.Customers.Where(c => c.ApplicationId == userId).SingleOrDefault();
            HttpClient          client   = new HttpClient();
            string              url      = "https://localhost:44355/api/Events/" + id;
            HttpResponseMessage response = await client.GetAsync(url);

            string jsonResult = await response.Content.ReadAsStringAsync();

            if (response.IsSuccessStatusCode)
            {
                EventApi events = JsonConvert.DeserializeObject <EventApi>(jsonResult);

                joinEvent.EventName   = events.EventName;
                joinEvent.VenueName   = events.VenueName;
                joinEvent.Street      = events.Street;
                joinEvent.Date        = events.Date;
                joinEvent.Category    = events.Category;
                joinEvent.SubCategory = events.SubCategory;
                joinEvent.City        = events.City;
                joinEvent.State       = events.State;
                joinEvent.ZipCode     = events.ZipCode;
                joinEvent.HostId      = events.HostId;
                db.Events.Add(joinEvent);
                db.SaveChanges();
                CustomerEvent custEvent = new CustomerEvent();
                custEvent.EventId    = joinEvent.EventId;
                custEvent.CustomerId = customer.CustomerId;
                db.CustomerEvents.Add(custEvent);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View());
        }
        public async Task Project(CustomerEvent @event)
        {
            var session = _store.LightweightSession();
            var doc     = !(@event is CustomerAdded)
                ? await session.LoadAsync <ReadSide.Customer>(@event.Id)
                : null;

            switch (@event)
            {
            case CustomerAdded added:
                doc = new ReadSide.Customer
                {
                    Id      = added.Id,
                    Name    = added.Name,
                    City    = added.City,
                    Street1 = added.Street1
                };
                Console.WriteLine($"Added {added.Name}");
                break;

            case CustomerChangedName changedName:
                doc.Name = changedName.Name;
                Console.WriteLine($"Changed name to {changedName.Name}");
                break;

            case CustomerMoved moved:
                doc.City    = moved.City;
                doc.Street1 = moved.Street1;
                Console.WriteLine($"Moved to {moved.City}");
                break;

            default:
                throw new InvalidOperationException("Unknown event type");
            }
            session.Store(doc);
            await session.SaveChangesAsync();
        }
 private void Button_Cancel_Click(object sender, RoutedEventArgs e)
 {
     Helper.Events.PopUpEvent.OnHidePopUp();
     CustomerEvent.OnUpdateDataGrid();
 }
Exemplo n.º 18
0
        private static async Task Execute()
        {
            var client = new RavelinClient("sk_live_XXXXXXXX");             // change with a valid key

            var customerEvent = new CustomerEvent
            {
                Customer = new Customer
                {
                    CustomerId          = "61283761287361",
                    RegistrationTimeUtc = DateTime.UtcNow.AddDays(-5),
                    Name                 = "Mark Twain",
                    GivenName            = "Mark",
                    FamilyName           = "Twain",
                    DateOfBirth          = "1980-01-27",
                    Gender               = "Male",
                    Email                = "*****@*****.**",
                    EmailVerifiedTimeUtc = DateTime.UtcNow.AddDays(-5),
                    Username             = "******",
                    Location             = new Location
                    {
                        Street1    = "James St",
                        City       = "Darwen",
                        Region     = "Blackburn with Darwen",
                        PostalCode = "BB3 1AS",
                        Country    = "GBR",
                        Latitude   = 53.697471,
                        Longitude  = -2.470891
                    },
                    Custom = new
                    {
                        Newsletter = false,
                        InvitedBy  = "7198737117"
                    }
                }
            };

            OutputResponse(await client.SendEvent(EventType.Customer, customerEvent));

            var loginEvent = new LoginEvent
            {
                CustomerId = "61283761287361",
                Device     = new Device
                {
                    DeviceId        = "2b6f0cc904d137be2e1730235f5664094b831186",
                    Type            = "phone",
                    Manufacturer    = "apple",
                    Model           = "iPhone8,1",
                    OperatingSystem = "iOS 8",
                    IpAddress       = "22.231.113.64"
                }
            };

            OutputResponse(await client.SendEvent(EventType.Login, loginEvent));

            var orderEvent = new OrderEvent
            {
                CustomerId = "61283761287361",
                Order      = new Order
                {
                    OrderId    = "n1QSYK0ceGNZqU28ien3",
                    Price      = 4675,
                    Currency   = "GBP",
                    Market     = "europe",
                    Country    = "GBR",
                    MarketCity = "london",
                    Items      = new List <Item>
                    {
                        new Item
                        {
                            Sku      = "3726-8",
                            Name     = "Women's Arch Sweater M 55",
                            Price    = 1990,
                            Currency = "GBP",
                            Quantity = 2
                        },
                        new Item
                        {
                            Sku      = "3731-4",
                            Name     = "Women's Yellow Tee M 54",
                            Price    = 695,
                            Currency = "GBP",
                            Quantity = 1
                        }
                    },
                    From = new Location
                    {
                        Street1    = "19 Gosport Walk",
                        PostalCode = "N17 9QD",
                        Region     = "London",
                        Country    = "GBR"
                    },
                    To = new Location
                    {
                        Street1    = "73 Braganza St",
                        PostalCode = "SE17 3RD",
                        Region     = "London",
                        Country    = "GBR"
                    },
                    CreationTimeUtc  = DateTime.UtcNow,
                    ExecutionTimeUtc = DateTime.UtcNow,
                    Status           = new OrderStatus
                    {
                        Stage = OrderStage.Pending,
                        Actor = "buyer"
                    }
                },
                DeviceId = "2b6f0cc904d137be2e1730235f5664094b831186"
            };

            OutputResponse(await client.SendEvent(EventType.Order, orderEvent));

            // Send card payment method event
            var paymentMethodEvent = new PaymentMethodEvent
            {
                CustomerId    = "61283761287361",
                PaymentMethod = new PaymentMethod
                {
                    PaymentMethodId        = "783917",
                    InstrumentId           = "card_16nWlGHD2LFseSsHaUp9kIW2",
                    RegistrationTimeUtc    = DateTime.UtcNow,
                    NickName               = "MasterCard **** 4242",
                    MethodType             = PaymentMethodType.Card,
                    CardBin                = "123456",
                    CardLastFour           = "4242",
                    CardType               = CardType.Mastercard,
                    ExpiryMonth            = 6,
                    ExpiryYear             = 2019,
                    SuccessfulRegistration = true,
                    CountryIssued          = "GBR",
                    Active         = true,
                    BillingAddress = new Location
                    {
                        Street1    = "73 Braganza St",
                        PostalCode = "SE17 3RD",
                        Region     = "London",
                        Country    = "GBR"
                    },
                    Banned = false
                }
            };

            OutputResponse(await client.SendEvent(EventType.PaymentMethod, paymentMethodEvent));

            var preTransactionEvent = new PreTransactionEvent
            {
                CustomerId      = "61283761287361",
                PaymentMethodId = "783917",
                OrderId         = "n1QSYK0ceGNZqU28ien3",
                Transaction     = new PreTransaction
                {
                    TransactionId  = "f61f8594e06459fa046707c36159bb36",
                    Email          = "*****@*****.**",
                    Debit          = 4675,
                    Credit         = 0,
                    Currency       = "GBP",
                    Type           = TransactionType.AuthCapture,
                    Gateway        = "stripe",
                    SecureProtocol = new SecureProtocol
                    {
                        Attempted    = true,
                        StartTimeUtc = DateTime.UtcNow
                    }
                }
            };

            OutputScoredResponse(await client.SendEventAndScore(EventType.PreTransaction, preTransactionEvent));

            var transactionEvent = new TransactionEvent
            {
                CustomerId      = "61283761287361",
                PaymentMethodId = "783917",
                OrderId         = "n1QSYK0ceGNZqU28ien3",
                Transaction     = new Transaction
                {
                    TransactionId    = "f61f8594e06459fa046707c36159bb36",
                    Email            = "*****@*****.**",
                    Debit            = 4675,
                    Credit           = 0,
                    Currency         = "GBP",
                    Success          = true,
                    AuthCode         = "1000",
                    Gateway          = "stripe",
                    GatewayReference = "tr_16oaY72eZvKYlo2CE5ZDq9Vh",
                    AvsResultCode    = new AvsResult
                    {
                        Street     = "A",
                        PostalCode = "M"
                    },
                    CvvResultCode  = "M",
                    Type           = TransactionType.AuthCapture,
                    SecureProtocol = new SecureProtocol
                    {
                        Attempted    = true,
                        Success      = true,
                        StartTimeUtc = DateTime.UtcNow,
                        EndTimeUtc   = DateTime.UtcNow
                    }
                }
            };

            OutputScoredResponse(await client.SendEventAndScore(EventType.Transaction, transactionEvent));

            // Update pending order to accepted order status stage
            orderEvent = new OrderEvent
            {
                CustomerId = "61283761287361",
                Order      = new Order
                {
                    OrderId          = "n1QSYK0ceGNZqU28ien3",
                    Price            = 4675,
                    ExecutionTimeUtc = DateTime.UtcNow,
                    Status           = new OrderStatus
                    {
                        Stage = OrderStage.Accepted,
                        Actor = "seller"
                    }
                }
            };

            OutputResponse(await client.SendEvent(EventType.Order, orderEvent));

            // Check-out (All-in-One) with PAN (sent to vault)

            var checkoutEvent = new CheckoutEvent
            {
                Customer = new Customer
                {
                    CustomerId          = "71983561248363",
                    RegistrationTimeUtc = DateTime.UtcNow.AddDays(-2),
                    GivenName           = "Arya",
                    FamilyName          = "Wayne",
                    Gender   = "Female",
                    Email    = "*****@*****.**",
                    Username = "******",
                    Location = new Location
                    {
                        Street1    = "Baker St",
                        City       = "London",
                        Region     = "London",
                        PostalCode = "NW1 6XE",
                        Country    = "GBR",
                        Latitude   = 51.523774,
                        Longitude  = -0.158537
                    }
                },
                Order = new Order
                {
                    OrderId  = "g1QSYD0ceGNZqU28iev3",
                    Price    = 4675,
                    Currency = "GBP",
                    Items    = new List <Item>
                    {
                        new Item
                        {
                            Sku      = "3726-8",
                            Name     = "Women's Arch Sweater M 55",
                            Price    = 1990,
                            Currency = "GBP",
                            Quantity = 2
                        },
                        new Item
                        {
                            Sku      = "3731-4",
                            Name     = "Women's Yellow Tee M 54",
                            Price    = 695,
                            Currency = "GBP",
                            Quantity = 1
                        }
                    }
                },
                PaymentMethod = new PaymentMethod
                {
                    PaymentMethodId        = "453237",
                    InstrumentId           = "card_19nWlGHD2LFseSsHaUp9kIW3",
                    RegistrationTimeUtc    = DateTime.UtcNow,
                    NickName               = "MasterCard **** 2424",
                    MethodType             = PaymentMethodType.Card,
                    CardBin                = "654321",
                    CardLastFour           = "2424",
                    CardType               = CardType.Mastercard,
                    ExpiryMonth            = 8,
                    ExpiryYear             = 2020,
                    SuccessfulRegistration = true,
                    PrepaidCard            = false,
                    CountryIssued          = "GBR",
                    Active = true,
                    Banned = false,
                    Pan    = "5454545454545454"
                },
                Transaction = new Transaction
                {
                    TransactionId    = "d12f8594e06459fa046707c53159bb30",
                    Email            = "*****@*****.**",
                    Debit            = 4675,
                    Credit           = 0,
                    Currency         = "GBP",
                    Success          = true,
                    Gateway          = "stripe",
                    GatewayReference = "tr_67oaY72eZvKYlo2CE5ZDq9Vh",
                    Type             = TransactionType.AuthCapture
                }
            };

            OutputScoredResponse(await client.SendEventAndScore(EventType.Checkout, checkoutEvent));

            // Chargeback

            var chargebackEvent = new ChargebackEvent(new Chargeback
            {
                ChargebackId     = "dp_15RsQX2eZvKYlo2C0MFNUWJC",
                Gateway          = "stripe",
                GatewayReference = "ch_15RsQR2eZvKYlo2CA8IfzCX0",
                Reason           = "general",
                ChargebackStatus = ChargebackStatus.Lost,
                Amount           = 195,
                Currency         = "USD",
                DisputeTimeUtc   = DateTime.UtcNow.AddHours(-2)
            });

            OutputResponse(await client.SendEvent(EventType.Chargeback, chargebackEvent));

            // Backfill Events

            var backfillCustomerEvent = new CustomerEvent
            {
                Customer = new Customer
                {
                    CustomerId          = "35248561944321",
                    RegistrationTimeUtc = DateTime.UtcNow.AddDays(-20),
                    GivenName           = "John",
                    FamilyName          = "Butler",
                    Gender   = "Male",
                    Email    = "*****@*****.**",
                    Username = "******"
                },
                Timestamp = DateTime.UtcNow.AddDays(-20)
            };

            OutputBackfillResponse(await client.SendBackfillEvent(EventType.Customer, backfillCustomerEvent));

            var backfillCheckoutEvent = new CheckoutEvent
            {
                CustomerId = "35248561944321",
                Order      = new Order
                {
                    OrderId  = "h1DSYD0ceNPSqU28isd3",
                    Price    = 4675,
                    Currency = "GBP",
                    Items    = new List <Item>
                    {
                        new Item
                        {
                            Sku      = "3726-8",
                            Name     = "Women's Arch Sweater M 55",
                            Price    = 1990,
                            Currency = "GBP",
                            Quantity = 2
                        },
                        new Item
                        {
                            Sku      = "3731-4",
                            Name     = "Women's Yellow Tee M 54",
                            Price    = 695,
                            Currency = "GBP",
                            Quantity = 1
                        }
                    }
                },
                PaymentMethod = new PaymentMethod
                {
                    PaymentMethodId        = "533228",
                    InstrumentId           = "card_19nWlGDR2LFseSsSaUk9kIC3",
                    RegistrationTimeUtc    = DateTime.UtcNow.AddDays(-6),
                    NickName               = "MasterCard **** 3213",
                    MethodType             = PaymentMethodType.Card,
                    CardBin                = "742589",
                    CardLastFour           = "3213",
                    CardType               = CardType.Mastercard,
                    ExpiryMonth            = 7,
                    ExpiryYear             = 2019,
                    SuccessfulRegistration = true,
                    PrepaidCard            = false,
                    CountryIssued          = "GBR",
                    Active = true,
                    Banned = false
                },
                Transaction = new Transaction
                {
                    TransactionId    = "k12f8594e06gj9fa046707c53155fb30",
                    Email            = "*****@*****.**",
                    Debit            = 4675,
                    Credit           = 0,
                    Currency         = "GBP",
                    Success          = true,
                    Gateway          = "stripe",
                    GatewayReference = "tr_67oaY72eYhOPlo2CE5ZDq5gKh",
                    Type             = TransactionType.AuthCapture
                },
                Timestamp = DateTime.UtcNow.AddDays(-6)
            };

            OutputBackfillResponse(await client.SendBackfillEvent(EventType.Checkout, backfillCheckoutEvent));

            Console.WriteLine("\n\nPress <Enter> to continue.");
            Console.ReadLine();
        }
Exemplo n.º 19
0
    public void InsertCustomerEvent(int applicantId)
    {
        var context = new SidejobEntities();
        var customerEvent = new CustomerEvent
        {
            CustomerID = applicantId,
            EventID = GetNextEventID(),
            NumberofEvents = 1,
            Type = 1
        };

        context.AddToCustomerEvents(customerEvent);
    }
 public CustomerEvent AddEvent(CustomerEvent customerEvent)
 {
     AllEvents.Push(customerEvent);
     _eventStream.OnNext(customerEvent);
     return(customerEvent);
 }
        private static CustomerEvent ResolveEvent(IResolveFieldContext context)
        {
            CustomerEvent customerEvent = context.Source as CustomerEvent;

            return(customerEvent);
        }
Exemplo n.º 22
0
 public void OnCustomerEvent(MonsterKilledEventArgs e)
 {
     CustomerEvent?.Invoke(this, e);
 }