Esempio n. 1
0
        public ActionResult SaveDetails(ProjectDetails model)
        {
            if (ModelState.IsValid == false)
                return CurrentUmbracoPage();

            var nodeListingProvider = new NodeListingProvider();
            var project = (model.Id != 0) ? nodeListingProvider.GetListing(model.Id) : new ListingItem(null, null);

            project.Name = model.Title;
            project.Description = model.Description;
            project.CurrentVersion = model.Version;
            project.LicenseName = model.License;
            project.LicenseUrl = model.LicenseUrl;
            project.ProjectUrl = model.ProjectUrl;
            project.SourceCodeUrl = model.SourceCodeUrl;
            project.DemonstrationUrl = model.DemonstrationUrl;
            project.CategoryId = int.Parse(model.Category);
            project.OpenForCollab = model.OpenForCollaboration;
            project.GACode = model.GoogleAnalyticsCode;
            project.ProjectGuid = (model.Guid == Guid.Empty) ? Guid.NewGuid() : model.Guid; //this is used as the Unique project ID.
            project.ListingType = ListingType.free;
            // only set memberId when saving for the first time, else collaborators will cause it to switch the owner of the package
            if (model.Id == 0)
                project.VendorId = Members.GetCurrentMemberId();

            project.TermsAgreementDate = DateTime.Now.ToUniversalTime();

            nodeListingProvider.SaveOrUpdate(project);

            return Redirect("/member/profile/projects/edit?editorStep=files&id=" + project.Id);
        }
Esempio n. 2
0
 protected void Complete_Click(object sender, EventArgs e)
 {
     var nodeListingProvider = new NodeListingProvider();
     var project = nodeListingProvider.GetListing((int)ProjectId);
     project.Live = Live.Checked;
     nodeListingProvider.SaveOrUpdate(project);
     Response.Redirect(project.NiceUrl);
 }
Esempio n. 3
0
        protected void DeleteFile(object sender, CommandEventArgs e)
        {
            var mediaProvider = new MediaProvider();
            var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString()));
            _defaultFile = string.Empty;

            //update the project
            var nodeListingProvider = new NodeListingProvider();
            IListingItem project = nodeListingProvider.GetListing((int)ProjectId);
            project.DefaultScreenshot = _defaultFile;
            nodeListingProvider.SaveOrUpdate(project);

            var mem = Member.GetCurrentMember();

            if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId))
                mediaProvider.Remove(f);

            RebindFiles();
        }
Esempio n. 4
0
        protected void DeleteFile(object sender, CommandEventArgs e)
        {
            var mediaProvider = new MediaProvider();
            var f = mediaProvider.GetFileById(int.Parse(e.CommandArgument.ToString()));

            var mem = Member.GetCurrentMember();

            if (f.CreatedBy == mem.Id || Utils.IsProjectContributor(mem.Id, (int)ProjectId))

            //if the file is the default file we need to clear it out of the system to stop it showing as the default download
            if (f.Id.ToString() == _defaultFile)
            {
                _defaultFile = string.Empty;
                var nodeListingProvider = new NodeListingProvider();
                var project = nodeListingProvider.GetListing((int)ProjectId);
                project.CurrentReleaseFile = _defaultFile;
                nodeListingProvider.SaveOrUpdate(project);

            }

            mediaProvider.Remove(f);

            RebindFiles();
        }
Esempio n. 5
0
 private void MarkFileAsCurrent(string releaseFile)
 {
     var nodeListingProvider = new NodeListingProvider();
     IListingItem project = nodeListingProvider.GetListing((int)ProjectId);
     project.CurrentReleaseFile = releaseFile;
     nodeListingProvider.SaveOrUpdate(project);
     _defaultFile = project.CurrentReleaseFile;
 }
Esempio n. 6
0
 private void MarkFileAsCurrent(string defaultScreenshot)
 {
     var nodeListingProvider = new NodeListingProvider();
     IListingItem project = nodeListingProvider.GetListing((int)ProjectId);
     project.DefaultScreenshot = defaultScreenshot;
     nodeListingProvider.SaveOrUpdate(project);
     _defaultFile = project.DefaultScreenshot;
 }