Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WestgateEntities DatabaseContext = new WestgateEntities();
            if (Request["tagId"] != null)
            {
                int tagId = int.Parse(Request["tagId"]);

                Tag tag = (from t in DatabaseContext.Tags
                           where t.TagId == tagId
                           select t).FirstOrDefault();

                var tagImages = (from imgTag in DatabaseContext.ImageTags
                                 where imgTag.Tag.TagId == tag.TagId
                                 orderby imgTag.OrderNumber
                                 select imgTag.Image);

                //var tagImages = (from i in DatabaseContext.Images
                //                  where i.Tags.Contains(tag) == true
                //                 orderby i.ImageId descending
                //                  select i);

                Repeater1.DataSource = tagImages;
                Label1.Text = tagImages.Count().ToString();
            }
            else
            {
                var tagImages = (from imgTag in DatabaseContext.ImageTags
                                 orderby imgTag.Tag.OrderNumber, imgTag.OrderNumber
                                 select imgTag.Image);
                Repeater1.DataSource = tagImages;
                Label1.Text = tagImages.Count().ToString();
            }

            Repeater1.DataBind();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WestgateEntities db = new WestgateEntities();
            if (IsPostBack == false)
            {
                TreeNode categoriesNode = new TreeNode("Tags");
                categoriesNode.NavigateUrl = "~/Admin/TagsList.aspx";
                categoriesNode.Expand();

                List<Tag> listTags = (from t in db.Tags orderby t.Name select t).ToList();
                foreach (Tag tag in listTags)
                {
                    TreeNode catNode = new TreeNode(tag.Name,tag.TagId.ToString());
                    catNode.NavigateUrl = "~/Admin/EditTag.aspx?tagId=" + tag.TagId;
                    catNode.CollapseAll();
                    categoriesNode.ChildNodes.Add(catNode);
                }

                tvStructure.Nodes.Add(categoriesNode);
                tvStructure.Nodes.Add(new TreeNode("Add New Image", "Add New Image", "", "~/Admin/AddImageNew.aspx", ""));
                tvStructure.Nodes.Add(new TreeNode("Gallery", "Gallery", "", "~/Admin/Gallery.aspx", ""));
                tvStructure.Nodes.Add(new TreeNode("Order Tags", "Order Tags", "", "~/Admin/OrderTags.aspx", ""));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WestgateEntities DatabaseContext = new WestgateEntities();
            Repeater1.DataSource = (from row in DatabaseContext.Tags where row.ShowInTabs orderby row.OrderNumber select row).Take(7);
            Repeater1.DataBind();

            if (IsPostBack == false)
            {
                TreeNode categoriesNode = new TreeNode("All");
                categoriesNode.NavigateUrl = "~/Gallery.aspx";
                categoriesNode.Expand();

                List<Tag> listTags = (from t in DatabaseContext.Tags orderby t.Name select t).ToList();
                foreach (Tag tag in listTags)
                {
                    TreeNode catNode = new TreeNode(tag.Name, tag.TagId.ToString());
                    catNode.NavigateUrl = "~/Gallery.aspx?tagId=" + tag.TagId;
                    catNode.CollapseAll();
                    categoriesNode.ChildNodes.Add(catNode);
                }

                tvStructure.Nodes.Add(categoriesNode);
            }
        }
 protected void submitButton_Click(object sender, ImageClickEventArgs e)
 {
     WestgateEntities DatabaseContext = new WestgateEntities();
     UserEnquiry enquiry = new UserEnquiry
     {
         companyName = CompanyTextID.Text,
         personName = PersonTextID.Text,
         email = EmailTextID.Text,
         postCode = PostTextID.Text,
         phoneNumber = PhoneTextID.Text,
         enquiry = EnquirySelectedId.SelectedItem.Text
     };
     DatabaseContext.UserEnquiries.AddObject(enquiry);
     //            DatabaseContext.AddToUserEnquiries(enquiry);
     DatabaseContext.SaveChanges();
     MailMessage message = new MailMessage();
     message.To.Add(new MailAddress(EmailTextID.Text, PersonTextID.Text));
     message.Body = "Company :" + CompanyTextID.Text + "<br/>Person :" + PersonTextID.Text + "<br/>Email :" + EmailTextID.Text + "<br/>Post Code : " + PostTextID.Text + "<br/>Phone :" + PhoneTextID.Text + "<br/>Nature of Enquiry :" + EnquirySelectedId.SelectedItem.Text;
     message.Subject = "Nature of Enquiry";
     message.IsBodyHtml = true;
     EmailUtility.SendEmail(message);
     ErrorLabel.Visible = true;
     ErrorLabel.Text = "Request Sent";
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Tag allTag = new Tag
            {
                TagId = 0,
                Name = "All"
            };

            Tag galleryTag = new Tag
            {
                TagId = 3,
                Name = "Gallery"
            };

            WestgateEntities DatabaseContext = new WestgateEntities();
            List<Tag> taglistMain = (from row in DatabaseContext.Tags where row.ShowInTabs orderby row.OrderNumber select row).ToList();
            taglistMain.Insert(2, galleryTag);

            Repeater1.DataSource = taglistMain;
            Repeater1.DataBind();

            /*List<Tag> taglistMore = (from row in DatabaseContext.Tags where row.ShowInTabs orderby row.OrderNumber select row).ToList();
            if (taglistMore.Count>6)
            {
                div_repeatermore.Visible = true;
                for (int i = 0; i < 6; i++)
                {
                    taglistMore.RemoveAt(0);
                }

                RepeaterMore.DataSource = taglistMore;
                RepeaterMore.DataBind();
            }
            else
            {
                div_repeatermore.Visible = false;

            }
            */
            div_repeatermore.Visible = false;

            //            Repeater1.DataSource = (from row in DatabaseContext.Tags where row.ShowInTabs orderby row.OrderNumber select row).Take(7);
            //           Repeater1.DataBind();

            //List<Tag> taglist = (from row in DatabaseContext.Tags where row.ShowInTabs orderby row.OrderNumber select row).ToList();
            //taglist.Insert(0, allTag);

            //Repeater2.DataSource = taglist;
            //Repeater2.DataBind();

            if (!IsPostBack)
            {

                //TreeNode categoriesNode = new TreeNode("All");
                //categoriesNode.NavigateUrl = "javascript:onGalleryClick()";
                //categoriesNode.Expand();
                //List<Tag> listTags = (from t in DatabaseContext.Tags orderby t.Name select t).ToList();
                //foreach (Tag tag in listTags)
                //{
                //    TreeNode catNode = new TreeNode(tag.Name, tag.TagId.ToString());
                //    catNode.NavigateUrl = "javascript:onGalleryClick("+tag.TagId+")";
                //    catNode.CollapseAll();
                //    categoriesNode.ChildNodes.Add(catNode);
                //}
                //tvStructure.Nodes.Add(categoriesNode);
            }
        }