예제 #1
0
        /// <summary>
        /// Gets a customer event user by id
        /// </summary>
        /// <returns>CameleoCustomerEventViewModel</returns>
        public CameleoCustomerEventViewModel GetCustomerEventViewModel(int customerEventId)
        {
            var tmpCustomerEvent = GetCustomerEventById(customerEventId);

            if (tmpCustomerEvent == null)
            {
                return(null);
            }
            else
            {
                CameleoCustomerEventViewModel customerEventViewModel = new CameleoCustomerEventViewModel(tmpCustomerEvent, _customerService.GetCustomerById(tmpCustomerEvent.CustomerId).Username, _localizationService.GetResource(AcceptedStatusStrings.LocalizedStringValues[tmpCustomerEvent.AcceptedStatus]));
                var tmpEventUser = _eventUserService.GetEventUserById(tmpCustomerEvent.EventUserId);
                var tmpEvent     = _eventService.GetEventById(tmpEventUser.EventId);
                customerEventViewModel.CameleoEventUser = new CameleoEventUserViewModel(tmpEventUser, _eventUserService.GetEventUsersCount(_eventUserService.GetEventUserById(tmpCustomerEvent.EventUserId)), _eventUserService.GetAcceptedEventUsersCount(_eventUserService.GetEventUserById(tmpCustomerEvent.EventUserId)));
                customerEventViewModel.CameleoEvent     = new CameleoEventViewModel(tmpEvent, _eventService.GetAllGroupsForEvent(tmpEventUser.EventId), _localizationService.GetResource(CameleoEventStatusStrings.LocalizedStringValues[tmpEvent.Status]));
                return(customerEventViewModel);
            }
        }
예제 #2
0
        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());
        }
예제 #3
0
        public ActionResult EventUserUpdate(CameleoEventUserViewModel model)
        {
            var tmpEventUser = _eventUserService.GetEventUserById(model.Id);

            if (tmpEventUser == null)
            {
                //Event user not found
                throw new ArgumentException(_localizationService.GetResource("Plugins.Cameleo.CameleoEventUsers.Update.NotFound"));
            }

            //Update event user
            tmpEventUser.Password     = model.Password;
            tmpEventUser.LastName     = model.LastNameFull;
            tmpEventUser.FirstName    = model.FirstName;
            tmpEventUser.Email        = model.Email;
            tmpEventUser.UniqueId     = model.UniqueId;
            tmpEventUser.Group        = model.Group;
            tmpEventUser.SuperiorName = model.SuperiorName;
            tmpEventUser.isStaff      = model.isStaff;
            _eventUserService.UpdateEventUser(tmpEventUser);

            // Refresh view
            return(new NullJsonResult());
        }
예제 #4
0
        public ActionResult TopMenu(int?customerEventId)
        {
            //Get Catalog controller
            var tmpCatalogController = DependencyResolver.Current.GetService(typeof(CatalogController)) as CatalogController;
            PartialViewResult result = (PartialViewResult)tmpCatalogController.TopMenu();

            //Current catalog topmenu model
            TopMenuModel        tmpModel        = (TopMenuModel)result.ViewData.Model;
            CameleoTopMenuModel tmpCameleoModel = new CameleoTopMenuModel();

            tmpCameleoModel.BlogEnabled  = tmpModel.BlogEnabled;
            tmpCameleoModel.ForumEnabled = tmpModel.ForumEnabled;
            tmpCameleoModel.Categories   = tmpModel.Categories;
            tmpCameleoModel.RecentlyAddedProductsEnabled = tmpModel.RecentlyAddedProductsEnabled;

            //Enable MyGroup Menu for staff ?
            //In customer event details page?
            if (customerEventId == null)
            {
                //No don't show menu
                tmpCameleoModel.MyGroupEnabled = false;
            }
            else
            {
                //Else, get customer event
                var tmpCustomerEvent = _customerEventService.GetCustomerEventById(customerEventId);
                //Found?
                if (tmpCustomerEvent == null)
                {
                    //No don't show menu
                    tmpCameleoModel.MyGroupEnabled = false;
                }
                else
                {
                    // Get event user
                    var tmpEventUser = _eventUserService.GetEventUserById(tmpCustomerEvent.EventUserId);

                    //Found?
                    if (tmpEventUser == null)
                    {
                        //No don't show menu
                        tmpCameleoModel.MyGroupEnabled = false;
                    }
                    else
                    {
                        //Else, check if staff
                        if (tmpEventUser.isStaff)
                        {
                            //Yes, show menu
                            tmpCameleoModel.MyGroupEnabled  = true;
                            tmpCameleoModel.CustomerEventId = customerEventId;
                        }
                        else
                        {
                            //Else don't show menu
                            tmpCameleoModel.MyGroupEnabled = false;
                        }
                    }
                }
            }

            //Return view
            return(PartialView(tmpCameleoModel));
        }
예제 #5
0
        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);
        }