예제 #1
0
    /// <summary>
    ///
    /// </summary>
    private void BindContactUs()
    {
        if (Context.User.Identity.IsAuthenticated)
        {
            UserProfile p = null;
            try
            {
                p = UserProfileDB.GetUserProfileByUserName(Context.User.Identity.Name.Trim());
            }

            catch
            {
            }

            if (p != null)
            {
                //bind to profile
                this.FirstNameTextBox.Text   = p.FirstName.Trim();
                this.LastNameTextBox.Text    = p.LastName.Trim();
                this.PhoneNumberTextBox.Text = p.Phone.Trim();
                this.EmailTextBox.Text       = p.Email.Trim();
            }
        }
    }
예제 #2
0
    public static JsonWrappers.UploadDetailDefaults Step2_Submit(string ScaleValue, string UpAxis)
    {
        HttpContext       context       = HttpContext.Current;
        HttpServerUtility server        = context.Server;
        FileStatus        currentStatus = (FileStatus)context.Session["fileStatus"];

        var             factory = new DataAccessFactory();
        IDataRepository dal     = factory.CreateDataRepositorProxy();
        ContentObject   tempCO  = (ContentObject)context.Session["contentObject"];

        tempCO.UpAxis    = server.HtmlEncode(UpAxis);
        tempCO.UnitScale = server.HtmlEncode(ScaleValue);
        //dal.UpdateContentObject(tempCO);
        context.Session["contentObject"] = tempCO;


        //Bind the
        JsonWrappers.UploadDetailDefaults jsReturnParams = new JsonWrappers.UploadDetailDefaults();
        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {
            UserProfile p = null;
            try
            {
                p = UserProfileDB.GetUserProfileByUserName(context.User.Identity.Name);
            }
            catch { }

            if (p != null)
            {
                jsReturnParams.HasDefaults   = true;
                jsReturnParams.DeveloperName = p.DeveloperName;
                jsReturnParams.ArtistName    = p.ArtistName;
                jsReturnParams.DeveloperUrl  = p.WebsiteURL;
                jsReturnParams.SponsorName   = p.SponsorName;

                string tempImagePath = context.Server.MapPath("~/App_Data/imageTemp/");
                if (p.DeveloperLogo != null)
                {
                    string extension           = p.DeveloperLogoContentType.Substring(p.DeveloperLogoContentType.LastIndexOf("/") + 1);
                    string tempDevLogoFilename = "devlogo_" + currentStatus.hashname.Replace("zip", extension);
                    using (FileStream stream = new FileStream(tempImagePath + tempDevLogoFilename, FileMode.Create))
                    {
                        stream.Write(p.DeveloperLogo, 0, p.DeveloperLogo.Length);
                    }

                    jsReturnParams.DeveloperLogoFilename = tempDevLogoFilename;
                }

                if (p.SponsorLogo != null)
                {
                    string extension = p.SponsorLogoContentType.Substring(p.SponsorLogoContentType.LastIndexOf("/") + 1);
                    string tempSponsorLogoFilename = "sponsorlogo_" + currentStatus.hashname.Replace("zip", extension);
                    using (FileStream stream = new FileStream(tempImagePath + tempSponsorLogoFilename, FileMode.Create))
                    {
                        stream.Write(p.SponsorLogo, 0, p.SponsorLogo.Length);
                    }

                    jsReturnParams.SponsorLogoFilename = tempSponsorLogoFilename;
                }
            }
        }
        dal.Dispose();
        return(jsReturnParams);
    }
예제 #3
0
    private void BindDeveloperLogo()
    {
        string logoImageURL = "";


        //check fedora
        if (!this.IsNew && this.FedoraContentObject != null && !string.IsNullOrEmpty(this.FedoraContentObject.DeveloperLogoImageFileName))
        {
            try
            {
                logoImageURL = String.Format("~/Public/Serve.ashx?pid={0}&mode=GetDeveloperLogo", this.FedoraContentObject.PID);
            }
            catch
            {
            }

            if (!string.IsNullOrEmpty(logoImageURL))
            {
                this.DeveloperLogoImage.ImageUrl = logoImageURL.Trim();
                return;
            }
        }
        //get from profile
        if (Context.User.Identity.IsAuthenticated)
        {
            UserProfile p = null;


            try
            {
                p = UserProfileDB.GetUserProfileByUserName(Context.User.Identity.Name);
            }
            catch
            {
            }

            //check profile if authenticated
            if (Context.User.Identity.IsAuthenticated && p != null)
            {
                if (p.DeveloperLogo != null && !string.IsNullOrEmpty(p.DeveloperLogoContentType))
                {
                    logoImageURL = Website.Pages.Types.FormatProfileImageHandler(p.UserID.ToString(), "Developer");

                    if (!string.IsNullOrEmpty(logoImageURL))
                    {
                        this.DeveloperLogoImage.ImageUrl = logoImageURL.Trim();
                        return;
                    }
                }
            }
        }


        //set selected
        //remove use current from radiobuttonlist, show file upload
        if (string.IsNullOrEmpty(logoImageURL))
        {
            //clear selection
            if (this.DeveloperLogoRadioButtonList.SelectedItem != null)
            {
                this.DeveloperLogoRadioButtonList.ClearSelection();
            }

            //remove
            this.DeveloperLogoRadioButtonList.Items.RemoveAt(0);

            //set upload new selected
            this.DeveloperLogoRadioButtonList.Items.FindByValue("1").Selected = true;
            this.DeveloperLogoImage.Visible           = false;
            this.DeveloperLogoFileUploadPanel.Visible = true;
        }
    }