Esempio n. 1
0
 public JsonResult SaveLogisticInfo(LogisticScheduleModel logistic)
 {
     if (!string.IsNullOrEmpty(logistic.LogisticID))
     {
         var response = _logisticService.Update(logistic);
         return(Json(response, JsonRequestBehavior.AllowGet));
     }
     else
     {
         logistic.LogisticID  = Guid.NewGuid().ToString();
         logistic.CreatedDate = DateTime.Now;
         var response = _logisticService.Create(logistic);
         return(Json(response, JsonRequestBehavior.AllowGet));
     }
 }
Esempio n. 2
0
        private IList <UserExportModel> BuildExportList(IList <UserModel> users, IList <MailingAddressModel> mailings)
        {
            IList <UserExportModel> exports = new List <UserExportModel>();

            UserExportModel       ex;
            MailingAddressModel   mailing     = null;
            MainScholarshipModel  scholarship = null;
            PaymentModel          payment     = null;
            LogisticScheduleModel logistic    = null;

            foreach (UserModel user in users)
            {
                ex      = new UserExportModel();
                mailing = mailings.Where(m => m.UserID == user.UserID).FirstOrDefault();
                var _scholarship = _mainScholarshipService.FindByUserID(user.UserID);
                var _payment     = _paymentService.FindByUserID(user.UserID);

                //mailing = _mailing.Items != null ? _mailing.Items.FirstOrDefault() : null;
                scholarship = _scholarship.Items != null?_scholarship.Items.FirstOrDefault() : null;

                payment = _payment.Items != null?_payment.Items.FirstOrDefault() : null;

                logistic = _logisticService.FindByUserID(user.UserID).Item;

                //Convert from user to userexport
                ConvertFromUser(user, ex);

                //Convert from mailing to userexport
                ConvertFromMailing(mailing, ex);

                //Convert from main scholarship
                //ConvertFromMainScholarship(scholarship, ex);

                //Convert from payment
                ConvertFromPayment(payment, ex);

                //Convert logistic
                ConvertFromLogistic(logistic, ex);

                exports.Add(ex);
            }

            return(exports);
        }
Esempio n. 3
0
        private void ConvertFromLogistic(LogisticScheduleModel logistic, UserExportModel ex)
        {
            if (logistic == null)
            {
                return;
            }

            ex.ArrivalDate           = logistic.ArrivalDate.HasValue ? logistic.ArrivalDate.Value.ToString("yyyy/MM/dd") : string.Empty;
            ex.ArrivalTime           = logistic.ArrivalDate.HasValue ? logistic.ArrivalDate.Value.ToString("HH:mm") : string.Empty;
            ex.ArrivalFlightNumber   = logistic.ArrivalFlightNumber;
            ex.ArrivalGate           = !string.IsNullOrEmpty(logistic.ArrivalGate) ? logistic.ArrivalGate.Replace("undefined", "") : "";
            ex.DepartureDate         = logistic.DepartureDate.HasValue ? logistic.DepartureDate.Value.ToString("yyyy/MM/dd") : string.Empty;
            ex.DepartureTime         = logistic.DepartureDate.HasValue ? logistic.DepartureDate.Value.ToString("HH:mm") : string.Empty;
            ex.DepartureFlightNumber = logistic.DepartureFlightNumber;
            ex.DepartureGate         = !string.IsNullOrEmpty(logistic.DepartureGate) ? logistic.DepartureGate.Replace("undefined", "") : "";
            ex.WhenNeedPick          = !string.IsNullOrEmpty(logistic.WhenNeedPick) ? logistic.WhenNeedPick.Replace("undefined", "") : "";
            ex.SpecialRequirement    = logistic.SpecialRequirement;
            ex.HotelName             = logistic.HotelName != "Empty" ? logistic.HotelName : "";
            ex.CheckinDate           = logistic.CheckinDate.HasValue ? logistic.CheckinDate.Value.ToString("MMM/dd/yyyy HH:mm:ss") : "";
            ex.CheckoutDate          = logistic.CheckoutDate.HasValue ? logistic.CheckoutDate.Value.ToString("MMM/dd/yyyy HH:mm:ss") : "";
            ex.VisaProcess           = !string.IsNullOrEmpty(logistic.VisaProcess) ? logistic.VisaProcess.Replace("undefined", "") : "";
            ex.AirportService        = logistic.AirportService;
            ex.ConferenceRoles       = !string.IsNullOrEmpty(logistic.ConferenceRoles) ? logistic.ConferenceRoles.Replace("undefined", "") : "";
        }