protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            var registrationProvided =
                int.TryParse(Request.QueryString["registration"], out int registrationId);

            if (!registrationProvided)
            {
                Response.Redirect("Default.aspx");
            }

            using (var client = ServiceClientFactory.NewServiceClient())
            {
                var checkin = client.GetCheckin(registrationId);

                CustomerName.Value = checkin.CustomerName;
                Passport.Value     = checkin.Passport;
                CustomerId.Value   = checkin.CustomerId;
                Address.Value      = checkin.Address;
                Amount.Value       = checkin.Amount.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            using (var client = ServiceClientFactory.NewServiceClient())
            {
                var registrations = client.GetTodayRegistrations();
                RegistrationGrid.DataSource = registrations;
                RegistrationGrid.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            using (var client = ServiceClientFactory.NewServiceClient())
            {
                var summary = client.GetTodayRegistrationSummary();
                Checkins.InnerText  = summary.CheckIns.ToString();
                Checkouts.InnerText = summary.CheckOuts.ToString();

                Clock.Text = DateTime.Now.ToShortTimeString();
            }
        }
Ejemplo n.º 4
0
        protected void AddRegisterBtn_Click(Object sender, EventArgs e)
        {
            using (var client = ServiceClientFactory.NewServiceClient())
            {
                var booking = new Booking()
                {
                    CustomerName = CustomerName.Value,
                    Passport     = Passport.Value,
                    CustomerId   = string.Format("Cust-{0}", new Random().Next(1, 10000)),
                    Address      = Address.Value,
                    Amount       = int.Parse(Amount.Value),
                    From         = Calendar1.SelectedDate,
                    To           = Calendar2.SelectedDate,
                    Total        = new Random().Next(10, 40) * 100
                };

                client.PostRegister(booking);
            }

            Response.Redirect($"Default.aspx");
        }