Пример #1
0
        private async void newLocation(string LocationName, string LocationCode, string LocationPhoneNumber, int LocationFloorNumber)
        {
            try
            {
                //Register new Location
                SecureLocationDataPayload Location = new SecureLocationDataPayload();
                Location.LocationName = LocationName;
                Location.LocationCode = LocationCode;
                Location.PhoneNumber  = LocationPhoneNumber;
                Location.FloorNumber  = LocationFloorNumber;
                Location.CompanyId    = CompId;
                Location.Status       = SecureLocationStatus.Active.ToString();
                Location.Description  = "Added by " + _activePage.UserStaffName;
                Location.Status       = SecureLocationStatus.Active.ToString();
                Location.MapPoint     = "@";

                ResponseMessage msgExist = await service.CheckIfSecureLocationExistService(Location);

                if (msgExist.ResponseStatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    ResponseMessage msg = await service.RegisterNewSecureLocation(Location);

                    if (msg.ResponseStatusCode == System.Net.HttpStatusCode.NotFound)
                    {
                        MessageDialog ms = new MessageDialog("Successfully Registered");
                        await ms.ShowAsync();

                        CreateBinding();
                        ClearAddNewLocationFields();
                    }
                    else
                    {
                        MessageDialog ms = new MessageDialog("Err: newLocation-Else1 - " + msg.Message);
                        await ms.ShowAsync();
                    }
                }
                else
                {
                    MessageDialog ms = new MessageDialog("Err: newLocation-Else2 - " + msgExist.Message);
                    await ms.ShowAsync();
                }
            }
            catch (Exception ex)
            {
                checkInternet();
                MessageDialog msg = new MessageDialog(ex.Message + " Void - newLocation");
                //await msg.ShowAsync();
            }
        }