Exemplo n.º 1
0
        private void setInfoByStayment(Trip trip)
        {
            Stayment     firstStayment = Connection.TripperData.Stayments.Where(stayment => stayment.Trip.Equals(trip)).OrderBy(stayment => stayment.DateFrom).First();
            Localization city          = Connection.TripperData.Localizations.Single(loc => loc.LocalizationID.Equals(firstStayment.LocalizationID));

            lDestination.Text = Connection.TripperData.Countries.Single(country => country.CountryID.Equals(city.CountryID)).Name.ToString() + ", " + city.City;
            if (firstStayment.DateFrom != null)
            {
                DateTime date = DateTime.Parse(firstStayment.DateFrom.ToString());

                lStartDate.Text = date.ToShortDateString();
            }

            if (firstStayment.DateFrom > DateTime.Today)
            {
                TimeSpan tempDays = DateTime.Parse(firstStayment.DateFrom.ToString()).Date - DateTime.Today.Date;
                int      daysTo   = int.Parse(tempDays.Days.ToString());

                string day = daysTo > 1 ? "dni" : "dzień";
                lDaysCount.Text = "Podróż rozpocznie się za " + daysTo + " " + day;
            }
            else
            {
                lDaysCount.Text = "Podróż odbyła się";
            }
        }
Exemplo n.º 2
0
 public NewHotelCreator() : base()
 {
     InitializeComponent();
     Mode   = BusinessLogic.CreatorMode.AddNew;
     Status = CreatorStatus.Edit;
     dtpDateFrom.Date.ValueChanged += dtpDateFrom_ValueChangedDate;
     dtpDateTo.Date.ValueChanged   += dtpDateTo_ValueChangedDate;
     selecteStayment = new Stayment();
 }
Exemplo n.º 3
0
 public NewHotelCreator(Stayment row) : base()
 {
     Mode = BusinessLogic.CreatorMode.Edit;
     InitializeComponent();
     selecteStayment = Connection.TripperData.Stayments.Single(transport => transport.Equals(row));
     tLocalization.FillLocalizationFields(selecteStayment.LocalizationID);
     tHotelName.GetData <string>(selecteStayment.Name);
     tHotelAddress.GetData <string>(selecteStayment.Address);
     // tConfirmationNo.GetData<string>(selecteStayment.PhoneNumber);
     tStaymentCost.GetData(selecteStayment.Cost);
     dtpDateFrom.GetDate(selecteStayment.DateFrom);
     dtpDateTo.GetDate(selecteStayment.DateTo);
     tAdditonalInformations.GetData <string>(selecteStayment.AdditionalInformation);
 }
Exemplo n.º 4
0
        public static Stayment AddNewHotel(String hotelName, String hotelAddress,
                                           String hotelPhoneNumber, String additionalInfo, DateTime arrivalDate, DateTime dispatchDate, int tripID)
        {
            Stayment newHotel = new Stayment();

            newHotel.TripID = tripID;

            newHotel.Name    = hotelName;
            newHotel.Address = hotelAddress;

            newHotel.DateTo   = dispatchDate; //can't add if datafield is empty as control does not return default valuea valid for DateTime, instead it return Now or Today
            newHotel.DateFrom = arrivalDate;  //same as line above

            newHotel.AdditionalInformation = additionalInfo;
            return(newHotel);
        }
 public StaymentListRow(Stayment Stayment)
 {
     SelectedStayment = Stayment;
     InitializeComponent();
     lStaymentInfo.Text = SetInfo();
 }