예제 #1
0
        public async Task <ResponseMessage> GetDataCompanySecureLocation(int CompanyId)
        {
            SecureLocationDataPayload SecureLocationPayLoad = new SecureLocationDataPayload()
            {
                CompanyId = CompanyId
            };

            var response = service.GetSecureLocationListControllerService(SecureLocationPayLoad);

            return(response);
        }
예제 #2
0
        public async Task <ResponseMessage> GetDataThisLocation(int LocationId)
        {
            SecureLocationDataPayload ThisLocationPayLoad = new SecureLocationDataPayload()
            {
                LocationId = LocationId
            };

            var response = service.GetThisSecureLocationControllerService(ThisLocationPayLoad);

            return(response);
        }
예제 #3
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();
            }
        }
예제 #4
0
        public async Task <ResponseMessage> RegisterNewSecureLocation(SecureLocationDataPayload secureLocation)
        {
            var response = await service.RegisterNewSecureLocation(secureLocation);

            return(response);
        }
예제 #5
0
        private async void UpdateLocation(string action)
        {
            try
            {
                var LocationName        = txtClickedItemLocationName.Text;
                var LocationCode        = txtClickedItemLocationCode.Text;
                var LocationPhoneNumber = txtClickedItemLocationPhoNo.Text;
                var LocationFloorNumber = Convert.ToInt32(txtClickedItemLocationFloorNo.Text);

                if (string.IsNullOrEmpty(LocationName))
                {
                    MessageDialog msg = new MessageDialog("Provide Appropriate value for Location Name");
                    await msg.ShowAsync();

                    return;
                }
                else if (string.IsNullOrEmpty(LocationCode))
                {
                    MessageDialog msg = new MessageDialog("Provide Appropriate value for Location Code");
                    await msg.ShowAsync();

                    return;
                }
                else if (string.IsNullOrEmpty(LocationPhoneNumber))
                {
                    MessageDialog msg = new MessageDialog("Provide Appropriate value for Location Phone Number");
                    await msg.ShowAsync();

                    return;
                }
                else if (string.IsNullOrEmpty(LocationFloorNumber.ToString()))
                {
                    MessageDialog msg = new MessageDialog("Provide Appropriate value for Location Floor Number");
                    await msg.ShowAsync();

                    return;
                }
                else
                {
                    SecureLocationDataPayload Location = new SecureLocationDataPayload();
                    //Location.LocationId = ThisLocationId;
                    Location.LocationName = LocationName;
                    Location.LocationCode = LocationCode;
                    Location.PhoneNumber  = LocationPhoneNumber;
                    Location.FloorNumber  = LocationFloorNumber;
                    Location.CompanyId    = CompId;
                    Location.Status       = action;
                    Location.Description  = "Status Changed to " + Location.Status + " by " + _activePage.UserStaffName;
                    Location.MapPoint     = "@";

                    ResponseMessage msgExist = await service.CheckIfSecureLocationExistService(Location);

                    if (msgExist.ResponseStatusCode == System.Net.HttpStatusCode.Found)
                    {
                        Location.LocationId = ThisLocationId;
                        ResponseMessage msgApp = await service.UpdateThisSecureLocationControllerService(Location);

                        if (msgApp.ResponseStatusCode == System.Net.HttpStatusCode.NotFound)
                        {
                            CreateBinding();
                            MessageDialog ms = new MessageDialog("Action Successful");
                            await ms.ShowAsync();

                            resetGridItemDetail();
                        }
                        else
                        {
                            MessageDialog ms = new MessageDialog("Err: " + msgApp.Message);
                            await ms.ShowAsync();
                        }
                    }
                    else
                    {
                        MessageDialog ms = new MessageDialog("Err: " + msgExist.Message);
                        await ms.ShowAsync();
                    }
                }
            }
            catch (Exception ex)
            {
                checkInternet();
                MessageDialog msg = new MessageDialog("Error from btnAddDept " + ex.Message);
                //await msg.ShowAsync();
            }
        }