Esempio n. 1
0
        /// <summary>
        /// Manage Menu
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel ManageMenu(GridOperationEnums operation, MenuModel model)
        {
            Mapper.CreateMap <MenuModel, Menu>();
            Menu          menu;
            ResponseModel response;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                menu      = GetById(model.Id);
                menu.Name = model.Name;
                menu.Url  = model.Url;
                var hasUpdatePermission = !(model.Controller == menu.Controller && model.Action == menu.Action);
                menu.Controller   = model.Controller;
                menu.Action       = model.Action;
                menu.ParentId     = model.ParentId;
                menu.MenuIcon     = model.MenuIcon;
                menu.Visible      = model.Visible;
                menu.RecordActive = model.RecordActive;
                menu.RecordOrder  = model.RecordOrder;
                menu.ParentId     = model.ParentName.ToNullableInt();
                response          = HierarchyUpdate(menu);
                if (hasUpdatePermission)
                {
                    UpdateMenuPermission(menu);
                }
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Menus:::Messages:::UpdateSuccessfully:::Update menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::Menus:::UpdateFailure:::Update menu failed. Please try again later.")));

            case GridOperationEnums.Add:
                menu          = Mapper.Map <MenuModel, Menu>(model);
                menu.ParentId = model.ParentName.ToNullableInt();
                response      = HierarchyInsert(menu);
                UpdateMenuPermission(menu);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Menus:::Messages:::CreateSuccessfully:::Create menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::Menus:::Messages:::CreateFailure:::Create menu failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Menus:::Messages:::DeleteSuccessfully:::Delete menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::Menus:::Messages:::DeleteFailure:::Delete menu failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Menus:::Messages:::ObjectNotFounded:::Menu is not founded.")
            });
        }
        /// <summary>
        /// Manage LocalizedResource
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel ManageLocalizedResource(GridOperationEnums operation, LocalizedResourceModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <LocalizedResourceModel, LocalizedResource>();
            LocalizedResource localizedResource;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                localizedResource = GetById(model.Id);
                localizedResource.TranslatedValue = model.TranslatedValue;
                localizedResource.RecordActive    = model.RecordActive;

                response = Update(localizedResource);
                if (response.Success)
                {
                    RefreshDictionary();
                }
                return(response.SetMessage(response.Success ?
                                           T("AdminModule:::LocalizedResources:::Messages:::UpdateSuccessfully:::Update localized resource successfully.")
                        : T("AdminModule:::LocalizedResources:::Messages:::UpdateFailure:::Update localized resource failed. Please try again later.")));

            case GridOperationEnums.Add:
                localizedResource = Mapper.Map <LocalizedResourceModel, LocalizedResource>(model);
                localizedResource.DefaultValue = model.TranslatedValue;
                response = Insert(localizedResource);
                if (response.Success)
                {
                    RefreshDictionary();
                }
                return(response.SetMessage(response.Success ?
                                           T("AdminModule:::LocalizedResources:::Messages:::CreateSuccessfully:::Create localized resource successfully.")
                        : T("AdminModule:::LocalizedResources:::Messages:::CreateFailure:::Create localized resource failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                if (response.Success)
                {
                    RefreshDictionary();
                }
                return(response.SetMessage(response.Success ?
                                           T("AdminModule:::LocalizedResources:::Messages:::DeleteSuccessfully:::Delete localized resource successfully.")
                        : T("AdminModule:::LocalizedResources:::Messages:::DeleteFailure:::Delete localized resource failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = T("AdminModule:::LocalizedResources:::Messages:::ObjectNotFounded:::Localized resource is not founded.")
            });
        }
Esempio n. 3
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManagePage(GridOperationEnums operation, PageModel model)
        {
            ResponseModel response;
            Page          page;

            Mapper.CreateMap <PageModel, Page>();
            switch (operation)
            {
            case GridOperationEnums.Edit:
                page             = GetById(model.Id);
                page.Title       = model.Title;
                page.Status      = model.Status;
                page.FriendlyUrl = string.IsNullOrWhiteSpace(model.FriendlyUrl)
                                           ? model.Title.ToUrlString()
                                           : model.FriendlyUrl.ToUrlString();
                page.ParentId = model.ParentName.ToNullableInt();

                response = HierarchyUpdate(page);

                _clientMenuServices.SavePageToClientMenu(page.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Pages:::Messages:::UpdateSuccessfully:::Update page successfully.")
                        : _localizedResourceServices.T("AdminModule:::Pages:::Messages:::UpdateFailure:::Update page failed. Please try again later.. Please try again later.")));

            case GridOperationEnums.Del:
                page = GetById(model.Id);
                if (page != null)
                {
                    if (page.Pages1.Any())
                    {
                        return(new ResponseModel
                        {
                            Success = false,
                            Message = _localizedResourceServices.T("AdminModule:::Pages:::Messages:::DeleteReferenceFailure:::Delete is disabled for this page as there are child pages. Please delete child pages first.")
                        });
                    }
                    _clientMenuRepository.Delete(page.ClientMenus.First().Id);

                    response = Delete(model.Id);
                    return(response.SetMessage(response.Success ?
                                               _localizedResourceServices.T("AdminModule:::Pages:::Messages:::DeleteSuccessfully:::Delete page successfully.")
                            : _localizedResourceServices.T("AdminModule:::Pages:::Messages:::DeleteFailure:::Delete page failed. Please try again later.")));
                }
                break;
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Pages:::Messages:::ObjectNotFounded:::Page is not founded.")
            });
        }
Esempio n. 4
0
        /// <summary>
        /// Manage Site HotelRoom
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the HotelRoom model</param>
        /// <returns></returns>
        public ResponseModel ManageHotelRoom(GridOperationEnums operation, HotelRoomModel model)
        {
            int           hotelRoomTypeId;
            ResponseModel response;

            Mapper.CreateMap <HotelRoomModel, HotelRoom>();
            HotelRoom hotelRoom;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                hotelRoom        = GetById(model.Id);
                hotelRoom.Name   = model.Name;
                hotelRoom.Note   = model.Note;
                hotelRoom.Status = model.Status;
                if (int.TryParse(model.HotelRoomTypeName, out hotelRoomTypeId))
                {
                    hotelRoom.HotelRoomTypeId = hotelRoomTypeId;
                }

                response = Update(hotelRoom);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::UpdateSuccessfully:::Update room successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::UpdateFailure:::Update room failed. Please try again later.")));

            case GridOperationEnums.Add:
                hotelRoom        = Mapper.Map <HotelRoomModel, HotelRoom>(model);
                hotelRoom.Status = model.Status;
                if (int.TryParse(model.HotelRoomTypeName, out hotelRoomTypeId))
                {
                    hotelRoom.HotelRoomTypeId = hotelRoomTypeId;
                }

                response = Insert(hotelRoom);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::CreateSuccessfully:::Create room successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::CreateFailure:::Insert room failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::DeleteSuccessfully:::Delete room successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::DeleteFailure:::Delete room failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::ObjectNotFounded:::Room is not founded.")
            });
        }
Esempio n. 5
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManageSiteSetting(GridOperationEnums operation, SiteSettingModel model)
        {
            int           settingTypeId;
            ResponseModel response;

            Mapper.CreateMap <SiteSettingModel, SiteSetting>();
            SiteSetting siteSetting;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                siteSetting       = GetById(model.Id);
                siteSetting.Value = model.Value;
                if (int.TryParse(model.SettingTypeName, out settingTypeId))
                {
                    siteSetting.SettingTypeId = settingTypeId;
                }

                response = Update(siteSetting);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Settings:::Messages:::UpdateSuccessfully:::Update setting successfully.")
                        : _localizedResourceServices.T("AdminModule:::Settings:::Messages:::UpdateFailure:::Update setting failed. Please try again later.")));

            case GridOperationEnums.Add:
                siteSetting = Mapper.Map <SiteSettingModel, SiteSetting>(model);
                if (int.TryParse(model.SettingTypeName, out settingTypeId))
                {
                    siteSetting.SettingTypeId = settingTypeId;
                }

                response = Insert(siteSetting);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Settings:::Messages:::CreateSuccessfully:::Create setting successfully.")
                        : _localizedResourceServices.T("AdminModule:::Settings:::Messages:::CreateFailure:::Insert setting failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Settings:::Messages:::DeleteSuccessfully:::Delete setting successfully.")
                        : _localizedResourceServices.T("AdminModule:::Settings:::Messages:::DeleteFailure:::Delete setting failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Settings:::Messages:::ObjectNotFounded:::Setting is not founded.")
            });
        }
Esempio n. 6
0
        /// <summary>
        /// Manage user
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user model</param>
        /// <returns></returns>
        public ResponseModel ManageUser(GridOperationEnums operation, UserModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <UserModel, User>();
            User user;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                user           = GetById(model.Id);
                user.FirstName = model.FirstName;
                user.LastName  = model.LastName;
                user.Phone     = model.Phone;
                user.Status    = model.Status;

                user.IdentityNumber = model.IdentityNumber;
                user.RecordActive   = model.RecordActive;
                user.RecordOrder    = 0;
                response            = Update(user);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Users:::Messages:::UpdateSuccessfully:::Update user successfully.")
                        : _localizedResourceServices.T("AdminModule:::Users:::Messages:::UpdateFailure:::Update user failed. Please try again later.")));

            //case GridOperationEnums.Add:
            //    user = Mapper.Map<UserModel, User>(model);
            //    user.Status = model.Status;

            //    user.RecordOrder = 0;
            //    response = Insert(user);
            //    return response.SetMessage(response.Success ?
            //        _localizedResourceServices.T("AdminModule:::Users:::Messages:::CreateSuccessfully:::Create user successfully.")
            //        : _localizedResourceServices.T("AdminModule:::Users:::Messages:::CreateFailure:::Create user failed. Please try again later."));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Users:::Messages:::DeleteSuccessfully:::Delete user successfully.")
                        : _localizedResourceServices.T("AdminModule:::Users:::Messages:::DeleteFailure:::Delete user failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Users:::Messages:::ObjectNotFounded:::User is not founded.")
            });
        }
Esempio n. 7
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the file template model</param>
        /// <returns></returns>
        public ResponseModel ManageFileTemplate(GridOperationEnums operation, FileTemplateModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <FileTemplateModel, FileTemplate>();
            FileTemplate fileTemplate;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                fileTemplate                = GetById(model.Id);
                fileTemplate.Name           = model.Name;
                fileTemplate.Controller     = model.Controller;
                fileTemplate.Action         = model.Action;
                fileTemplate.Parameters     = model.Parameters;
                fileTemplate.ParentId       = model.ParentName.ToNullableInt();
                fileTemplate.PageTemplateId = model.PageTemplateName.ToNullableInt();

                response = HierarchyUpdate(fileTemplate);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::UpdateSuccessfully:::Update file template successfully.")
                        : _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::UpdateFailure:::Update file template failed. Please try again later.")));

            case GridOperationEnums.Add:
                fileTemplate                = Mapper.Map <FileTemplateModel, FileTemplate>(model);
                fileTemplate.ParentId       = model.ParentName.ToNullableInt();
                fileTemplate.PageTemplateId = model.PageTemplateName.ToNullableInt();
                response = HierarchyInsert(fileTemplate);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::CreateSuccessfully:::Create file template successfully.")
                        : _localizedResourceServices.T("AdminModule:::FileTemplate:::Messagess:::CreateFailure:::Insert file template failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::DeleteSuccessfully:::Messages:::Delete file template successfully.")
                        : _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::DeleteFailure:::Delete file template failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::ObjectNotFounded:::File template is not founded.")
            });
        }
Esempio n. 8
0
        /// <summary>
        /// Manage Site HotelCustomer
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the HotelCustomer model</param>
        /// <returns></returns>
        public ResponseModel ManageHotelCustomer(GridOperationEnums operation, HotelCustomerModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <HotelCustomerModel, HotelCustomer>();
            HotelCustomer hotelCustomer;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                hotelCustomer                 = GetById(model.Id);
                hotelCustomer.FullName        = model.FullName;
                hotelCustomer.Email           = model.Email;
                hotelCustomer.IndentityNumber = model.IndentityNumber;
                hotelCustomer.Address         = model.Address;
                hotelCustomer.Country         = model.Country;
                hotelCustomer.Phone           = model.Phone;
                hotelCustomer.Note            = model.Note;

                response = Update(hotelCustomer);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::UpdateSuccessfully:::Update customer successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::UpdateFailure:::Update customer failed. Please try again later.")));

            case GridOperationEnums.Add:
                hotelCustomer = Mapper.Map <HotelCustomerModel, HotelCustomer>(model);

                response = Insert(hotelCustomer);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::CreateSuccessfully:::Create customer successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::CreateFailure:::Insert customer failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::DeleteSuccessfully:::Delete customer successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::DeleteFailure:::Delete customer failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::ObjectNotFounded:::Customer is not founded.")
            });
        }
Esempio n. 9
0
        /// <summary>
        /// Manage Rotating Images
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManageRotatingImage(GridOperationEnums operation, RotatingImageModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <RotatingImageModel, RotatingImage>();
            RotatingImage rotatingImage;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                rotatingImage             = GetById(model.Id);
                rotatingImage.ImageUrl    = model.ImageUrl;
                rotatingImage.Url         = model.Url;
                rotatingImage.GroupId     = model.GroupName.ToInt();
                rotatingImage.RecordOrder = model.RecordOrder;
                response = Update(rotatingImage);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::UpdateSuccessfully:::Update rotating image successfully.")
                        : _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::UpdateFailure:::Update rotating image failed. Please try again later.")));

            case GridOperationEnums.Add:
                rotatingImage          = Mapper.Map <RotatingImageModel, RotatingImage>(model);
                rotatingImage.ImageUrl = string.Empty;
                rotatingImage.GroupId  = model.GroupName.ToInt();

                response = Insert(rotatingImage);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::CreateSuccessfully:::Create rotating image successfully.")
                        : _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::CreateFailure:::Insert rotating image failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::DeleteSuccessfully:::Delete rotating image successfully.")
                        : _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::DeleteFailure:::Delete rotating image failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::ObjectNotFounded:::Rotating image is not founded.")
            });
        }
Esempio n. 10
0
        /// <summary>
        /// Manage banners
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManageBanner(GridOperationEnums operation, BannerModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <BannerModel, Banner>();
            Banner banner;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                banner             = GetById(model.Id);
                banner.Text        = model.Text;
                banner.Url         = model.Url;
                banner.GroupName   = model.GroupName;
                banner.RecordOrder = model.RecordOrder;
                response           = Update(banner);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Banners:::Messages:::UpdateSuccessfully:::Update banner successfully.")
                        : _localizedResourceServices.T("AdminModule:::Banners:::Messages:::UpdateFailure:::Update banner failed. Please try again later.")));

            case GridOperationEnums.Add:
                banner           = Mapper.Map <BannerModel, Banner>(model);
                banner.ImageUrl  = string.Empty;
                banner.GroupName = model.GroupName;

                response = Insert(banner);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Banners:::Messages:::CreateSuccessfully:::Create banner successfully.")
                        : _localizedResourceServices.T("AdminModule:::Banners:::Messages:::CreateFailure:::Insert banner failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Banners:::Messages:::DeleteSuccessfully:::Delete banner successfully.")
                        : _localizedResourceServices.T("AdminModule:::Banners:::Messages:::DeleteFailure:::Delete banner failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Banners:::Messages:::ObjectNotFounded:::banner is not founded.")
            });
        }
Esempio n. 11
0
        /// <summary>
        /// Manage Site HotelCustomer
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the HotelCustomer model</param>
        /// <returns></returns>
        public ResponseModel ManageHotelCustomer(GridOperationEnums operation, HotelCustomerModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<HotelCustomerModel, HotelCustomer>();
            HotelCustomer hotelCustomer;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    hotelCustomer = GetById(model.Id);
                    hotelCustomer.FullName = model.FullName;
                    hotelCustomer.Email = model.Email;
                    hotelCustomer.IndentityNumber = model.IndentityNumber;
                    hotelCustomer.Address = model.Address;
                    hotelCustomer.Country = model.Country;
                    hotelCustomer.Phone = model.Phone;
                    hotelCustomer.Note = model.Note;

                    response = Update(hotelCustomer);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::UpdateSuccessfully:::Update customer successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::UpdateFailure:::Update customer failed. Please try again later."));

                case GridOperationEnums.Add:
                    hotelCustomer = Mapper.Map<HotelCustomerModel, HotelCustomer>(model);

                    response = Insert(hotelCustomer);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::CreateSuccessfully:::Create customer successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::CreateFailure:::Insert customer failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::DeleteSuccessfully:::Delete customer successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::DeleteFailure:::Delete customer failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::HotelCustomers:::Messages:::ObjectNotFounded:::Customer is not founded.")
            };
        }
Esempio n. 12
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageService(GridOperationEnums operation, ServiceModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <ServiceModel, Service>();
            Service service;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                service              = _serviceRepository.GetById(model.Id);
                service.Title        = model.Title;
                service.Status       = model.Status;
                service.RecordOrder  = model.RecordOrder;
                service.RecordActive = model.RecordActive;
                response             = Update(service);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Services:::Messages:::UpdateSuccessfully:::Update service successfully.")
                        : _localizedResourceServices.T("AdminModule:::Services:::Messages:::UpdateFailure:::Update service failed. Please try again later.")));

            case GridOperationEnums.Add:
                service             = Mapper.Map <ServiceModel, Service>(model);
                service.Status      = model.Status;
                service.Content     = string.Empty;
                service.Description = string.Empty;
                response            = Insert(service);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Services:::Messages:::CreateSuccessfully:::Create service successfully.")
                        : _localizedResourceServices.T("AdminModule:::Services:::Messages:::CreateFailure:::Insert service failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Services:::Messages:::DeleteSuccessfully:::Delete service successfully.")
                        : _localizedResourceServices.T("AdminModule:::Services:::Messages:::DeleteFailure:::Delete service failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Services:::Messages:::ObjectNotFounded:::Service is not founded.")
            });
        }
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageRotatingImageGroup(GridOperationEnums operation, RotatingImageGroupModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <RotatingImageGroupModel, RotatingImageGroup>();
            RotatingImageGroup rotatingImageGroup;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                rotatingImageGroup              = _rotatingImageGroupRepository.GetById(model.Id);
                rotatingImageGroup.Name         = model.Name;
                rotatingImageGroup.RecordOrder  = model.RecordOrder;
                rotatingImageGroup.RecordActive = model.RecordActive;
                response = Update(rotatingImageGroup);
                return(response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::UpdateSuccessfully:::Update group successfully.")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::UpdateFailure:::Update group failed. Please try again later.")));

            case GridOperationEnums.Add:
                rotatingImageGroup          = Mapper.Map <RotatingImageGroupModel, RotatingImageGroup>(model);
                rotatingImageGroup.Settings = string.Empty;
                var groupSettingModel = new GroupSettingModel();
                rotatingImageGroup.Settings = SerializeUtilities.SerializeObject(groupSettingModel);
                response = Insert(rotatingImageGroup);
                return(response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::CreateSuccessfully:::Create group successfully")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::CreateFailure:::Insert group failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::DeleteSuccessfully:::Delete group successfully.")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::DeleteFailure:::Delete group failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::ObjectNotFounded:::Rotating Image Group is not founded.")
            });
        }
Esempio n. 14
0
        /// <summary>
        /// Manage ClientMenu
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel ManageClientMenu(GridOperationEnums operation, ClientMenuModel model)
        {
            Mapper.CreateMap <ClientMenuModel, ClientMenu>();
            ClientMenu    clientMenu;
            ResponseModel response;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                clientMenu              = GetById(model.Id);
                clientMenu.Name         = model.Name;
                clientMenu.Url          = model.Url;
                clientMenu.ParentId     = model.ParentId;
                clientMenu.RecordActive = model.RecordActive;
                clientMenu.RecordOrder  = model.RecordOrder;
                clientMenu.ParentId     = model.ParentName.ToNullableInt();
                response = HierarchyUpdate(clientMenu);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::UpdateSuccessfully:::Update client menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::UpdateFailure:::Update client menu failed. Please try again later.")));

            case GridOperationEnums.Add:
                clientMenu          = Mapper.Map <ClientMenuModel, ClientMenu>(model);
                clientMenu.ParentId = model.ParentName.ToNullableInt();
                response            = HierarchyInsert(clientMenu);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::CreateSuccessfully:::Create client menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::CreateFailure:::Create client menu failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::DeleteSuccessfully:::Delete client menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::DeleteFailure:::Delete client menu failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages::ObjectNotFounded:::Client menu is not founded.")
            });
        }
Esempio n. 15
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManageNewsCategory(GridOperationEnums operation, NewsCategoryModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <NewsCategoryModel, NewsCategory>();
            NewsCategory newsCategory;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                newsCategory             = GetById(model.Id);
                newsCategory.Name        = model.Name;
                newsCategory.ParentId    = model.ParentName.ToNullableInt();
                newsCategory.Description = model.Description;
                newsCategory.RecordOrder = model.RecordOrder;

                response = HierarchyUpdate(newsCategory);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::UpdateSuccessfully:::Update news category successfully.")
                        : _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::UpdateFailure:::Update news category failed. Please try again later.")));

            case GridOperationEnums.Add:
                newsCategory = Mapper.Map <NewsCategoryModel, NewsCategory>(model);

                response = HierarchyInsert(newsCategory);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::CreateSuccessfully:::Create news category successfully.")
                        : _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::CreateFailure:::Insert news category failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::DeleteSuccessfully:::Delete news category successfully.")
                        : _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::DeleteFailure:::Delete news category failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::ObjectNotFounded:::News category is not founded.")
            });
        }
Esempio n. 16
0
        /// <summary>
        /// Manage Site HotelBooking
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the HotelBooking model</param>
        /// <returns></returns>
        public ResponseModel ManageHotelBooking(GridOperationEnums operation, HotelBookingModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <HotelBookingModel, HotelBooking>();
            HotelBooking hotelBooking;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                hotelBooking            = GetById(model.Id);
                hotelBooking.TotalMoney = model.TotalMoney;
                hotelBooking.Note       = model.Note;
                hotelBooking.Status     = model.Status;

                response = Update(hotelBooking);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::UpdateSuccessfully:::Update booking successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::UpdateFailure:::Update booking failed. Please try again later.")));

            case GridOperationEnums.Add:
                hotelBooking        = Mapper.Map <HotelBookingModel, HotelBooking>(model);
                hotelBooking.Status = model.Status;

                response = Insert(hotelBooking);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::CreateSuccessfully:::Create booking successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::CreateFailure:::Insert booking failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::DeleteSuccessfully:::Delete booking successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::DeleteFailure:::Delete booking failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::ObjectNotFounded:::Booking is not founded.")
            });
        }
Esempio n. 17
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageTemplate(GridOperationEnums operation, TemplateModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <TemplateModel, Template>();
            Template template;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                template              = _templateRepository.GetById(model.Id);
                template.Name         = model.Name;
                template.DataType     = model.DataType;
                template.RecordOrder  = model.RecordOrder;
                template.RecordActive = model.RecordActive;
                response              = Update(template);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Templates:::Messages:::UpdateSuccessfully:::Update template successfully.")
                        : _localizedResourceServices.T("AdminModule:::Templates:::Messages:::UpdateFailure:::Update template failed. Please try again later.")));

            case GridOperationEnums.Add:
                template         = Mapper.Map <TemplateModel, Template>(model);
                template.Content = string.Empty;
                response         = Insert(template);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Templates:::Messages:::CreateSuccessfully:::Create template successfully.")
                        : _localizedResourceServices.T("AdminModule:::Templates:::Messages:::CreateFailure:::Create template failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Templates:::Messages:::DeleteSuccessfully:::Delete template successfully.")
                        : _localizedResourceServices.T("AdminModule:::Templates:::Messages:::DeleteFailure:::Delete template failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Templates:::Messages:::ObjectNotFounded:::Template is not founded.")
            });
        }
Esempio n. 18
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the page template model</param>
        /// <returns></returns>
        public ResponseModel ManagePageTemplate(GridOperationEnums operation, PageTemplateModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <PageTemplateModel, PageTemplate>();
            PageTemplate pageTemplate;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                pageTemplate          = GetById(model.Id);
                pageTemplate.Name     = model.Name;
                pageTemplate.ParentId = model.ParentName.ToNullableInt();

                response = HierarchyUpdate(pageTemplate);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::UpdateSuccessfully:::Update page template successfully.")
                        : _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::UpdateFailure:::Update page template failed. Please try again later.")));

            case GridOperationEnums.Add:
                pageTemplate          = Mapper.Map <PageTemplateModel, PageTemplate>(model);
                pageTemplate.ParentId = model.ParentName.ToNullableInt();
                pageTemplate.Content  = Configurations.CurlyBracketRenderBody;
                response = HierarchyInsert(pageTemplate);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::CreateSuccessfully:::Create page template successfully.")
                        : _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::CreateFailure:::Create page template failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::DeleteSuccessfully:::Delete page template successfully.")
                        : _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::DeleteFailure:::Delete page template failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::ObjectNotFounded:::Page template is not founded.")
            });
        }
Esempio n. 19
0
        /// <summary>
        /// Manage testimonial
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the testimonial model</param>
        /// <returns></returns>
        public ResponseModel ManageTestimonial(GridOperationEnums operation, TestimonialModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <TestimonialModel, Testimonial>();
            Testimonial testimonial;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                testimonial                   = _testimonialRepository.GetById(model.Id);
                testimonial.Author            = model.Author;
                testimonial.Content           = model.Content;
                testimonial.AuthorDescription = model.AuthorDescription;
                testimonial.RecordOrder       = model.RecordOrder;
                testimonial.RecordActive      = model.RecordActive;
                response = Update(testimonial);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::UpdateSuccessfully:::Update testimonial successfully.")
                        : _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::UpdateFailure:::Update testimonial failed. Please try again later.")));

            case GridOperationEnums.Add:
                testimonial = Mapper.Map <TestimonialModel, Testimonial>(model);
                response    = Insert(testimonial);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::CreateSuccessfully:::Create testimonial successfully.")
                        : _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::CreateFailure:::Insert testimonial failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::DeleteSuccessfully:::Delete testimonial successfully.")
                        : _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::DeleteFailure:::Delete testimonial failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::ObjectNotFounded:::Testimonial is not founded.")
            });
        }
Esempio n. 20
0
        /// <summary>
        /// Manage Site HotelService
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the HotelService model</param>
        /// <returns></returns>
        public ResponseModel ManageHotelService(GridOperationEnums operation, HotelServiceModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <HotelServiceModel, HotelService>();
            HotelService hotelService;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                hotelService             = GetById(model.Id);
                hotelService.Name        = model.Name;
                hotelService.ServiceIcon = model.ServiceIcon;
                hotelService.RecordOrder = model.RecordOrder;

                response = Update(hotelService);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::UpdateSuccessfully:::Update service successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::UpdateFailure:::Update service failed. Please try again later.")));

            case GridOperationEnums.Add:
                hotelService = Mapper.Map <HotelServiceModel, HotelService>(model);

                response = Insert(hotelService);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::CreateSuccessfully:::Create service successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::CreateFailure:::Insert service failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::DeleteSuccessfully:::Delete service successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::DeleteFailure:::Delete service failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::ObjectNotFounded:::Service is not founded.")
            });
        }
Esempio n. 21
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageUserGroup(GridOperationEnums operation, UserGroupModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <UserGroupModel, UserGroup>();
            UserGroup userGroup;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                userGroup              = _userGroupRepository.GetById(model.Id);
                userGroup.Name         = model.Name;
                userGroup.Description  = model.Description;
                userGroup.RecordOrder  = model.RecordOrder;
                userGroup.RecordActive = model.RecordActive;
                response = Update(userGroup);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::UpdateSuccessfully:::Update user group successfully.")
                        : _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::UpdateFailure:::Update user group failed. Please try again later.")));

            case GridOperationEnums.Add:
                userGroup = Mapper.Map <UserGroupModel, UserGroup>(model);
                response  = Insert(userGroup);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::CreateSuccessfully:::Craete user group successfully.")
                        : _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::CreateFailure:::Create user group failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::DeleteSuccessfully:::Delete user group successfully.")
                        : _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::DeleteFailure:::Delete user group failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::ObjectNotFounded:::User group is not founded.")
            });
        }
Esempio n. 22
0
        /// <summary>
        /// Manage Language
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel ManageLanguage(GridOperationEnums operation, LanguageModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <LanguageModel, Language>();
            Language language;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                language              = GetById(model.Id);
                language.Name         = model.Name;
                language.ShortName    = model.ShortName;
                language.RecordActive = model.RecordActive;
                language.RecordOrder  = model.RecordOrder;
                response              = Update(language);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Languages:::Messages::UpdateSuccessfully:::Update language successfully.")
                        : _localizedResourceServices.T("AdminModule:::Languages:::Messages:::UpdateFailure:::Update language failed. Please try again later.")));

            case GridOperationEnums.Add:
                language = Mapper.Map <LanguageModel, Language>(model);
                response = Insert(language);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Languages:::Messages:::CreateSuccessfully:::Create language successfully.")
                        : _localizedResourceServices.T("AdminModule:::Languages:::Messages:::CreateFailure:::Create language failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Languages:::Messages:::DeleteSuccessfully:::Delete language successfully.")
                        : _localizedResourceServices.T("AdminModule:::Languages:::Messages:::DeleteFailure:::Delete language failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Languages:::Messages:::ObjectNotFounded:::Language is not founded.")
            });
        }
Esempio n. 23
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageSQLCommandHistory(GridOperationEnums operation, SQLCommandHistoryModel model)
        {
            ResponseModel response;

            AutoMapper.Mapper.CreateMap <SQLCommandHistoryModel, SQLCommandHistory>();
            SQLCommandHistory sqlCommandHistory;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                sqlCommandHistory              = _sqlCommandHistoryRepository.GetById(model.Id);
                sqlCommandHistory.Query        = model.Query;
                sqlCommandHistory.RecordOrder  = model.RecordOrder;
                sqlCommandHistory.RecordActive = model.RecordActive;
                response = Update(sqlCommandHistory);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::UpdateSuccessfully:::Update command successfully.")
                        : _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::UpdateFailure:::Update command failed. Please try again later.")));

            case GridOperationEnums.Add:
                sqlCommandHistory = AutoMapper.Mapper.Map <SQLCommandHistoryModel, SQLCommandHistory>(model);
                response          = Insert(sqlCommandHistory);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::CreateSuccessfully:::Create command successfully.")
                        : _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::CreateFailure:::Create command failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::DeleteSuccessfully:::Delete command successfully.")
                        : _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::DeleteFailure:::Delete command failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::ObjectNotFounded:::Command is not founded.")
            });
        }
Esempio n. 24
0
        /// <summary>
        /// Manage tag
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the tag model</param>
        /// <returns></returns>
        public ResponseModel ManageTag(GridOperationEnums operation, TagModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <TagModel, Tag>();
            Tag tag;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                tag              = _tagRepository.GetById(model.Id);
                tag.Name         = model.Name;
                tag.RecordOrder  = model.RecordOrder;
                tag.RecordActive = model.RecordActive;
                response         = Update(tag);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Tags:::Messages:::UpdateSuccessfully:::Update tag successfully.")
                        : _localizedResourceServices.T("AdminModule:::Tags:::Messages:::UpdateNotFounded:::Update tag failed. Please try again later.")));

            case GridOperationEnums.Add:
                tag      = Mapper.Map <TagModel, Tag>(model);
                response = Insert(tag);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Tags:::Messages:::CreateSuccessfully:::Insert tag successfully.")
                        : _localizedResourceServices.T("AdminModule:::Tags:::Messages:::CreateFailure:::Insert tag failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::Tags:::Messages:::DeleteSuccessfully:::Delete tag successfully.")
                        : _localizedResourceServices.T("AdminModule:::Tags:::Messages:::DeleteFailure:::Delete tag failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Tags:::Messages:::ObjectNotFound:::Tag not is founded")
            });
        }
Esempio n. 25
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageSettingType(GridOperationEnums operation, SettingTypeModel model)
        {
            ResponseModel response;

            Mapper.CreateMap <SettingTypeModel, SettingType>();
            SettingType settingType;

            switch (operation)
            {
            case GridOperationEnums.Edit:
                settingType             = _settingTypeRepository.GetById(model.Id);
                settingType.Name        = model.Name;
                settingType.RecordOrder = model.RecordOrder;
                response = Update(settingType);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::UpdateSuccessfully:::Update setting type successfully.")
                        : _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::UpdateFailure:::Update setting type failed. Please try again later.")));

            case GridOperationEnums.Add:
                settingType = Mapper.Map <SettingTypeModel, SettingType>(model);
                response    = Insert(settingType);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::CreateSuccessfully:::Create setting type successfully.")
                        : _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::CreateFailure:::Create setting type failed. Please try again later.")));

            case GridOperationEnums.Del:
                response = Delete(model.Id);
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::DeleteSuccessfully:::Delete setting type successfully.")
                        : _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::DeleteFailure:::Delete setting type failed. Please try again later.")));
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::ObjectNotFounded:::Setting type is not founded.")
            });
        }
Esempio n. 26
0
        /// <summary>
        /// Manage Language
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel ManageLanguage(GridOperationEnums operation, LanguageModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<LanguageModel, Language>();
            Language language;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    language = GetById(model.Id);
                    language.Name = model.Name;
                    language.ShortName = model.ShortName;
                    language.RecordActive = model.RecordActive;
                    language.RecordOrder = model.RecordOrder;
                    response = Update(language);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Languages:::Messages::UpdateSuccessfully:::Update language successfully.")
                        : _localizedResourceServices.T("AdminModule:::Languages:::Messages:::UpdateFailure:::Update language failed. Please try again later."));

                case GridOperationEnums.Add:
                    language = Mapper.Map<LanguageModel, Language>(model);
                    response = Insert(language);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Languages:::Messages:::CreateSuccessfully:::Create language successfully.")
                        : _localizedResourceServices.T("AdminModule:::Languages:::Messages:::CreateFailure:::Create language failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Languages:::Messages:::DeleteSuccessfully:::Delete language successfully.")
                        : _localizedResourceServices.T("AdminModule:::Languages:::Messages:::DeleteFailure:::Delete language failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Languages:::Messages:::ObjectNotFounded:::Language is not founded.")
            };
        }
Esempio n. 27
0
        /// <summary>
        /// Manage tag
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the tag model</param>
        /// <returns></returns>
        public ResponseModel ManageTag(GridOperationEnums operation, TagModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<TagModel, Tag>();
            Tag tag;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    tag = _tagRepository.GetById(model.Id);
                    tag.Name = model.Name;
                    tag.RecordOrder = model.RecordOrder;
                    tag.RecordActive = model.RecordActive;
                    response = Update(tag);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Tags:::Messages:::UpdateSuccessfully:::Update tag successfully.")
                        : _localizedResourceServices.T("AdminModule:::Tags:::Messages:::UpdateNotFounded:::Update tag failed. Please try again later."));

                case GridOperationEnums.Add:
                    tag = Mapper.Map<TagModel, Tag>(model);
                    response = Insert(tag);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Tags:::Messages:::CreateSuccessfully:::Insert tag successfully.")
                        : _localizedResourceServices.T("AdminModule:::Tags:::Messages:::CreateFailure:::Insert tag failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Tags:::Messages:::DeleteSuccessfully:::Delete tag successfully.")
                        : _localizedResourceServices.T("AdminModule:::Tags:::Messages:::DeleteFailure:::Delete tag failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Tags:::Messages:::ObjectNotFound:::Tag not is founded")
            };
        }
Esempio n. 28
0
        /// <summary>
        /// Manage user
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user model</param>
        /// <returns></returns>
        public ResponseModel ManageUser(GridOperationEnums operation, UserModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<UserModel, User>();
            User user;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    user = GetById(model.Id);
                    user.FirstName = model.FirstName;
                    user.LastName = model.LastName;
                    user.Phone = model.Phone;
                    user.Status = model.Status;

                    user.IdentityNumber = model.IdentityNumber;
                    user.RecordActive = model.RecordActive;
                    user.RecordOrder = 0;
                    response = Update(user);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Users:::Messages:::UpdateSuccessfully:::Update user successfully.")
                        : _localizedResourceServices.T("AdminModule:::Users:::Messages:::UpdateFailure:::Update user failed. Please try again later."));

                //case GridOperationEnums.Add:
                //    user = Mapper.Map<UserModel, User>(model);
                //    user.Status = model.Status;

                //    user.RecordOrder = 0;
                //    response = Insert(user);
                //    return response.SetMessage(response.Success ?
                //        _localizedResourceServices.T("AdminModule:::Users:::Messages:::CreateSuccessfully:::Create user successfully.")
                //        : _localizedResourceServices.T("AdminModule:::Users:::Messages:::CreateFailure:::Create user failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Users:::Messages:::DeleteSuccessfully:::Delete user successfully.")
                        : _localizedResourceServices.T("AdminModule:::Users:::Messages:::DeleteFailure:::Delete user failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Users:::Messages:::ObjectNotFounded:::User is not founded.")
            };
        }
Esempio n. 29
0
        /// <summary>
        /// Manage Site HotelService
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the HotelService model</param>
        /// <returns></returns>
        public ResponseModel ManageHotelService(GridOperationEnums operation, HotelServiceModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<HotelServiceModel, HotelService>();
            HotelService hotelService;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    hotelService = GetById(model.Id);
                    hotelService.Name = model.Name;
                    hotelService.ServiceIcon = model.ServiceIcon;
                    hotelService.RecordOrder = model.RecordOrder;

                    response = Update(hotelService);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::UpdateSuccessfully:::Update service successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::UpdateFailure:::Update service failed. Please try again later."));

                case GridOperationEnums.Add:
                    hotelService = Mapper.Map<HotelServiceModel, HotelService>(model);

                    response = Insert(hotelService);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::CreateSuccessfully:::Create service successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::CreateFailure:::Insert service failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::DeleteSuccessfully:::Delete service successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::DeleteFailure:::Delete service failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::HotelServices:::Messages:::ObjectNotFounded:::Service is not founded.")
            };
        }
Esempio n. 30
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the page template model</param>
        /// <returns></returns>
        public ResponseModel ManagePageTemplate(GridOperationEnums operation, PageTemplateModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<PageTemplateModel, PageTemplate>();
            PageTemplate pageTemplate;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    pageTemplate = GetById(model.Id);
                    pageTemplate.Name = model.Name;
                    pageTemplate.ParentId = model.ParentName.ToNullableInt();

                    response = HierarchyUpdate(pageTemplate);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::UpdateSuccessfully:::Update page template successfully.")
                        : _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::UpdateFailure:::Update page template failed. Please try again later."));

                case GridOperationEnums.Add:
                    pageTemplate = Mapper.Map<PageTemplateModel, PageTemplate>(model);
                    pageTemplate.ParentId = model.ParentName.ToNullableInt();
                    pageTemplate.Content = Configurations.CurlyBracketRenderBody;
                    response = HierarchyInsert(pageTemplate);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::CreateSuccessfully:::Create page template successfully.")
                        : _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::CreateFailure:::Create page template failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::DeleteSuccessfully:::Delete page template successfully.")
                        : _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::DeleteFailure:::Delete page template failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::ObjectNotFounded:::Page template is not founded.")
            };
        }
Esempio n. 31
0
        /// <summary>
        /// Manage Menu
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel ManageMenu(GridOperationEnums operation, MenuModel model)
        {
            Mapper.CreateMap<MenuModel, Menu>();
            Menu menu;
            ResponseModel response;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    menu = GetById(model.Id);
                    menu.Name = model.Name;
                    menu.Url = model.Url;
                    var hasUpdatePermission = !(model.Controller == menu.Controller && model.Action == menu.Action);
                    menu.Controller = model.Controller;
                    menu.Action = model.Action;
                    menu.ParentId = model.ParentId;
                    menu.MenuIcon = model.MenuIcon;
                    menu.Visible = model.Visible;
                    menu.RecordActive = model.RecordActive;
                    menu.RecordOrder = model.RecordOrder;
                    menu.ParentId = model.ParentName.ToNullableInt();
                    response = HierarchyUpdate(menu);
                    if (hasUpdatePermission) UpdateMenuPermission(menu);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Menus:::Messages:::UpdateSuccessfully:::Update menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::Menus:::UpdateFailure:::Update menu failed. Please try again later."));

                case GridOperationEnums.Add:
                    menu = Mapper.Map<MenuModel, Menu>(model);
                    menu.ParentId = model.ParentName.ToNullableInt();
                    response = HierarchyInsert(menu);
                    UpdateMenuPermission(menu);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Menus:::Messages:::CreateSuccessfully:::Create menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::Menus:::Messages:::CreateFailure:::Create menu failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Menus:::Messages:::DeleteSuccessfully:::Delete menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::Menus:::Messages:::DeleteFailure:::Delete menu failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Menus:::Messages:::ObjectNotFounded:::Menu is not founded.")
            };
        }
Esempio n. 32
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageSettingType(GridOperationEnums operation, SettingTypeModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<SettingTypeModel, SettingType>();
            SettingType settingType;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    settingType = _settingTypeRepository.GetById(model.Id);
                    settingType.Name = model.Name;
                    settingType.RecordOrder = model.RecordOrder;
                    response = Update(settingType);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::UpdateSuccessfully:::Update setting type successfully.")
                        : _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::UpdateFailure:::Update setting type failed. Please try again later."));

                case GridOperationEnums.Add:
                    settingType = Mapper.Map<SettingTypeModel, SettingType>(model);
                    response = Insert(settingType);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::CreateSuccessfully:::Create setting type successfully.")
                        : _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::CreateFailure:::Create setting type failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::DeleteSuccessfully:::Delete setting type successfully.")
                        : _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::DeleteFailure:::Delete setting type failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::SettingTypes:::Messages:::ObjectNotFounded:::Setting type is not founded.")
            };
        }
Esempio n. 33
0
        /// <summary>
        /// Manage testimonial
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the testimonial model</param>
        /// <returns></returns>
        public ResponseModel ManageTestimonial(GridOperationEnums operation, TestimonialModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<TestimonialModel, Testimonial>();
            Testimonial testimonial;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    testimonial = _testimonialRepository.GetById(model.Id);
                    testimonial.Author = model.Author;
                    testimonial.Content = model.Content;
                    testimonial.AuthorDescription = model.AuthorDescription;
                    testimonial.RecordOrder = model.RecordOrder;
                    testimonial.RecordActive = model.RecordActive;
                    response = Update(testimonial);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::UpdateSuccessfully:::Update testimonial successfully.")
                        : _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::UpdateFailure:::Update testimonial failed. Please try again later."));

                case GridOperationEnums.Add:
                    testimonial = Mapper.Map<TestimonialModel, Testimonial>(model);
                    response = Insert(testimonial);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::CreateSuccessfully:::Create testimonial successfully.")
                        : _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::CreateFailure:::Insert testimonial failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::DeleteSuccessfully:::Delete testimonial successfully.")
                        : _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::DeleteFailure:::Delete testimonial failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Testimonials:::Messages:::ObjectNotFounded:::Testimonial is not founded.")
            };
        }
Esempio n. 34
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManagePage(GridOperationEnums operation, PageModel model)
        {
            ResponseModel response;
            Page page;
            Mapper.CreateMap<PageModel, Page>();
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    page = GetById(model.Id);
                    page.Title = model.Title;
                    page.Status = model.Status;
                    page.FriendlyUrl = string.IsNullOrWhiteSpace(model.FriendlyUrl)
                                           ? model.Title.ToUrlString()
                                           : model.FriendlyUrl.ToUrlString();
                    page.ParentId = model.ParentName.ToNullableInt();

                    response = HierarchyUpdate(page);

                    _clientMenuServices.SavePageToClientMenu(page.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Pages:::Messages:::UpdateSuccessfully:::Update page successfully.")
                        : _localizedResourceServices.T("AdminModule:::Pages:::Messages:::UpdateFailure:::Update page failed. Please try again later.. Please try again later."));

                case GridOperationEnums.Del:
                    page = GetById(model.Id);
                    if (page != null)
                    {
                        if (page.Pages1.Any())
                        {
                            return new ResponseModel
                            {
                                Success = false,
                                Message = _localizedResourceServices.T("AdminModule:::Pages:::Messages:::DeleteReferenceFailure:::Delete is disabled for this page as there are child pages. Please delete child pages first.")
                            };
                        }
                        _clientMenuRepository.Delete(page.ClientMenus.First().Id);

                        response = Delete(model.Id);
                        return response.SetMessage(response.Success ?
                            _localizedResourceServices.T("AdminModule:::Pages:::Messages:::DeleteSuccessfully:::Delete page successfully.")
                            : _localizedResourceServices.T("AdminModule:::Pages:::Messages:::DeleteFailure:::Delete page failed. Please try again later."));
                    }
                    break;
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Pages:::Messages:::ObjectNotFounded:::Page is not founded.")
            };
        }
Esempio n. 35
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageTemplate(GridOperationEnums operation, TemplateModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<TemplateModel, Template>();
            Template template;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    template = _templateRepository.GetById(model.Id);
                    template.Name = model.Name;
                    template.DataType = model.DataType;
                    template.RecordOrder = model.RecordOrder;
                    template.RecordActive = model.RecordActive;
                    response = Update(template);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Templates:::Messages:::UpdateSuccessfully:::Update template successfully.")
                        : _localizedResourceServices.T("AdminModule:::Templates:::Messages:::UpdateFailure:::Update template failed. Please try again later."));

                case GridOperationEnums.Add:
                    template = Mapper.Map<TemplateModel, Template>(model);
                    template.Content = string.Empty;
                    response = Insert(template);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Templates:::Messages:::CreateSuccessfully:::Create template successfully.")
                        : _localizedResourceServices.T("AdminModule:::Templates:::Messages:::CreateFailure:::Create template failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Templates:::Messages:::DeleteSuccessfully:::Delete template successfully.")
                        : _localizedResourceServices.T("AdminModule:::Templates:::Messages:::DeleteFailure:::Delete template failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Templates:::Messages:::ObjectNotFounded:::Template is not founded.")
            };
        }
Esempio n. 36
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the file template model</param>
        /// <returns></returns>
        public ResponseModel ManageFileTemplate(GridOperationEnums operation, FileTemplateModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<FileTemplateModel, FileTemplate>();
            FileTemplate fileTemplate;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    fileTemplate = GetById(model.Id);
                    fileTemplate.Name = model.Name;
                    fileTemplate.Controller = model.Controller;
                    fileTemplate.Action = model.Action;
                    fileTemplate.Parameters = model.Parameters;
                    fileTemplate.ParentId = model.ParentName.ToNullableInt();
                    fileTemplate.PageTemplateId = model.PageTemplateName.ToNullableInt();

                    response = HierarchyUpdate(fileTemplate);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::UpdateSuccessfully:::Update file template successfully.")
                        : _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::UpdateFailure:::Update file template failed. Please try again later."));

                case GridOperationEnums.Add:
                    fileTemplate = Mapper.Map<FileTemplateModel, FileTemplate>(model);
                    fileTemplate.ParentId = model.ParentName.ToNullableInt();
                    fileTemplate.PageTemplateId = model.PageTemplateName.ToNullableInt();
                    response = HierarchyInsert(fileTemplate);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::CreateSuccessfully:::Create file template successfully.")
                        : _localizedResourceServices.T("AdminModule:::FileTemplate:::Messagess:::CreateFailure:::Insert file template failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::DeleteSuccessfully:::Messages:::Delete file template successfully.")
                        : _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::DeleteFailure:::Delete file template failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::FileTemplates:::Messages:::ObjectNotFounded:::File template is not founded.")
            };
        }
Esempio n. 37
0
        /// <summary>
        /// Manage LocalizedResource
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel ManageLocalizedResource(GridOperationEnums operation, LocalizedResourceModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<LocalizedResourceModel, LocalizedResource>();
            LocalizedResource localizedResource;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    localizedResource = GetById(model.Id);
                    localizedResource.TranslatedValue = model.TranslatedValue;
                    localizedResource.RecordActive = model.RecordActive;

                    response = Update(localizedResource);
                    if (response.Success)
                        RefreshDictionary();
                    return response.SetMessage(response.Success ?
                        T("AdminModule:::LocalizedResources:::Messages:::UpdateSuccessfully:::Update localized resource successfully.")
                        : T("AdminModule:::LocalizedResources:::Messages:::UpdateFailure:::Update localized resource failed. Please try again later."));

                case GridOperationEnums.Add:
                    localizedResource = Mapper.Map<LocalizedResourceModel, LocalizedResource>(model);
                    localizedResource.DefaultValue = model.TranslatedValue;
                    response = Insert(localizedResource);
                    if (response.Success)
                        RefreshDictionary();
                    return response.SetMessage(response.Success ?
                        T("AdminModule:::LocalizedResources:::Messages:::CreateSuccessfully:::Create localized resource successfully.")
                        : T("AdminModule:::LocalizedResources:::Messages:::CreateFailure:::Create localized resource failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    if (response.Success)
                        RefreshDictionary();
                    return response.SetMessage(response.Success ?
                        T("AdminModule:::LocalizedResources:::Messages:::DeleteSuccessfully:::Delete localized resource successfully.")
                        : T("AdminModule:::LocalizedResources:::Messages:::DeleteFailure:::Delete localized resource failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = T("AdminModule:::LocalizedResources:::Messages:::ObjectNotFounded:::Localized resource is not founded.")
            };
        }
Esempio n. 38
0
        /// <summary>
        /// Manage Site HotelBooking
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the HotelBooking model</param>
        /// <returns></returns>
        public ResponseModel ManageHotelBooking(GridOperationEnums operation, HotelBookingModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<HotelBookingModel, HotelBooking>();
            HotelBooking hotelBooking;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    hotelBooking = GetById(model.Id);
                    hotelBooking.TotalMoney = model.TotalMoney;
                    hotelBooking.Note = model.Note;
                    hotelBooking.Status = model.Status;

                    response = Update(hotelBooking);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::UpdateSuccessfully:::Update booking successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::UpdateFailure:::Update booking failed. Please try again later."));

                case GridOperationEnums.Add:
                    hotelBooking = Mapper.Map<HotelBookingModel, HotelBooking>(model);
                    hotelBooking.Status = model.Status;

                    response = Insert(hotelBooking);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::CreateSuccessfully:::Create booking successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::CreateFailure:::Insert booking failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::DeleteSuccessfully:::Delete booking successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::DeleteFailure:::Delete booking failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::HotelBookings:::Messages:::ObjectNotFounded:::Booking is not founded.")
            };
        }
Esempio n. 39
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageNews(GridOperationEnums operation, NewsModel model)
        {
            IEnumerable <int> categoryIds;
            ResponseModel     response;

            Mapper.CreateMap <NewsModel, EntityModel.News>();
            EntityModel.News news;
            switch (operation)
            {
            case GridOperationEnums.Edit:
                news           = _newsRepository.GetById(model.Id);
                news.Title     = model.Title;
                news.Status    = model.Status;
                news.IsHotNews = model.IsHotNews;
                response       = Update(news);
                categoryIds    = model.Categories.Split(',').Select(int.Parse).ToList();
                var currentCategories = news.NewsNewsCategories.Select(nc => nc.Id).ToList();
                foreach (var id in currentCategories)
                {
                    if (!categoryIds.Contains(id))
                    {
                        _newsNewsCategoryRepository.Delete(id);
                    }
                }
                foreach (var categoryId in categoryIds)
                {
                    if (currentCategories.All(n => n != categoryId))
                    {
                        var newsNewsCategory = new NewsNewsCategory
                        {
                            NewsId         = news.Id,
                            NewsCategoryId = categoryId
                        };
                        _newsNewsCategoryRepository.Insert(newsNewsCategory);
                    }
                }
                return(response.SetMessage(response.Success ?
                                           _localizedResourceServices.T("AdminModule:::News:::Messages:::UpdateSuccessfully:::Update news successfully.")
                        : _localizedResourceServices.T("AdminModule:::News:::Messages:::UpdateFailure:::Update news failed. Please try again later.")));

            //case GridOperationEnums.Add:
            //    news = Mapper.Map<NewsModel, EntityModel.News>(model);
            //    categoryIds = model.Categories.Split(',').Select(int.Parse);
            //    news.Status = model.Status;
            //    news.Content = string.Empty;
            //    news.Description = string.Empty;
            //    news.Updated = DateTime.Now;
            //    news.UpdatedBy = WorkContext.CurrentUser.Email;
            //    response = Insert(news);
            //    foreach (var categoryId in categoryIds)
            //    {
            //        var newsNewsCategory = new NewsNewsCategory
            //            {
            //                NewsId = news.Id,
            //                NewsCategoryId = categoryId
            //            };
            //        _newsNewsCategoryRepository.Insert(newsNewsCategory);
            //    }
            //    return response.SetMessage(response.Success ?
            //        _localizedResourceServices.T("AdminModule:::News:::Messages:::CreateSuccessfully:::Create news successfully.")
            //        : _localizedResourceServices.T("AdminModule:::News:::Messages:::CreateFailure:::Insert news failed. Please try again later."));

            case GridOperationEnums.Del:
                news = _newsRepository.GetById(model.Id);
                if (news != null)
                {
                    foreach (var currentCategory in news.NewsNewsCategories)
                    {
                        _newsNewsCategoryRepository.Delete(currentCategory);
                    }
                    response = Delete(model.Id);
                    return(response.SetMessage(response.Success ?
                                               _localizedResourceServices.T("AdminModule:::News:::Messages:::DeleteSuccessfully:::Delete news successfully.")
                            : _localizedResourceServices.T("AdminModule:::News:::Messages:::DeleteFailure:::Delete news failed. Please try again later.")));
                }
                break;
            }
            return(new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::News:::Messages:::ObjectNotFounded:::News is not founded.")
            });
        }
Esempio n. 40
0
        /// <summary>
        /// Manage ClientMenu
        /// </summary>
        /// <param name="operation"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResponseModel ManageClientMenu(GridOperationEnums operation, ClientMenuModel model)
        {
            Mapper.CreateMap<ClientMenuModel, ClientMenu>();
            ClientMenu clientMenu;
            ResponseModel response;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    clientMenu = GetById(model.Id);
                    clientMenu.Name = model.Name;
                    clientMenu.Url = model.Url;
                    clientMenu.ParentId = model.ParentId;
                    clientMenu.RecordActive = model.RecordActive;
                    clientMenu.RecordOrder = model.RecordOrder;
                    clientMenu.ParentId = model.ParentName.ToNullableInt();
                    response = HierarchyUpdate(clientMenu);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::UpdateSuccessfully:::Update client menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::UpdateFailure:::Update client menu failed. Please try again later."));

                case GridOperationEnums.Add:
                    clientMenu = Mapper.Map<ClientMenuModel, ClientMenu>(model);
                    clientMenu.ParentId = model.ParentName.ToNullableInt();
                    response = HierarchyInsert(clientMenu);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::CreateSuccessfully:::Create client menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::CreateFailure:::Create client menu failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::DeleteSuccessfully:::Delete client menu successfully.")
                        : _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages:::DeleteFailure:::Delete client menu failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::ClientMenus:::Messages::ObjectNotFounded:::Client menu is not founded.")
            };
        }
Esempio n. 41
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageUserGroup(GridOperationEnums operation, UserGroupModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<UserGroupModel, UserGroup>();
            UserGroup userGroup;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    userGroup = _userGroupRepository.GetById(model.Id);
                    userGroup.Name = model.Name;
                    userGroup.Description = model.Description;
                    userGroup.RecordOrder = model.RecordOrder;
                    userGroup.RecordActive = model.RecordActive;
                    response = Update(userGroup);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::UpdateSuccessfully:::Update user group successfully.")
                        : _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::UpdateFailure:::Update user group failed. Please try again later."));

                case GridOperationEnums.Add:
                    userGroup = Mapper.Map<UserGroupModel, UserGroup>(model);
                    response = Insert(userGroup);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::CreateSuccessfully:::Craete user group successfully.")
                        : _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::CreateFailure:::Create user group failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::DeleteSuccessfully:::Delete user group successfully.")
                        : _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::DeleteFailure:::Delete user group failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::UserGroups:::Messages:::ObjectNotFounded:::User group is not founded.")
            };
        }
Esempio n. 42
0
        /// <summary>
        /// Manage Site Setting
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManageNewsCategory(GridOperationEnums operation, NewsCategoryModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<NewsCategoryModel, NewsCategory>();
            NewsCategory newsCategory;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    newsCategory = GetById(model.Id);
                    newsCategory.Name = model.Name;
                    newsCategory.ParentId = model.ParentName.ToNullableInt();
                    newsCategory.Description = model.Description;
                    newsCategory.RecordOrder = model.RecordOrder;

                    response = HierarchyUpdate(newsCategory);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::UpdateSuccessfully:::Update news category successfully.")
                        : _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::UpdateFailure:::Update news category failed. Please try again later."));

                case GridOperationEnums.Add:
                    newsCategory = Mapper.Map<NewsCategoryModel, NewsCategory>(model);

                    response = HierarchyInsert(newsCategory);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::CreateSuccessfully:::Create news category successfully.")
                        : _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::CreateFailure:::Insert news category failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::DeleteSuccessfully:::Delete news category successfully.")
                        : _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::DeleteFailure:::Delete news category failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::NewsCategories:::Messages:::ObjectNotFounded:::News category is not founded.")
            };
        }
Esempio n. 43
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageSQLCommandHistory(GridOperationEnums operation, SQLCommandHistoryModel model)
        {
            ResponseModel response;
            AutoMapper.Mapper.CreateMap<SQLCommandHistoryModel, SQLCommandHistory>();
            SQLCommandHistory sqlCommandHistory;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    sqlCommandHistory = _sqlCommandHistoryRepository.GetById(model.Id);
                    sqlCommandHistory.Query = model.Query;
                    sqlCommandHistory.RecordOrder = model.RecordOrder;
                    sqlCommandHistory.RecordActive = model.RecordActive;
                    response = Update(sqlCommandHistory);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::UpdateSuccessfully:::Update command successfully.")
                        : _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::UpdateFailure:::Update command failed. Please try again later."));

                case GridOperationEnums.Add:
                    sqlCommandHistory = AutoMapper.Mapper.Map<SQLCommandHistoryModel, SQLCommandHistory>(model);
                    response = Insert(sqlCommandHistory);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::CreateSuccessfully:::Create command successfully.")
                        : _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::CreateFailure:::Create command failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::DeleteSuccessfully:::Delete command successfully.")
                        : _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::DeleteFailure:::Delete command failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::SQLCommandHistorys:::Messages:::ObjectNotFounded:::Command is not founded.")
            };
        }
Esempio n. 44
0
        /// <summary>
        /// Manage banners
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManageBanner(GridOperationEnums operation, BannerModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<BannerModel, Banner>();
            Banner banner;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    banner = GetById(model.Id);
                    banner.Text = model.Text;
                    banner.Url = model.Url;
                    banner.GroupName = model.GroupName;
                    banner.RecordOrder = model.RecordOrder;
                    response = Update(banner);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Banners:::Messages:::UpdateSuccessfully:::Update banner successfully.")
                        : _localizedResourceServices.T("AdminModule:::Banners:::Messages:::UpdateFailure:::Update banner failed. Please try again later."));

                case GridOperationEnums.Add:
                    banner = Mapper.Map<BannerModel, Banner>(model);
                    banner.ImageUrl = string.Empty;
                    banner.GroupName = model.GroupName;

                    response = Insert(banner);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Banners:::Messages:::CreateSuccessfully:::Create banner successfully.")
                        : _localizedResourceServices.T("AdminModule:::Banners:::Messages:::CreateFailure:::Insert banner failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Banners:::Messages:::DeleteSuccessfully:::Delete banner successfully.")
                        : _localizedResourceServices.T("AdminModule:::Banners:::Messages:::DeleteFailure:::Delete banner failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Banners:::Messages:::ObjectNotFounded:::banner is not founded.")
            };
        }
Esempio n. 45
0
        /// <summary>
        /// Manage Site HotelRoom
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the HotelRoom model</param>
        /// <returns></returns>
        public ResponseModel ManageHotelRoom(GridOperationEnums operation, HotelRoomModel model)
        {
            int hotelRoomTypeId;
            ResponseModel response;
            Mapper.CreateMap<HotelRoomModel, HotelRoom>();
            HotelRoom hotelRoom;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    hotelRoom = GetById(model.Id);
                    hotelRoom.Name = model.Name;
                    hotelRoom.Note = model.Note;
                    hotelRoom.Status = model.Status;
                    if (int.TryParse(model.HotelRoomTypeName, out hotelRoomTypeId))
                    {
                        hotelRoom.HotelRoomTypeId = hotelRoomTypeId;
                    }

                    response = Update(hotelRoom);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::UpdateSuccessfully:::Update room successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::UpdateFailure:::Update room failed. Please try again later."));

                case GridOperationEnums.Add:
                    hotelRoom = Mapper.Map<HotelRoomModel, HotelRoom>(model);
                    hotelRoom.Status = model.Status;
                    if (int.TryParse(model.HotelRoomTypeName, out hotelRoomTypeId))
                    {
                        hotelRoom.HotelRoomTypeId = hotelRoomTypeId;
                    }

                    response = Insert(hotelRoom);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::CreateSuccessfully:::Create room successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::CreateFailure:::Insert room failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::DeleteSuccessfully:::Delete room successfully.")
                        : _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::DeleteFailure:::Delete room failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::HotelRooms:::Messages:::ObjectNotFounded:::Room is not founded.")
            };
        }
Esempio n. 46
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageNews(GridOperationEnums operation, NewsModel model)
        {
            IEnumerable<int> categoryIds;
            ResponseModel response;
            Mapper.CreateMap<NewsModel, EntityModel.News>();
            EntityModel.News news;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    news = _newsRepository.GetById(model.Id);
                    news.Title = model.Title;
                    news.Status = model.Status;
                    news.IsHotNews = model.IsHotNews;
                    response = Update(news);
                    categoryIds = model.Categories.Split(',').Select(int.Parse).ToList();
                    var currentCategories = news.NewsNewsCategories.Select(nc => nc.Id).ToList();
                    foreach (var id in currentCategories)
                    {
                        if (!categoryIds.Contains(id))
                        {
                            _newsNewsCategoryRepository.Delete(id);
                        }
                    }
                    foreach (var categoryId in categoryIds)
                    {
                        if (currentCategories.All(n => n != categoryId))
                        {
                            var newsNewsCategory = new NewsNewsCategory
                            {
                                NewsId = news.Id,
                                NewsCategoryId = categoryId
                            };
                            _newsNewsCategoryRepository.Insert(newsNewsCategory);
                        }
                    }
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::News:::Messages:::UpdateSuccessfully:::Update news successfully.")
                        : _localizedResourceServices.T("AdminModule:::News:::Messages:::UpdateFailure:::Update news failed. Please try again later."));

                //case GridOperationEnums.Add:
                //    news = Mapper.Map<NewsModel, EntityModel.News>(model);
                //    categoryIds = model.Categories.Split(',').Select(int.Parse);
                //    news.Status = model.Status;
                //    news.Content = string.Empty;
                //    news.Description = string.Empty;
                //    news.Updated = DateTime.Now;
                //    news.UpdatedBy = WorkContext.CurrentUser.Email;
                //    response = Insert(news);
                //    foreach (var categoryId in categoryIds)
                //    {
                //        var newsNewsCategory = new NewsNewsCategory
                //            {
                //                NewsId = news.Id,
                //                NewsCategoryId = categoryId
                //            };
                //        _newsNewsCategoryRepository.Insert(newsNewsCategory);
                //    }
                //    return response.SetMessage(response.Success ?
                //        _localizedResourceServices.T("AdminModule:::News:::Messages:::CreateSuccessfully:::Create news successfully.")
                //        : _localizedResourceServices.T("AdminModule:::News:::Messages:::CreateFailure:::Insert news failed. Please try again later."));

                case GridOperationEnums.Del:
                    news = _newsRepository.GetById(model.Id);
                    if (news != null)
                    {
                        foreach (var currentCategory in news.NewsNewsCategories)
                        {
                            _newsNewsCategoryRepository.Delete(currentCategory);
                        }
                        response = Delete(model.Id);
                        return response.SetMessage(response.Success ?
                            _localizedResourceServices.T("AdminModule:::News:::Messages:::DeleteSuccessfully:::Delete news successfully.")
                            : _localizedResourceServices.T("AdminModule:::News:::Messages:::DeleteFailure:::Delete news failed. Please try again later."));

                    }
                    break;
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::News:::Messages:::ObjectNotFounded:::News is not founded.")
            };
        }
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageRotatingImageGroup(GridOperationEnums operation, RotatingImageGroupModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<RotatingImageGroupModel, RotatingImageGroup>();
            RotatingImageGroup rotatingImageGroup;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    rotatingImageGroup = _rotatingImageGroupRepository.GetById(model.Id);
                    rotatingImageGroup.Name = model.Name;
                    rotatingImageGroup.RecordOrder = model.RecordOrder;
                    rotatingImageGroup.RecordActive = model.RecordActive;
                    response = Update(rotatingImageGroup);
                    return response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::UpdateSuccessfully:::Update group successfully.")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::UpdateFailure:::Update group failed. Please try again later."));

                case GridOperationEnums.Add:
                    rotatingImageGroup = Mapper.Map<RotatingImageGroupModel, RotatingImageGroup>(model);
                    rotatingImageGroup.Settings = string.Empty;
                    var groupSettingModel = new GroupSettingModel();
                    rotatingImageGroup.Settings = SerializeUtilities.SerializeObject(groupSettingModel);
                    response = Insert(rotatingImageGroup);
                    return response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::CreateSuccessfully:::Create group successfully")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::CreateFailure:::Insert group failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success
                                                   ? _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::DeleteSuccessfully:::Delete group successfully.")
                                                   : _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::DeleteFailure:::Delete group failed. Please try again later."));
            }
            return new ResponseModel
                {
                    Success = false,
                    Message = _localizedResourceServices.T("AdminModule:::RotatingImageGroups:::Messages:::ObjectNotFounded:::Rotating Image Group is not founded.")
                };
        }
Esempio n. 48
0
        /// <summary>
        /// Manage Rotating Images
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the setting model</param>
        /// <returns></returns>
        public ResponseModel ManageRotatingImage(GridOperationEnums operation, RotatingImageModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<RotatingImageModel, RotatingImage>();
            RotatingImage rotatingImage;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    rotatingImage = GetById(model.Id);
                    rotatingImage.ImageUrl = model.ImageUrl;
                    rotatingImage.Url = model.Url;
                    rotatingImage.GroupId = model.GroupName.ToInt();
                    rotatingImage.RecordOrder = model.RecordOrder;
                    response = Update(rotatingImage);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::UpdateSuccessfully:::Update rotating image successfully.")
                        : _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::UpdateFailure:::Update rotating image failed. Please try again later."));

                case GridOperationEnums.Add:
                    rotatingImage = Mapper.Map<RotatingImageModel, RotatingImage>(model);
                    rotatingImage.ImageUrl = string.Empty;
                    rotatingImage.GroupId = model.GroupName.ToInt();

                    response = Insert(rotatingImage);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::CreateSuccessfully:::Create rotating image successfully.")
                        : _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::CreateFailure:::Insert rotating image failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::DeleteSuccessfully:::Delete rotating image successfully.")
                        : _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::DeleteFailure:::Delete rotating image failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::RotatingImages:::Messages:::ObjectNotFounded:::Rotating image is not founded.")
            };
        }
Esempio n. 49
0
        /// <summary>
        /// Manage user group
        /// </summary>
        /// <param name="operation">the operation</param>
        /// <param name="model">the user group model</param>
        /// <returns></returns>
        public ResponseModel ManageService(GridOperationEnums operation, ServiceModel model)
        {
            ResponseModel response;
            Mapper.CreateMap<ServiceModel, Service>();
            Service service;
            switch (operation)
            {
                case GridOperationEnums.Edit:
                    service = _serviceRepository.GetById(model.Id);
                    service.Title = model.Title;
                    service.Status = model.Status;
                    service.RecordOrder = model.RecordOrder;
                    service.RecordActive = model.RecordActive;
                    response = Update(service);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Services:::Messages:::UpdateSuccessfully:::Update service successfully.")
                        : _localizedResourceServices.T("AdminModule:::Services:::Messages:::UpdateFailure:::Update service failed. Please try again later."));

                case GridOperationEnums.Add:
                    service = Mapper.Map<ServiceModel, Service>(model);
                    service.Status = model.Status;
                    service.Content = string.Empty;
                    service.Description = string.Empty;
                    response = Insert(service);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Services:::Messages:::CreateSuccessfully:::Create service successfully.")
                        : _localizedResourceServices.T("AdminModule:::Services:::Messages:::CreateFailure:::Insert service failed. Please try again later."));

                case GridOperationEnums.Del:
                    response = Delete(model.Id);
                    return response.SetMessage(response.Success ?
                        _localizedResourceServices.T("AdminModule:::Services:::Messages:::DeleteSuccessfully:::Delete service successfully.")
                        : _localizedResourceServices.T("AdminModule:::Services:::Messages:::DeleteFailure:::Delete service failed. Please try again later."));
            }
            return new ResponseModel
            {
                Success = false,
                Message = _localizedResourceServices.T("AdminModule:::Services:::Messages:::ObjectNotFounded:::Service is not founded.")
            };
        }