Esempio n. 1
0
        public ExecAction CreateAction()
        {
            string emails = "";
            string dates  = "";

            if (this.EmailReceiver != null && this.EmailReceiver.Length > 0)
            {
                emails = String.Join(";", EmailReceiver);
            }
            else
            {
                throw new Exception("Choose at least one receiver email address");
            }
            if (this.DepartureDates != null && this.DepartureDates.Length > 0)
            {
                dates = String.Join(";", DepartureDates.Select(x => x.ToShortDateString()));
            }
            else
            {
                throw new Exception("Choose at least one date");
            }
            string args = String.Format("--from {0} --to {1} --d {2} --id {3} --email {4}", Origin, Destination, dates, TaskID, emails);
            //string path = Assembly.GetExecutingAssembly().Location;
            string path = (ConfigurationManager.AppSettings["AirArabiaExeLocation"]);

            return(new ExecAction(path, args));
        }
Esempio n. 2
0
        public bool InitialDatesIsValid(ModelStateDictionary state)
        {
            bool isValid = true;

            if (DepartureDates.Length < 1)
            {
                state.AddModelError("", @"Вы не указали дату отправления или дату прибытия");
                isValid = false;
            }
            if (DepartureDates.Length != DestinationDates.Length)
            {
                state.AddModelError("", @"Количество дат отправления, и дат прибытия не совпадает");
                isValid = false;
            }
            if (!isValid)
            {
                return(false);
            }

            DepartureDates   = DepartureDates.Select(x => x.AddHours(DepartureHours).AddMinutes(DepartureMinutes)).ToArray();
            DestinationDates = DestinationDates.Select(x => x.AddHours(DestinationHours).AddMinutes(DepartureMinutes)).ToArray();
            return(true);
        }
Esempio n. 3
0
 public string GetDepartureDates()
 {
     return(DepartureDates != null?string.Join(", ", DepartureDates.Select(x => x.ToString("yyyy-MM-dd"))) : "");
 }