private void SetStartTicketButton()
 {
     if ((_controlMode == ControlMode.Carryout) ||
         (_controlMode == ControlMode.DineIn))
     {
         buttonStartTicket.IsEnabled = ((phoneNumberEditControl.Text != null) &&
                                        (phoneNumberEditControl.Text.Length == 10) &&
                                        !String.IsNullOrEmpty(textBoxCustomerName.Text));
     }
     else
     {
         ZipCode zipCode = null;
         if ((textBoxZip.Text == null) ||
             (textBoxZip.Text.Length != 5) ||
             ((zipCode = ZipCode.Get(GetZipCode())) == null))
         {
             textBoxCityState.Text = null;
         }
         else
         {
             ZipCodeCity  zipCodeCity = ZipCodeCity.Get(zipCode.CityId);
             ZipCodeState zipCodeSate = ZipCodeState.Get(zipCodeCity.StateId);
             textBoxCityState.Text = zipCodeCity.City + ", " + zipCodeSate.Abbreviation;
         }
         buttonStartTicket.IsEnabled = (
             !string.IsNullOrEmpty(phoneNumberEditControl.Text) &&
             !string.IsNullOrEmpty(textBoxCustomerName.Text) &&
             !string.IsNullOrEmpty(textBoxStreetAddress.Text) &&
             (zipCode != null));
     }
 }
Пример #2
0
 public static void QueryCurrentWeather(int zipCode)
 {
     if (!IsActive)
     {
         ZipCode zipCodeDb = ZipCode.Get(zipCode);
         if (zipCodeDb != null)
         {
             ZipCodeCity zipCodeCity = ZipCodeCity.Get(zipCodeDb.CityId);
             ServerUri = "http://forecast.weather.gov/MapClick.php?lat=" +
                         zipCodeCity.Latitude + "&lon=" +
                         zipCodeCity.Longitude + "&site=all&smap=1";
             CurrentZipCode     = zipCode;
             IsActive           = true;
             CurrentWeather     = "";
             CurrentTemperature = -1000;
             BytesReceived      = 0;
             DownloadThread     = new Thread(DownloadWebFileStart);
             DownloadThread.Start();
         }
         else
         {
             if (QueryFailed != null)
             {
                 QueryFailed.Invoke(typeof(WeatherHelper), new EventArgs());
             }
         }
     }
 }
        private void InitializeDeliveryTickets()
        {
            IEnumerable <Ticket> openTickets = TicketManager.GetOpenTickets();

            foreach (Ticket ticket in openTickets)
            {
                if (ticket.Type != TicketType.Delivery)
                {
                    continue;
                }
                Person customerPerson =
                    PersonManager.GetPersonByCustomerId(ticket.CustomerId);
                ZipCode      zipCode      = ZipCode.Get(customerPerson.ZipCodeId);
                ZipCodeCity  zipCodeCity  = ZipCodeCity.Get(zipCode.CityId);
                ZipCodeState zipCodeState = ZipCodeState.Get(zipCodeCity.StateId);
                listBoxDeliveries.Items.Add(
                    new FormattedListBoxItem(0, ((ticket.OrderId != null) ?
                                                 Types.Strings.OrderNumber + ticket.OrderId.Value + ", " : "") +
                                             Types.Strings.TicketNumber + ticket.PrimaryKey.Id + Environment.NewLine +
                                             Environment.NewLine +
                                             customerPerson.FirstName + " " + customerPerson.LastName +
                                             Environment.NewLine + customerPerson.AddressLine1 +
                                             (string.IsNullOrEmpty(customerPerson.AddressLine2) ? "" :
                                              Environment.NewLine + customerPerson.AddressLine2) +
                                             Environment.NewLine + zipCodeCity.City + ", " +
                                             zipCodeState.Abbreviation + " " + zipCode.PostalCode.ToString("D5"), true));
            }
        }
Пример #4
0
        public static UnitedStatesCity Find(int zipCode)
        {
            ZipCode               zipcode         = ZipCode.Get(zipCode);
            ZipCodeCity           city            = ZipCodeCity.Get(zipcode.CityId);
            ZipCodeState          state           = ZipCodeState.Get(city.StateId);
            IEnumerable <ZipCode> allCityZipCodes = ZipCode.GetAll(zipcode.CityId);

            int[] allIntCityZipCodes = ToIntArray(allCityZipCodes);
            return(new UnitedStatesCity(allIntCityZipCodes, city.City, state.StateName, state.Abbreviation));
        }
Пример #5
0
        private static void PrintHeaderInformation(PrintDestination printDestination,
                                                   PosPrinter printer, Ticket ticket, TicketItemPrintOptions printOptions)
        {
            // Print the receipt header image
            string filename = "receipt-header.gif";

            if (File.Exists(filename))
            {
                PrintToReceipt(printer, PrinterEscapeCodes.SetCenter);
                printer.PrintBitmap(PrinterStation.Receipt, filename, 200, PosPrinter.PrinterBitmapCenter);
            }

            // Occasion / Seating Information
            if (ConfigurationManager.UseSeating)
            {
                PrintLineToReceipt(printer,
                                   PrinterEscapeCodes.SetCenter + ticket.Type.GetFriendlyName());
            }

            // Print Ticket Number
            PrintLineToReceipt(printer, ((ticket.OrderId == null) ? "" : Strings.Order +
                                         ticket.OrderId.Value + ", ") + Strings.Ticket + ticket.PrimaryKey.Id);

            Person person = PersonManager.GetPersonByEmployeeId(ticket.EmployeeId);

            PrintLineToReceipt(printer, Strings.Employee + ": " + person.FirstName + " " +
                               person.LastName.Substring(0, 1));
            if (ticket.SeatingId > 0)
            {
                Seating seating = SeatingManager.GetSeating(ticket.SeatingId);
                PrintLineToReceipt(printer, Strings.Table + seating.Description);
            }

            // Print date and time (now, future time, or ticket close time)
            DateTime time     = DateTime.Now;
            int?     intValue = OrderEntryCommands.GetPrepTime().IntValue;

            if (printOptions == TicketItemPrintOptions.AllAsVoid)
            {
                PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketVoid);
            }
            else if (printOptions == TicketItemPrintOptions.TicketRefund)
            {
                PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketRefund);
            }
            else if (printOptions == TicketItemPrintOptions.AllAsCancelMade)
            {
                PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketCancelMade);
            }
            else if (printOptions == TicketItemPrintOptions.AllAsCancelUnmade)
            {
                PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketCancelUnmade);
            }
            else if (printOptions == TicketItemPrintOptions.TicketItemVoid)
            {
                PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketItemVoid);
            }
            else if (printOptions == TicketItemPrintOptions.TicketItemReturn)
            {
                PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.TicketItemReturn);
            }
            else if (ticket.StartTime.HasValue && intValue.HasValue &&
                     ((ticket.StartTime.Value - new TimeSpan(0, 0, ticket.StartTime.Value.Second) -
                       new TimeSpan(0, intValue.Value, 0)) >= time) &&
                     !ticket.IsClosed)
            {
                PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.FutureOrder);
                time = ticket.StartTime.Value;
            }
            else if (ticket.StartTime.HasValue && !ticket.IsClosed)
            {
                PrintLineToReceipt(printer, PrinterEscapeCodes.SetCenter + Strings.MakeNow);
                time = ticket.StartTime.Value;
            }
            if (ticket.IsClosed && ticket.CloseTime.HasValue)
            {
                time = ticket.CloseTime.Value;
            }
            PrintLineToReceipt(printer, time.ToShortDateString() +
                               PrinterEscapeCodes.SetRight + time.ToShortTimeString());

            // Newline
            PrintLineToReceipt(printer);

            // Customer's Information
            bool isKitchen = ((printDestination == PrintDestination.Kitchen1) ||
                              (printDestination == PrintDestination.Kitchen2) ||
                              (printDestination == PrintDestination.Kitchen3));

            if (!isKitchen && (ticket.CustomerId > 0))
            {
                person = PersonManager.GetPersonByCustomerId(ticket.CustomerId);
                PrintLineToReceipt(printer, person.FirstName + " " + person.LastName);
                if ((ticket.Type == TicketType.Delivery) ||
                    (ticket.Type == TicketType.Catering))
                {
                    ZipCode      zipCode      = ZipCode.Get(person.ZipCodeId);
                    ZipCodeCity  zipCodeCity  = ZipCodeCity.Get(zipCode.CityId);
                    ZipCodeState zipCodeState = ZipCodeState.Get(zipCodeCity.StateId);
                    PrintLineToReceipt(printer, person.AddressLine1);
                    if (!string.IsNullOrEmpty(person.AddressLine2))
                    {
                        PrintLineToReceipt(printer, person.AddressLine2);
                    }
                    PrintLineToReceipt(printer, zipCodeCity.City + ", " +
                                       zipCodeState.Abbreviation + " " +
                                       zipCode.PostalCode.ToString("D5"));
                }
                if (person.PhoneNumberId1 > 0)
                {
                    PhoneNumber phoneNumber = PhoneNumber.Get(person.PhoneNumberId1);
                    PrintLineToReceipt(printer, phoneNumber.GetFormattedPhoneNumber());
                }

                // Newline
                PrintLineToReceipt(printer);
            }
        }