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();
            }
        }
コード例 #2
0
        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();
        }