protected void Page_Load(object sender, EventArgs e)
        {
            RoomServiceClient roomServiceClient = new RoomServiceClient();
            string[] roomIdentifiers = roomServiceClient.QueryAllRoomIdentifiers();

            td_Room.DataSource = roomIdentifiers;
            td_Room.DataBind();

            String id = Request.Params["id"];

            if (id == null)
            {
                action.Value = "insert";
            }
            else
            {
                StaffServiceClient staffServiceClient = new StaffServiceClient();
                Staff staff = staffServiceClient.QueryStaff(Int32.Parse(id));

                action.Value = "update";
                old_Id.Value = id;

                td_Id.Text = staff.Id.ToString();
                td_Name.Text = staff.Name;
                td_LastName.Text = staff.LastName;
                td_Room.SelectedValue = staff.Room;
                td_ipAddress.Text = staff.IpAddress;

                staffServiceClient.Close();
            }

            roomServiceClient.Close();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String id = Request.Params["Id"];
            if (id != null)
            {
                StaffServiceClient staffServiceClient = new StaffServiceClient();
                Staff staff = staffServiceClient.QueryStaff(Int32.Parse(id));

                RoomServiceClient roomServiceClient = new RoomServiceClient();
                Room room = roomServiceClient.QueryRoom(staff.Room);

                ZipcodeServiceClient zipcodeServiceClient = new ZipcodeServiceClient();
                Zipcode zipcode = zipcodeServiceClient.QueryZipcode(room.Zipcode);

                GeolocationServiceClient geolocationServiceClient = new GeolocationServiceClient();
                String location = geolocationServiceClient.GetCountry(staff.IpAddress);

                td_Id.InnerText = staff.Id.ToString();
                td_Name.InnerText = staff.Name;
                td_LastName.InnerText = staff.LastName;
                td_Room.InnerText = staff.Room;
                td_Zipcode.InnerText = room.Zipcode;
                td_Street.InnerText = zipcode.Street;
                td_City.InnerText = zipcode.City;
                td_ipAddress.InnerText = staff.IpAddress;
                td_location.InnerText = location;

                geolocationServiceClient.Close();
                zipcodeServiceClient.Close();
                roomServiceClient.Close();
                staffServiceClient.Close();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String action = Request.Params["action"];

            if (action != null)
            {
                StaffServiceClient staffServiceClient = new StaffServiceClient();

                if (action.Equals("insert"))
                {
                    Staff staff = new Staff();
                    staff.Id = Int32.Parse(Request.Params["td_Id"]);
                    staff.Name = Request.Params["td_Name"];
                    staff.LastName = Request.Params["td_LastName"];
                    staff.Room = Request.Params["td_Room"];
                    staff.IpAddress = Request.Params["td_ipAddress"];

                    staffServiceClient.InsertStaff(staff);
                }
                else if (action.Equals("update"))
                {
                    Staff staff = new Staff();
                    staff.Id = Int32.Parse(Request.Params["td_Id"]);
                    staff.Name = Request.Params["td_Name"];
                    staff.LastName = Request.Params["td_LastName"];
                    staff.Room = Request.Params["td_Room"];
                    staff.IpAddress = Request.Params["td_ipAddress"];

                    staffServiceClient.UpdateStaff(Int32.Parse(Request.Params["old_Id"]), staff);
                }
                else if (action.Equals("delete"))
                {
                    staffServiceClient.DeleteStaff(Int32.Parse(Request.Params["Id"]));
                }

                staffServiceClient.Close();

                Response.Status = "301 Moved Permanently";
                Response.AddHeader("Location", Request.ApplicationPath.TrimEnd('/') + "/stafftable.aspx");
            }
        }