Пример #1
0
        protected virtual void UpdateLocales(Contributor contributor, ContributorModel model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(contributor,
                                                           x => x.Name,
                                                           localized.Name,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(contributor,
                                                           x => x.Description,
                                                           localized.Description,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(contributor,
                                                           x => x.MetaKeywords,
                                                           localized.MetaKeywords,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(contributor,
                                                           x => x.MetaDescription,
                                                           localized.MetaDescription,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(contributor,
                                                           x => x.MetaTitle,
                                                           localized.MetaTitle,
                                                           localized.LanguageId);

                //search engine name
                var seName = contributor.ValidateSeName(localized.SeName, localized.Name, false);
                _urlRecordService.SaveSlug(contributor, seName, localized.LanguageId);
            }
        }
Пример #2
0
        public virtual ActionResult Create(ContributorModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageContributors))
            {
                return(AccessDeniedView());
            }

            if (ModelState.IsValid)
            {
                var contributor = model.ToEntity();
                _contributorService.InsertContributor(contributor);

                //activity log
                _customerActivityService.InsertActivity("AddNewContributor", _localizationService.GetResource("ActivityLog.AddNewContributor"), contributor.Id);

                //search engine name
                model.SeName = contributor.ValidateSeName(model.SeName, contributor.Name, true);
                _urlRecordService.SaveSlug(contributor, model.SeName, 0);

                //address
                var address = model.Address.ToEntity();
                address.CreatedOnUtc = DateTime.UtcNow;
                //some validation
                if (address.CountryId == 0)
                {
                    address.CountryId = null;
                }
                if (address.StateProvinceId == 0)
                {
                    address.StateProvinceId = null;
                }
                _addressService.InsertAddress(address);
                contributor.AddressId = address.Id;
                _contributorService.UpdateContributor(contributor);

                //locales
                UpdateLocales(contributor, model);
                //update picture seo file name
                UpdatePictureSeoNames(contributor);

                SuccessNotification(_localizationService.GetResource("Admin.Contributors.Added"));

                if (continueEditing)
                {
                    //selected tab
                    SaveSelectedTabName();

                    return(RedirectToAction("Edit", new { id = contributor.Id }));
                }
                return(RedirectToAction("List"));
            }

            //If we got this far, something failed, redisplay form
            PrepareContributorModel(model, null, true, true);
            return(View(model));
        }
Пример #3
0
        public async Task <ActionResult> GetTopContributer(string owner, string repository)
        {
            var topgun = await _githubService.GetTopExternalControbutorAsync(owner, repository);

            var response = new ContributorModel
            {
                Contributor = topgun
            };


            return(Ok(response));
        }
Пример #4
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            ContributorModel tachiProfile = new ContributorModel()
            {
                Name          = "Tachibana Yui",
                ProfilePicure = "https://avatars3.githubusercontent.com/u/33594017",
                Role          = "Project Owner",
                Description   = "Hello, my name is Tachibana Yui and thank you for choosing Fschool Auto Feedback Windows 10 Edition. I am a hobbyist programmer for some reason also love Japanese cultures. I came to the programming world after watching an anime series called \"Sword Art Online\" after that, I always want to create my dream game. I have 3.5 years of experience working with .NET and C# technology. In recent years, I have created a few programs, automated tools to improve overall watching anime experience. It comprises of 3 projects, but unfortunately, 2 of them are discontinued due to lack of maintainability. If you are interested in this application, please check out \"Universal Anime Downloader\" in my Github Page. In the past few months, I also curious about Minecraft mod development, so I also have a quick dive into Java programming language and created a program called \"MineCLIA\" or Minecraft Command Line Automation. It lets you send commands to Minecraft client via command line or socket. Check it out on my GitHub page.",
                Link          = "https://github.com/quangaming2929",
            };

            Contributors.Add(tachiProfile);

            FeatureModel fbWoHassle = new FeatureModel()
            {
                Glyph  = "\uE899",
                Title  = "Quickly feedback without hassle",
                Detail = "Fschool auto feedback windows 10 edition help you feedback without the need to painstakingly go through each teacher. You can feedback all teacher with a few simple click"
            };

            FeatureModel fbSpeed = new FeatureModel()
            {
                Glyph  = "\uEC4A",
                Title  = "Blazing fast speed",
                Detail = "With batch feedback, you can feedback all teacher significantly faster when you feedback on the offical website. Fschool auto feedback windows 10 edition can feedback 10 teachers per second after you hit send (actual speed may vary)"
            };

            FeatureModel fbLogin = new FeatureModel()
            {
                Glyph  = "\uE779",
                Title  = "Login with ease",
                Detail = "Unlike fschool.fpt.edu.vn where you need to login each time you visit the site. This program only requires you to login once, all the authorization is done automatically until you sign out or revoke the program access"
            };

            FeatureModel fbUsability = new FeatureModel()
            {
                Glyph  = "\uE8CB",
                Title  = "Advanced filtering",
                Detail = "Fschool Autofeedback windows 10 edition is highly customizable. You can search teacher like in offical website but you also can filter, exclude who will be feedback. Save a draft to feedback later,...  "
            };

            Features.Add(fbWoHassle);
            Features.Add(fbSpeed);
            Features.Add(fbLogin);
            Features.Add(fbUsability);
        }
        public ActionResult Index(string contributor)
        {
            var sql = Odp.Data.Sql.sqlServerConnection.GetDataServiceInstance();

            model            = new ContributorModel();
            model.OtherModel = new DatasetListModel(0, 0, new OrderByInfo(), null, null);

            foreach (Container con in model.OtherModel.AllContainers)
            {
                if (con.Alias == contributor)
                {
                    model.Id          = sql.GetDataSourceID(con.Alias);
                    model.Name        = con.Alias;
                    model.Description = con.Description;
                    model.Disclaimer  = con.Disclaimer;
                }
            }

            return(View("Index", System.Configuration.ConfigurationManager.AppSettings["MasterPageName"], model));
        }
Пример #6
0
        //create
        public virtual ActionResult Create()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageContributors))
            {
                return(AccessDeniedView());
            }


            var model = new ContributorModel();

            PrepareContributorModel(model, null, false, true);
            //locales
            AddLocales(_languageService, model.Locales);
            //default values
            model.PageSize = 6;
            model.Active   = true;
            model.AllowCustomersToSelectPageSize = true;
            model.PageSizeOptions = _contributorSettings.DefaultContributorPageSizeOptions;

            //default value
            model.Active = true;
            return(View(model));
        }
        public ActionResult Index(ContributorModel model)
        {
            var sql = Odp.Data.Sql.sqlServerConnection.GetDataServiceInstance();

            this.model = model;

            if (model.Save == "Save")
            {
                if (model.Id == null)
                {
                    sql.InsertContributor(model.Name, model.Description, model.Disclaimer);
                }
                else
                {
                    sql.UpdateContributor(model.Id, model.Name, model.Description, model.Disclaimer);
                }
            }
            else
            {
                return(RedirectToAction("DataSetList", "DataCatalog"));
            }

            return(RedirectToAction("DataSetList", "DataCatalog"));
        }
 /// <summary>
 /// Persists a new contributors in the data store.
 /// </summary>
 /// <param name="contributor">The <see cref="ContributorModel"/> instance to persist</param>
 public void Persist(ContributorModel contributor)
 {
     collection.Insert(contributor);
 }
Пример #9
0
        public virtual ActionResult Edit(ContributorModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageContributors))
            {
                return(AccessDeniedView());
            }

            var contributor = _contributorService.GetContributorById(model.Id);

            if (contributor == null || contributor.Deleted)
            {
                //No contributor found with the specified id
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                int prevPictureId = contributor.PictureId;
                contributor = model.ToEntity(contributor);
                _contributorService.UpdateContributor(contributor);

                //activity log
                _customerActivityService.InsertActivity("EditContributor", _localizationService.GetResource("ActivityLog.EditContributor"), contributor.Id);

                //search engine name
                model.SeName = contributor.ValidateSeName(model.SeName, contributor.Name, true);
                _urlRecordService.SaveSlug(contributor, model.SeName, 0);

                //address
                var address = _addressService.GetAddressById(contributor.AddressId);
                if (address == null)
                {
                    address = model.Address.ToEntity();
                    address.CreatedOnUtc = DateTime.UtcNow;
                    //some validation
                    if (address.CountryId == 0)
                    {
                        address.CountryId = null;
                    }
                    if (address.StateProvinceId == 0)
                    {
                        address.StateProvinceId = null;
                    }

                    _addressService.InsertAddress(address);
                    contributor.AddressId = address.Id;
                    _contributorService.UpdateContributor(contributor);
                }
                else
                {
                    address = model.Address.ToEntity(address);
                    //some validation
                    if (address.CountryId == 0)
                    {
                        address.CountryId = null;
                    }
                    if (address.StateProvinceId == 0)
                    {
                        address.StateProvinceId = null;
                    }

                    _addressService.UpdateAddress(address);
                }


                //locales
                UpdateLocales(contributor, model);
                //delete an old picture (if deleted or updated)
                if (prevPictureId > 0 && prevPictureId != contributor.PictureId)
                {
                    var prevPicture = _pictureService.GetPictureById(prevPictureId);
                    if (prevPicture != null)
                    {
                        _pictureService.DeletePicture(prevPicture);
                    }
                }
                //update picture seo file name
                UpdatePictureSeoNames(contributor);

                SuccessNotification(_localizationService.GetResource("Admin.Contributors.Updated"));
                if (continueEditing)
                {
                    //selected tab
                    SaveSelectedTabName();

                    return(RedirectToAction("Edit", new { id = contributor.Id }));
                }
                return(RedirectToAction("List"));
            }

            //If we got this far, something failed, redisplay form
            PrepareContributorModel(model, contributor, true, true);

            return(View(model));
        }
Пример #10
0
        protected virtual void PrepareContributorModel(ContributorModel model, Contributor contributor, bool excludeProperties, bool prepareEntireAddressModel)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var address = _addressService.GetAddressById(contributor != null ? contributor.AddressId : 0);

            if (contributor != null)
            {
                if (!excludeProperties)
                {
                    if (address != null)
                    {
                        model.Address = address.ToModel();
                    }
                }

                //associated customer emails
                model.AssociatedCustomers = _customerService
                                            .GetAllCustomers(contributorId: contributor.Id)
                                            .Select(c => new ContributorModel.AssociatedCustomerInfo()
                {
                    Id    = c.Id,
                    Email = c.Email
                })
                                            .ToList();
            }

            if (prepareEntireAddressModel)
            {
                model.Address.CountryEnabled        = true;
                model.Address.StateProvinceEnabled  = true;
                model.Address.CityEnabled           = true;
                model.Address.StreetAddressEnabled  = true;
                model.Address.StreetAddress2Enabled = true;
                model.Address.ZipPostalCodeEnabled  = true;
                model.Address.PhoneEnabled          = true;
                model.Address.FaxEnabled            = true;

                //address
                model.Address.AvailableCountries.Add(new SelectListItem {
                    Text = _localizationService.GetResource("Admin.Address.SelectCountry"), Value = "0"
                });
                foreach (var c in _countryService.GetAllCountries(showHidden: true))
                {
                    model.Address.AvailableCountries.Add(new SelectListItem {
                        Text = c.Name, Value = c.Id.ToString(), Selected = (address != null && c.Id == address.CountryId)
                    });
                }

                var states = model.Address.CountryId.HasValue ? _stateProvinceService.GetStateProvincesByCountryId(model.Address.CountryId.Value, showHidden: true).ToList() : new List <StateProvince>();
                if (states.Any())
                {
                    foreach (var s in states)
                    {
                        model.Address.AvailableStates.Add(new SelectListItem {
                            Text = s.Name, Value = s.Id.ToString(), Selected = (address != null && s.Id == address.StateProvinceId)
                        });
                    }
                }
                else
                {
                    model.Address.AvailableStates.Add(new SelectListItem {
                        Text = _localizationService.GetResource("Admin.Address.OtherNonUS"), Value = "0"
                    });
                }
            }
        }
Пример #11
0
 public static Contributor ToEntity(this ContributorModel model, Contributor destination)
 {
     return(model.MapTo(destination));
 }
Пример #12
0
 public static Contributor ToEntity(this ContributorModel model)
 {
     return(model.MapTo <ContributorModel, Contributor>());
 }
 /// <summary>
 /// Persists a new contributors in the data store.
 /// </summary>
 /// <param name="contributor">The <see cref="ContributorModel"/> instance to persist</param>
 public void Persist(ContributorModel contributor)
 {
     collection.Insert(contributor);
 }