예제 #1
0
 /// <summary>
 /// Does basic completness/sanity checks on reservable (table) dto. Throws an
 /// InvalidDTOException when any validation check fails. This method must
 /// be used in a try/catch block!
 /// </summary>
 /// <param name="tableDTO"></param>
 public static void ValidateReservableDTO(DTOReservable tableDTO)
 {
     if (tableDTO == null)
     {
         throw new InvalidDTOException("Invalid reservable informaiton supplied (null reference)");
     }
     if (tableDTO.Name == null)
     {
         throw new InvalidDTOException("Name of reservable was null");
     }
 }
예제 #2
0
파일: DTOReservable.cs 프로젝트: radtek/Pos
        public override bool Equals(object obj)
        {
            bool          b     = false;
            DTOReservable other = obj as DTOReservable;

            if (other != null)
            {
                if (this.Id == other.Id)
                {
                    b = true;
                }
            }
            return(b);
        }
예제 #3
0
        // ---------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="tableDTO"></param>
        /// <returns></returns>
        public static Table TableFromDTO(DTOReservable tableDTO)
        {
            // TODO: validation!

            Table t = new Table(tableDTO.Name, tableDTO.MaxGuests);

            t.Id = tableDTO.Id;

            t.X      = tableDTO.X;
            t.Y      = tableDTO.Y;
            t.Width  = tableDTO.Width;
            t.Height = tableDTO.Height;

            t.RotationAngle = tableDTO.RotationAngle;
            t.Shape         = tableDTO.Shape;

            t.Number = tableDTO.Number;

            return(t);
        }
예제 #4
0
파일: DTOFactory.cs 프로젝트: radtek/Pos
        // ---------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="r"></param>
        /// <returns></returns>
        public static DTOReservable BuildReservableDTO(Table r, Terminal t)
        {
            DTOReservable reservableDTO = new DTOReservable();

            if (r != null)
            {
                reservableDTO.Id        = r.Id;
                reservableDTO.Name      = r.Name;
                reservableDTO.MaxGuests = r.MaxGuests;

                // create a 'shallow' dto location
                DTOLocation pl = new DTOLocation();
                pl.Id   = r.ParentLocation.Id;
                pl.Name = r.ParentLocation.Name;

                reservableDTO.ParentLocation = pl;

                // send back the current interest level
                if (r.Id != 0)
                {
                    reservableDTO.CurrentInterestLevel = ReservationsService.GetTableInterestLevel(r.Id);
                }

                // table plan data
                reservableDTO.X             = r.X;
                reservableDTO.Y             = r.Y;
                reservableDTO.Width         = r.Width;
                reservableDTO.Height        = r.Height;
                reservableDTO.RotationAngle = r.RotationAngle;
                reservableDTO.Shape         = r.Shape;

                reservableDTO.TableColor = r.Status(t);

                reservableDTO.Number = r.Number;
            }
            return(reservableDTO);
        }