示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inDTOLocation"></param>
        /// <returns></returns>
        public LocationInfo BuildLocationInfo(PosIntegrationClient inPosIntegrationClient, DTOLocation inDTOLocation)
        {
            LocationInfo result = new LocationInfo();

            //::::::::::::::::::::::::::::::::::::

            result._new     = false;
            result._id      = inDTOLocation.Id;
            result.Location = inDTOLocation.Name;
            result.Width    = inDTOLocation.Width;
            result.Height   = inDTOLocation.Height;

            byte[] byteImg = inPosIntegrationClient.GetBackgroundImgDataForLocation(inDTOLocation.Id);
            //if(byteImg.Length > 0)
            if (byteImg != null)
            {
                Image img = Helper.byteArrayToImage(byteImg);

                result.BackImageOrientation = (img.Width > img.Height) ? ImageOrientation.Lanscape : ImageOrientation.Portrait;
                result.BackImage            = img;
            }

            result._modified = false;

            pAddTables(inPosIntegrationClient, result);

            //::::::::::::::::::::::::::::::::::::

            return(result);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inPosIntegrationClient"></param>
        /// <returns></returns>
        private bool pInitLocations(PosIntegrationClient inPosIntegrationClient)
        {
            bool result = true;

            //:::::::::::::::::::::::::::::::::

            try
            {
                DTOLocation[] dtoLocations = inPosIntegrationClient.GetAllLocations();
                pClearLocationInfoList();

                foreach (DTOLocation dtoLocation in dtoLocations)
                {
                    _locationList.Add(_locationInfoBuilder.BuildLocationInfo(_posIntegrationClient, dtoLocation));
                }

                _locationIndex = (_locationList.Count == 0) ? -1 : 0;
            }
            catch
            {
                result = false;
            }

            //:::::::::::::::::::::::::::::::::

            return(result);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="?"></param>
        /// <param name="?"></param>
        private void pAddTables(PosIntegrationClient inPosIntegrationClient, LocationInfo inLocation)
        {
            DTOReservable[] dtoReservableTables = inPosIntegrationClient.GetTablesForLocation(inLocation._id);

            foreach (DTOReservable reservableTable in dtoReservableTables)
            {
                inLocation.AddTable(TableInfoBuilder.Instance.BuildTableInfo(reservableTable));
            }
        }
示例#4
0
 /// <summary>
 ///     Creates a PosIntegrationClient object to communicate with PosIntegration Service
 /// </summary>
 /// <param name="document"></param>
 /// <exceptions>
 ///    <exception name="PosIntegration client Exception" description="Any Exception coming from PosIntegration client"></exception>
 /// </exceptions>
 /// <returns></returns>
 protected virtual void initPosIntegrationClient()
 {
     if (_posIntegrationClient == null)
     {
         try
         {
             _posIntegrationClient = new PosIntegrationClient();
         }
         catch (Exception exc)
         {
             _posIntegrationFailed = true;
             throw new PosIntegrationException(exc.Message);
         }
     }
 }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private PosIntegrationClient pCreatePosIntegrationClient()
        {
            PosIntegrationClient result = null;

            //:::::::::::::::::::::::::::::::::::

            try
            {
                result = new PosIntegrationClient();
            }
            catch (Exception exc)
            {
                _errorMsg = exc.Message;
            }

            //::::::::::::::::::::::::::::::::::::

            return(result);
        }
示例#6
0
文件: Program.cs 项目: radtek/Pos
        static void TestService()
        {
            PosIntegrationClient client = new PosIntegrationClient();

            // Use the 'client' variable to call operations on the service.

            try
            {
                DTOLocation[] locations = client.GetAllLocations();

                foreach (DTOLocation location in locations)
                {
                    System.Console.WriteLine(location.Name);

                    byte[] bckgImg = client.GetBackgroundImgDataForLocation(location.Id);

                    DTOReservable[] tables = client.GetTablesForLocation(location.Id);

                    foreach (DTOReservable table in tables)
                    {
                        System.Console.WriteLine(string.Format(@"{4} Table: {0}  Position:{1}, {2}  Shape: {3}", table.Id, table.X, table.Y, table.Shape, @"\t"));
                    }
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.Message);
            }
            finally
            {
                System.Console.ReadLine();

                // Always close the client.
                client.Close();
            }
        }
示例#7
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public bool pInitPosIntegrationClient()
 {
     return((_posIntegrationClient = pCreatePosIntegrationClient()) != null);
 }