示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PostListCore.Initialize(Request.QueryString);
            if (string.IsNullOrEmpty(PostTemplate))
            {
                PostTemplate = DefaultPostTemplate;
            }
            EntryList.ItemTemplate = Page.LoadTemplate(PostTemplate);

            ImageMaxSize = CurrentBlog.MaximumThumbnailImageSizeDimension;

            if (EntryList != null)
            {
                EntryList.DataSource = PostListCore.Entries;
                EntryList.DataBind();
            }

            if (PanelViewMore != null)
            {
                PanelViewMore.Visible = PostListCore.ShowViewMoreLink;
                if (PostListCore.ShowViewMoreLink)
                {
                    ancViewMore.HRef = PostListCore.ViewMoreHref;
                }
            }
        }
示例#2
0
    /// <summary>
    /// Binds the form.
    /// </summary>
    private void BindForm()
    {
        if (Config != null)
        {
            Description.Text = Config.Description;
        }

        OfferAmount.Text = "0";
        MinQuantity.Text = "0";

        Settings settings = GetSettings();

        if (settings != null)
        {
            PersistSkuEntrys     = settings.RuleSkuSet;
            MinQuantity.Text     = settings.MinQuantity.ToString();
            EntryList.DataSource = new SkuEntryHelper(settings.RuleSkuSet);
            EntryList.DataBind();
        }
        if (PromotionDto != null && PromotionDto.Promotion.Count != 0)
        {
            OfferAmount.Text = PromotionDto.Promotion[0].OfferAmount.ToString("N2");
            ManagementHelper.SelectListItem(OfferType, PromotionDto.Promotion[0].OfferType);
        }
    }
示例#3
0
    /// <summary>
    /// Binds the form.
    /// </summary>
    private void BindForm()
    {
        if (Config != null)
        {
            Description.Text = Config.Description;
        }

        OfferAmount.Text     = "0";
        MaxQuantity.Text     = "0";
        ExcludeEntry.Checked = false;

        Settings settings = GetSettings();

        if (settings != null)
        {
            EntryYFilter.SelectedEntryCode = settings.EntryYFilter;
            ExcludeEntry.Checked           = settings.Exclude;
            PersistSkuEntrys     = settings.EntryXSkuSet;
            MaxQuantity.Text     = settings.MaxYQuantity.ToString();
            EntryList.DataSource = new SkuEntryHelper(settings.EntryXSkuSet);
            EntryList.DataBind();
        }
        if (PromotionDto != null && PromotionDto.Promotion.Count != 0)
        {
            OfferAmount.Text = PromotionDto.Promotion[0].OfferAmount.ToString("N2");
            ManagementHelper.SelectListItem(OfferType, PromotionDto.Promotion[0].OfferType);
        }
    }
示例#4
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (Terms.Checked)
                {
                    Entries.Add(new UserRegistry(FirstName.Text,
                                                 LastName.Text,
                                                 UserName.Text,
                                                 EmailAddress.Text,
                                                 Password.Text));

                    EntryList.DataSource = Entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to the website terms";
                }
            }
            //if (!Page.IsValid)
            //{
            //    lblTest.Text = "Testigngngnnngngngng";
            //    Panel1.Visible = true;
            //}
        }
示例#5
0
    /// <summary>
    /// Handles the Command event of the DeleteButton control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.CommandEventArgs"/> instance containing the event data.</param>
    protected void DeleteButton_Command(object sender, CommandEventArgs e)
    {
        SkuEntryHelper skuEntrys = new SkuEntryHelper(PersistSkuEntrys);

        skuEntrys.RemoveSkuEntry(e.CommandArgument.ToString());
        EntryList.DataSource = skuEntrys;
        EntryList.DataBind();
        this.PersistSkuEntrys = skuEntrys.ToString();
    }
示例#6
0
    /// <summary>
    /// Handles the Click event of the AddEntry control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void AddEntry_Click(object sender, EventArgs e)
    {
        SkuEntryHelper skuEntrys = new SkuEntryHelper(PersistSkuEntrys);

        skuEntrys.AddSkuEntry(SkuEntryFilter.SelectedEntryCode);
        EntryList.DataSource = skuEntrys;
        EntryList.DataBind();
        this.PersistSkuEntrys = skuEntrys.ToString();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     Message.Text = "";
     //check your Page.IsPostBack to see if this is the
     //first presentation of the page (IsPostBack = false)
     if (!Page.IsPostBack)
     {
         EntryList.DataSource = entries;
         EntryList.DataBind();
     }
 }
示例#8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Message.Text = "";
     if (!Page.IsPostBack)
     {
         //on the first presentation of the page
         if (entries.Count > 0)
         {
             EntryList.DataSource = entries;
             EntryList.DataBind();
         }
     }
 }
        protected void Submit_Click(object sender, EventArgs e)
        {
            //the client side execution of your validation controls
            // is done by using Page.IsValid
            if (Page.IsValid)
            {
                //you may have logic testing to do
                //if you have a prompt line on your DDL, test for it
                //our entry form has a Terms acceptance test
                //  yes: save entry, add to collection and display
                //   no: message
                //the Term data will NOT be saved
                //the CheckAnswer will NOT be saved
                if (Terms.Checked)
                {
                    //need a new instance of CEntry
                    CEntry theEntry = new CEntry();

                    //need to fill/load the instance
                    theEntry.FirstName      = FirstName.Text;
                    theEntry.LastName       = LastName.Text;
                    theEntry.StreetAddress1 = StreetAddress1.Text;
                    theEntry.StreetAddress2 =
                        string.IsNullOrEmpty(StreetAddress2.Text) ? null: StreetAddress2.Text;
                    theEntry.City         = City.Text;
                    theEntry.Province     = Province.SelectedValue;
                    theEntry.PostalCode   = PostalCode.Text;
                    theEntry.EmailAddress = EmailAddress.Text;

                    //need to add the instance to my collection
                    Entries.Add(theEntry);

                    //Entries.Add(new CEntry(FirstName.Text,
                    //                        LastName.Text,
                    //                        StreetAddress1.Text,
                    //                        string.IsNullOrEmpty(StreetAddress2.Text) ? null : StreetAddress2.Text,
                    //                        City.Text,
                    //                        Province.SelectedValue,
                    //                        PostalCode.Text,
                    //                        EmailAddress.Text));

                    //need to display the collection
                    EntryList.DataSource = Entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to terms. Entry rejected.";
                }
            }
        }
示例#10
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            //the client side execution of your validation controls
            //  is done by using Page.IsValid
            if (Page.IsValid)
            {
                //you may have logic testing to do
                //if you have a prompt line on your DDL, test for it
                //our entry form has a Terms acceptance test
                //  yes: save entry, add to collection, display
                //   no: message
                //the Term data and Check Answer data will NOT be saved
                if (Terms.Checked)
                {
                    //create new instance
                    //theEntry = new CEntry();

                    //load new instance with form data
                    //theEntry.FirstName = FirstName.Text;
                    //theEntry.LastName = LastName.Text;
                    //theEntry.StreetAddress1 = StreetAddress1.Text;
                    //theEntry.StreetAddress2 = string.IsNullOrEmpty(StreetAddress2.Text)? null: StreetAddress2.Text;
                    //theEntry.City = City.Text;
                    //theEntry.Province = Province.SelectedValue;
                    //theEntry.PostalCode = PostalCode.Text;
                    //theEntry.EmailAddress = EmailAddress.Text;


                    //add to collection
                    //Entries.Add(theEntry);

                    //using the greedy constructor, create,load,add in one statement
                    Entries.Add(new CEntry(FirstName.Text,
                                           LastName.Text,
                                           StreetAddress1.Text,
                                           string.IsNullOrEmpty(StreetAddress2.Text)? null: StreetAddress2.Text,
                                           City.Text,
                                           Province.SelectedValue,
                                           PostalCode.Text,
                                           EmailAddress.Text));

                    EntryList.DataSource = Entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to the contest entry terms. Entry rejected";
                }
            }
        }
    /// <summary>
    /// Binds the data.
    /// </summary>
    private void BindData()
    {
        if (Association != null && Association.EntryAssociations != null)
        {
            this.Visible           = true;
            AssociationHeader.Text = Association.Description;
            EntryList.DataSource   = Association.EntryAssociations.Association;

            EntryList.DataBind();
        }
        else
        {
            this.Visible = false;
        }
    }
示例#12
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            //server side Execution of your validation controls is dpne by using Page.IsValid
            if (Page.IsValid)
            {
                //you may have logic testiong to do in code behind
                //if you have a prompt line on your ddl, test for it
                //our entry form has a terms of acceptance test
                //  Yes: Save entry, add to collection, display
                //  No: message
                //the term data and check answer data will NOT be saved
                if (Terms.Checked)
                {
                    //create a new instance of CEntry
                    CEntry theEntry = new CEntry();
                    ////load the form data into this instance
                    //theEntry.FirstName = FirstName.Text;
                    //theEntry.LastName = LastName.Text;
                    //theEntry.StreetAddress1 = StreetAddress1.Text;
                    //theEntry.StreetAddress2 =
                    //    string.IsNullOrEmpty(StreetAddress2.Text) ? null : StreetAddress2.Text;
                    //theEntry.City = City.Text;
                    //theEntry.Province = Province.Text;
                    //theEntry.PostalCode = PostalCode.Text;
                    //theEntry.EmailAddress = EmailAddress.Text;
                    ////add the instance to the collection
                    //Entries.Add(theEntry);

                    //use the Greedy constructor to load the instance and collection
                    Entries.Add(new CEntry(FirstName.Text,
                                           LastName.Text,
                                           StreetAddress1.Text,
                                           string.IsNullOrEmpty(StreetAddress2.Text) ? null : StreetAddress2.Text,
                                           City.Text,
                                           Province.Text,
                                           PostalCode.Text,
                                           EmailAddress.Text));
                    //display the collection
                    //EntryList is the id of the web grid in the main file
                    EntryList.DataSource = Entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to the contest terms. Entry rejected.";
                }
            }
        }
示例#13
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            //to execute the validation controls (not Html5) on the server side
            if (Page.IsValid)
            {
                if (Terms.Checked)
                {
                    //i could check the math answer in my code behind
                    //BUT we will do that using validation controls

                    //record my entry
                    //collect all the entries and display them

                    //create an instance of the data class
                    Entry theEntry = new Entry();

                    //load the instance with data from the form
                    theEntry.FirstName      = FirstName.Text;
                    theEntry.LastName       = LastName.Text;
                    theEntry.StreetAddress1 = StreetAddress1.Text;
                    theEntry.StreetAddress2 =
                        string.IsNullOrEmpty(StreetAddress2.Text) ? null : StreetAddress2.Text;
                    theEntry.City         = City.Text;
                    theEntry.Province     = Province.SelectedValue; //ddl
                    theEntry.PostalCode   = PostalCode.Text;
                    theEntry.EmailAddress = EmailAddress.Text;

                    //add the new instance to a collection of entries
                    entries.Add(theEntry);

                    //display the collection
                    //use a collection display control that displays
                    //      multiple separate columns: GridView
                    //requirements:
                    // a) assign data source (DataSource)
                    // b) bind the data to the control
                    EntryList.DataSource = entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to the contest terms. Entry rejected";
                }
            }
        }
 protected void Submit_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Entries.Add(new TVMovies(MovieTitle.Text,
                                  Year.Text,
                                  Media.Text,
                                  Rating.Text,
                                  Review.Text,
                                  ISBN.Text));
         EntryList.DataSource = Entries;
         EntryList.DataBind();
     }
     else
     {
         Message.Text = "Movie has been added to library";
     }
 }
示例#15
0
        //submit button
        protected void Submit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                //you may have logical testing to do
                //if we have prompt line from our ddl, test for it
                //our entry form has a Terms acceptance
                //  accepted: store data enrty
                //          display
                //  not accepted, tell user you cant proceed
                //the term data and check answer data will NOT be saved

                if (Terms.Checked)
                {
                    ////--one way--
                    ////create new instance
                    //CEntry theEntry = new CEntry();
                    ////load new instance
                    //theEntry.FirstName = FirstName.Text;
                    ////so on..
                    //// add to collection data.
                    //Entries.Add(theEntry);

                    //use the greedy constructor.
                    //create, load, add in one statement
                    Entries.Add(new CEntry(FirstName.Text,
                                           LastName.Text,
                                           StreetAddress1.Text,
                                           string.IsNullOrEmpty(StreetAddress2.Text)? null: StreetAddress2.Text,
                                           City.Text,
                                           Province.SelectedValue,
                                           PostalCode.Text,
                                           EmailAddress.Text));
                    EntryList.DataSource = Entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to the entry terms, enrty rejected.";
                }
            }
            //store data entered.
        }
示例#16
0
        protected virtual void BindEntries(string tag)
        {
            var categoryTemplateID = Settings.CategoryTemplateID;
            var categoryTemplate   = new TemplateItem(Sitecore.Context.Database.GetItem(categoryTemplateID));

            IEnumerable <EntryItem> entries;

            if (!string.IsNullOrEmpty(tag))
            {
                entries = ManagerFactory.EntryManagerInstance.GetBlogEntries(tag);
                //TODO: Does this logic belong elsewhere? Possibly consolidate title logic somewhere.
                Page.Title = "Posts tagged \"" + tag + "\" | " + CurrentBlog.Title.Text;
            }
            else if (Sitecore.Context.Item.TemplateIsOrBasedOn(categoryTemplate))
            {
                CategoryItem category = Sitecore.Context.Item;
                entries    = ManagerFactory.EntryManagerInstance.GetBlogEntryByCategorie(CurrentBlog.ID, Sitecore.Context.Item.Name);
                Page.Title = category.Title.Text + " | " + CurrentBlog.Title.Text;
            }
            else
            {
                entries = ManagerFactory.EntryManagerInstance.GetBlogEntries();
            }
            if (TotalToShow == 0)
            {
                TotalToShow = entries.Count();
            }
            if ((StartIndex + TotalToShow) >= entries.Count())
            {
                if (ancViewMore != null)
                {
                    ancViewMore.Visible = false;
                }
            }
            entries = entries.Skip(StartIndex).Take(TotalToShow);

            if (EntryList != null)
            {
                EntryList.DataSource = entries;
                EntryList.DataBind();
            }
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            //Re-execute the validation Controls on the server side.
            if (Page.IsValid)                     //Wrap the if(Page.IsValid around the submit button since we want the validation when the user pressed the submit button.)
            {
                if (Terms.Checked)                //makes sure that they have agreed to the terms and conditions (when the checkbox is checked) then we can store the information
                {                                 //That's when we create an instance of the object
                    //Created an instance of the data class (object)
                    Entry theEntry = new Entry(); //Wir brauchen hierfuer kein constructor weil wir nix direkt angeben in den klammern wenn wir n object createn
                    //Entry is the name of our class (the datatype of the instance)
                    //theEntry is the name of the instance


                    //loaded the instance with data from the form
                    theEntry.FirstName      = FirstName.Text;
                    theEntry.LastName       = LastName.Text;
                    theEntry.StreetAdress1  = StreetAddress1.Text;
                    theEntry.StreetAddress2 = string.IsNullOrEmpty(StreetAddress2.Text) ? null : StreetAddress2.Text;
                    theEntry.City           = City.Text;
                    theEntry.Province       = Province.SelectedValue;
                    theEntry.PostalCode     = PostalCode.Text;
                    theEntry.EmailAddress   = EmailAddress.Text;

                    //Add the new instance to the collection (entries is the name of the list we created up on top of page) theEntry is the name of the instance that we created
                    entries.Add(theEntry); //theEntry is the name of the instance of the class we created


                    //Display the collection (List)
                    //Use a collection display control: GridView
                    //Requirements: a) Data source (collection)
                    //b) bind the data to the control
                    EntryList.DataSource = entries; //EntryList is the name of our GridView on the previous page (with the controls on it); entries is the name of the list we created
                    EntryList.DataBind();
                    //Difference: GriedView can have any number of columns while the DropDownList has ValueField and DataTtextField (2 fields)
                }
                else
                {
                    Message.Text = "You did not agree to the contest terms. Entry rejected.";
                }
            }
        }
示例#18
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            //re--execute the validation controls on the server side
            if (Page.IsValid)
            {
                if (Terms.Checked)
                {
                    List <Entry> entries = new List <Entry>();
                    //create an instance of the data class
                    Entry theEntry = new Entry();

                    //load the instance with data from the form
                    theEntry.FirstName      = FirstName.Text;
                    theEntry.LastName       = LastName.Text;
                    theEntry.StreetAddress1 = StreetAddress1.Text;
                    theEntry.StreetAddress2 = string.IsNullOrEmpty(StreetAddress2.Text) ? null : StreetAddress2.Text;
                    theEntry.City           = City.Text;
                    theEntry.Province       = Province.Text;
                    theEntry.PostalCode     = PostalCode.Text;
                    theEntry.EmailAddress   = EmailAddress.Text;

                    //add the new instance to a  collection of entries
                    entries.Add(theEntry);

                    //display the collection
                    //use a collection display control that displays multiple seperate columns: GridView
                    //requirements:
                    //A) data source (collection)
                    //B) bind the data to the controls

                    EntryList.DataSource = entries;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You did not agree to the contest terms. Entry rejected.";
                }
            }
        }
示例#19
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            //validation
            // required: ensures that the user has supplied a value
            // range: checks a suppliedvalue against a set lower-upper range of numbers or characters
            // RegularExperession: checks a supplied value against a given pattern such as postal code email phone.ect
            //Custom: is a call to a server side program validation method
            //Compare: i) can be used to compare a value to a specific data type
            //          ii) can be used to compare a valve to a specified constant value( == != >= <=)
            //          ii) can be used to compare a value in one control to a value in another control(password)
            //validation message: statc, dynamic, none

            if (Page.IsValid)
            {
                if (Terms.Checked)
                {
                    string firstname      = FirstName.Text;
                    string lastname       = LastName.Text;
                    string streetaddress1 = StreetAddress1.Text;
                    string streetaddress2 = StreetAddress2.Text;
                    string city           = City.Text;
                    string province       = Province.SelectedValue;
                    string postalcode     = PostalCode.Text;
                    string emailaddress   = EmailAddress.Text;
                    bool   termcheck      = Terms.Checked;
                    string checkanswer    = CheckAnswer.Text;

                    entryCollection.Add(new Entry(firstname, lastname, streetaddress1, streetaddress2, city, province, postalcode, emailaddress));

                    EntryList.DataSource = entryCollection;
                    EntryList.DataBind();
                }
                else
                {
                    Message.Text = "You have to agree the term.";
                }
            }
        }
示例#20
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                //this test will fire the validation controls on the server side

                //if additional validation is required, do that first
                if (Terms.Checked == true)
                {
                    //user has agreed to the terms and conditions of the contest
                    //collect the data
                    //create/load a contest entry to the collection
                    //display the collection
                }
                else
                {
                    Message.Text = "Please agree to our terms of service before being entered into our contest.";
                }
            }

            EntryList.DataSource = entryData;
            EntryList.DataBind();
        }
示例#21
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            //the client side execution of your validation controls
            //is done BY using Page.Isvalid
            if (Page.IsValid)
            {
                // you may have logical testing to do
                //if you have a prompt line on your DDL, test for it
                //our entry form has a "terms" acceptance test
                //yes: save entry, add to collection
                //no: message
                //the Term data will NOT be saved
                //the checkanswer will NOT be saved

                bool UniqueID = true;

                foreach (CEntry entry in Entries)
                {
                    if (FirstName.Text == entry.FirstName)
                    {
                        UniqueID = false;
                    }
                }


                if (!UniqueID)
                {
                    //Error message displays somewhere
                }
                else
                {
                    if (Terms.Checked)
                    {
                        //need a new instance of CEntry
                        CEntry theEntry = new CEntry();
                        //need to fill/load the instance
                        theEntry.FirstName      = FirstName.Text;
                        theEntry.LastName       = LastName.Text;
                        theEntry.StreetAddress1 = StreetAddress1.Text;
                        theEntry.StreetAddress2 = string.IsNullOrEmpty(StreetAddress2.Text) ?
                                                  null : StreetAddress2.Text;
                        theEntry.City         = City.Text;
                        theEntry.Province     = Province.SelectedValue;
                        theEntry.PostalCode   = PostalCode.Text;
                        theEntry.EmailAddress = EmailAddress.Text;

                        //need to add the instance to my collection
                        Entries.Add(theEntry);

                        //Entries.Add(new CEntry(FirstName.Text,
                        //    LastName.Text,
                        //    StreetAddress1.Text,
                        //    string.IsNullOrEmpty(StreetAddress2.Text) ? null : StreetAddress2.Text,
                        //   Province.SelectedValue, PostalCode.Text, EmailAddress.Text));
                        //need to display the collection
                        EntryList.DataSource = Entries;
                        EntryList.DataBind();
                    }
                    else
                    {
                        Message.Text = "You did not agree to term. Entry Rejected";
                    }
                }
            }
        }