Ejemplo n.º 1
0
 public void ProcessRequest(HttpContext context)
 {
     long id = 0;
     long.TryParse(context.Request.QueryString["id"], out id);
     if (id > 0)
     {
         using (var ec = new EasyContext())
         {
             context.Response.ContentType = "image/jpeg";
             var img = Bitmap.FromStream(new MemoryStream(ec.ListingImages.Where(i => i.ID == id).FirstOrDefault().ImageData));
             img.Save(context.Response.OutputStream, ImageFormat.Jpeg);
         }
     }
     else
     {
         long.TryParse(context.Request.QueryString["shopimageid"], out id);
         if (id > 0)
         {
             using (var ec = new EasyContext())
             {
                 context.Response.ContentType = "image/jpeg";
                 var img = Bitmap.FromStream(new MemoryStream(ec.ShopImages.Where(i => i.ID == id).FirstOrDefault().ImageData));
                 img.Save(context.Response.OutputStream, ImageFormat.Jpeg);
             }
         }
     }
 }
Ejemplo n.º 2
0
        protected void RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            var user = Membership.GetUser(RegisterUser.UserName);
            using(var ec = new EasyContext())
            {
                ec.Shops.Add(new Shop() { AccountID = (Guid)user.ProviderUserKey, Name = user.UserName });
                ec.SaveChanges();
            }

            try { SendRegistrationEmail(user); }catch{ }

            FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */);

            string continueUrl = RegisterUser.ContinueDestinationPageUrl;
            if (String.IsNullOrEmpty(continueUrl))
            {
                continueUrl = "~/";
            }
            Response.Redirect(continueUrl);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using(var ec = new EasyContext())
            {
                categoryListing.DataSource = ec.Categories
                    .Where(c => c.ListingItems.Where(i=>!i.IsSold).Count() > 0)
                    .OrderBy(c => c.Name)
                    .Select(c => new { ID = c.ID, Name = c.Name, Count = c.ListingItems.Where(i => !i.IsSold).Count() }).ToList();
                categoryListing.DataBind();

                featuredListing.DataSource = ec.ListingItems
                    .Where(i => i.IsFeatured && i.IsSold == false && i.Images.Count > 0)
                    .OrderByDescending(i => i.CreatedOn)
                    .Take(4)
                    .Select(i => new { ID = i.ID, Title = i.Title, Price = i.Price, ImageID = i.Images.FirstOrDefault().ID })
                    .ToList();
                featuredListing.DataBind();
                featuredContainer.Visible = featuredListing.Items.Count > 0;
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var ec = new EasyContext())
            {
                List<char> alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToList();
                int columnIndex = 0;
                HtmlTableCell[] column = new HtmlTableCell[] { col0, col1, col2, col3 };
                for (int i = 0; i < alpha.Count; i++)
                {
                    string a = alpha[i].ToString();
                    if (ec.Shops.Where(s => s.Name.StartsWith(a)).Count() > 0)
                    {
                        column[columnIndex].InnerHtml += alpha[i] + "<br/>";
                        ec.Shops
                            .Where(s => s.Name.StartsWith(a))
                            .ToList()
                            .ForEach(s => column[columnIndex].InnerHtml += "<a href=\"shopdetails.aspx?id=" + s.ID + "\">" + s.Name + "</a><br/>");
                        columnIndex++;
                        if (columnIndex > 3) columnIndex = 0;
                    }
                }

            }
        }