Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EditEnabled = CurrentModule.Permissions.Allowed(OperationType.Edit, CurrentUser);

            if (!IsPostBack)
            {
                pnlEdit.Visible = true;
                string ipAddress = IPNetworking.GetIP4Address(HttpContext.Current.Request);
                kiosk = CheckInController.GetCurrentKiosk(ipAddress);

                if (kiosk != null)
                {
                    litLegend.Text = string.Format("Edit '{0}' Kiosk", kiosk.SystemName);
                    btnSave.Text   = "Save";
                    EditKiosk(kiosk, ipAddress);
                }
                else
                {
                    litLegend.Text = "Register New Kiosk";
                    btnSave.Text   = "Add New";
                    EditKiosk(IPNetworking.GetHostName(ipAddress), ipAddress);
                }
            }
            else
            {
                ViewState["returnURL"] = Request.UrlReferrer.ToString();
            }
        }
 public void GetCurrentKiosk_Should_Return_Null_When_IP_Is_Invalid()
 {
     using (new TransactionScope())
     {
         var result = CheckInController.GetCurrentKiosk(CheckInTestConstants.INVALID_IP);
         Assert.Null(result);
     }
 }
        public void GetCurrentKiosk_Should_Return_Kiosk_When_IP_Is_Valid()
        {
            using (new TransactionScope())
            {
                CheckInTestSetup.SetupKiosk();
                var result = CheckInController.GetCurrentKiosk(Dns.GetHostName());

                Assert.IsNotNull(result);
                Assert.AreNotEqual(result.SystemId, Constants.NULL_INT);
            }
        }