Ejemplo n.º 1
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());
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
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);
        }