/// <summary> /// Gets all customer events for a given customer /// </summary> /// <returns>customer events</returns> public CameleoCustomerEventListViewModel GetCustomerEventListViewModel(int customerId) { var records = GetAllCustomerEvents(customerId); CameleoCustomerEventListViewModel customerEventListViewModel = new CameleoCustomerEventListViewModel(); var events = records .Select(x => { var m = new CameleoCustomerEventViewModel() { Id = x.Id, EventUserId = x.EventUserId, CustomerId = x.CustomerId, CustomerUserName = _customerService.GetCustomerById(x.CustomerId).Username, Paid = x.Paid, Accepted = x.Accepted, AcceptedStatus = x.AcceptedStatus, AcceptedStatusString = _localizationService.GetResource(AcceptedStatusStrings.LocalizedStringValues[x.AcceptedStatus]), AcceptedImageUse = x.AcceptedImageUse, CreatedOnUtc = x.CreatedOnUtc, CameleoEventUser = new CameleoEventUserViewModel(_eventUserService.GetEventUserById(x.EventUserId), _eventUserService.GetEventUsersCount(_eventUserService.GetEventUserById(x.EventUserId)), _eventUserService.GetAcceptedEventUsersCount(_eventUserService.GetEventUserById(x.EventUserId))), CameleoEvent = new CameleoEventViewModel(_eventService.GetEventByEventUserId(x.EventUserId), _eventService.GetAllGroupsForEvent(_eventService.GetEventByEventUserId(x.EventUserId).Id), _localizationService.GetResource(CameleoEventStatusStrings.LocalizedStringValues[_eventService.GetEventByEventUserId(x.EventUserId).Status])), }; return(m); }) .ToList(); customerEventListViewModel.CameleoCustomerEventList = events; return(customerEventListViewModel); }
public ActionResult CustomerEventDelete(int Id) { var tmpCustomerEvent = _customerEventService.GetCustomerEventById(Id); if (tmpCustomerEvent == null) { //Customer event not found throw new ArgumentException(_localizationService.GetResource("Plugins.Cameleo.CameleoCustomerEvents.Delete.NotFound")); } var tmpEvent = _eventService.GetEventByEventUserId(tmpCustomerEvent.EventUserId); var tmpEvenTuser = _eventUserService.GetEventUserById(tmpCustomerEvent.EventUserId); //Delete Customer event _customerEventService.DeleteCustomerEvent(tmpCustomerEvent); // Refresh view return(new NullJsonResult()); }
CustomerEventReminderListViewModel BuildCustomerEventReminderListViewModel(int customerEventId) { var model = new CustomerEventReminderListViewModel(); model.StaffCustomerEventId = customerEventId; var tmpStaffCustomerEvent = _customerEventService.GetCustomerEventById(customerEventId); var tmpStaffEventUser = _eventUserService.GetEventUserById(tmpStaffCustomerEvent.EventUserId); //Group model.GroupName = tmpStaffEventUser.Group; //Get event var tmpEvent = _eventService.GetEventByEventUserId(tmpStaffCustomerEvent.EventUserId); model.EventId = tmpEvent.Id; //Participation fee model.ParticipationFee = (decimal)tmpEvent.ParticipationFee; //Get client logo model.Logo = tmpEvent.ClientLogo; //Replace default logo if configured string tmppath = _localizationService.GetResource("plugins.cameleo.cameleocustomerevents.reminders.defaultlogo.path"); if (!string.IsNullOrEmpty(model.Logo)) { tmppath = tmppath.Replace("default-reminder-logo", model.Logo); } model.LogoPath = Server.MapPath(tmppath); // Steps images model.Step1Path = Server.MapPath(_localizationService.GetResource("plugins.cameleo.cameleocustomerevents.reminders.step1.path")); model.Step2Path = Server.MapPath(_localizationService.GetResource("plugins.cameleo.cameleocustomerevents.reminders.step2.path")); model.Step3Path = Server.MapPath(_localizationService.GetResource("plugins.cameleo.cameleocustomerevents.reminders.step3.path")); model.Step4Path = Server.MapPath(_localizationService.GetResource("plugins.cameleo.cameleocustomerevents.reminders.step4.path")); //Shoot date model.ShootDate = ((DateTime)tmpEvent.ShootedOnUtc).ToString("yyyy-MM-dd"); //Reminder date model.ReminderDate = ((DateTime)tmpEvent.AcceptReminderDateUtc).ToString("yyyy-MM-dd"); //Sender name model.SenderName = tmpStaffEventUser.FirstName + " " + tmpStaffEventUser.LastName; //Get customer events that did not answer var noAnswerCustomerEvents = _customerEventService.GetAllNoAnswerCustomerEventsForGroup(tmpEvent.Id, tmpStaffEventUser.Group); foreach (var tmpCustomerEvent in noAnswerCustomerEvents.Reverse()) { model.CameleoEventUserList.Insert(0, new CameleoEventUserViewModel(_eventUserService.GetEventUserById(tmpCustomerEvent.EventUserId), 0, 0)); } //Get remaining event users that did not answer var noAnswerEventUsers = _eventUserService.GetNoAnswerEventUsers(tmpEvent.Id, tmpStaffEventUser.Group); foreach (var tmpEventUser in noAnswerEventUsers.Reverse()) { model.CameleoEventUserList.Insert(0, new CameleoEventUserViewModel(tmpEventUser, 0, 0)); } return(model); }