/// <summary> /// /// </summary> /// <param name="document"></param> /// <exceptions> /// <exception name="PosIntegration client Exception" description="Any Exception coming from PosIntegration client"></exception> /// <exception name="NoCurrentLocationException" description="No current location has been set"></exception> /// </exceptions> /// <returns></returns> public void saveCurrentLocation() { if (_currentLocationChanged) { try { if (currentLocation.Id == 0) { byte[] imgBytes = this.currentLocation.BackgroundImg; _posIntegrationClient.AddLocation(this.currentLocation); refreshLocations(); doSetCurrentLocationAtIndex(_locations.Count - 1, false); this.currentLocation.BackgroundImg = imgBytes; //MessageBox.Show(string.Format("Save Current Location: {0}\n\nWidth: {1} Height: {2}\n\ncurrentLocation.Id = 0", this.currentLocation.Name, this.currentLocation.Width, this.currentLocation.Height)); _posIntegrationClient.UpdateLocation(this.currentLocation); } else { //MessageBox.Show(string.Format("Save Current Location: {0}\n\nWidth: {1} Height: {2}", this.currentLocation.Name, this.currentLocation.Width, this.currentLocation.Height)); _posIntegrationClient.UpdateLocation(this.currentLocation); } _currentLocationChanged = false; saveTables(); } catch (NoCurrentLocationException) { throw; } catch (Exception exc) // Pos Integration Exception { _posIntegrationFailed = true; throw new PosIntegrationException(exc.Message); } } }
/// <summary> /// /// </summary> /// <param name="inLocation"></param> private void pAddNewDTOLocation(LocationInfo inLocation) { DTOLocation dtoLocation = new DTOLocation(); dtoLocation.Name = inLocation.Location; dtoLocation.Height = inLocation.Height; dtoLocation.Width = inLocation.Width; _posIntegrationClient.AddLocation(dtoLocation); // Assign the new dtoLocation a background image DTOLocation[] dtoLocations = _posIntegrationClient.GetAllLocations(); dtoLocation = dtoLocations[dtoLocations.Length - 1]; dtoLocation.BackgroundImg = Helper.imageToByteArray(inLocation.BackImage, ImageFormat.Jpeg); _posIntegrationClient.UpdateLocation(dtoLocation); pSaveDTOTablesInLocation(inLocation.TableList, dtoLocation); _locationInfoBuilder.AssignLocationID(inLocation, dtoLocation.Id); _locationInfoBuilder.MakeLocationNoLongerNew(inLocation); _locationInfoBuilder.MakeLocationNoLongerModified(inLocation); }