Ejemplo n.º 1
0
 public Present GetPresent(int PresentID)
 {
     using (WeddingContext WeddingContext = new WeddingContext())
     {
         var result = WeddingContext.Presents
                      .Where(x => x.PresentID == PresentID)
                      .ToList().Select(x => new Present()
         {
             ProductID     = x.ProductID,
             PresentListID = x.PresentListID,
             PresentID     = x.PresentID,
             Status        = x.Status,
             Product       = new Product()
             {
                 Id          = x.Product.Id,
                 Brand       = x.Product.Brand,
                 Category    = x.Product.Category,
                 Description = x.Product.Description,
                 ImageName   = x.Product.ImageName,
                 Name        = x.Product.Name,
                 Price       = x.Product.Price,
                 Stock       = x.Product.Stock
             }
         }).ToList().FirstOrDefault();
         return(result);
     }
 }
Ejemplo n.º 2
0
 public Product GetProduct(int ProductID)
 {
     using (WeddingContext WeddingContext = new WeddingContext())
     {
         return(WeddingContext.Products.Find(ProductID));
     }
 }
Ejemplo n.º 3
0
 public IEnumerable<RSVP> GetAllRsvps()
 {
     using (var context = new WeddingContext())
     {
         return context.Rsvps.ToList();
     }
 }
Ejemplo n.º 4
0
 public void AddRsvpItem(RSVP rsvp)
 {
     using (var context = new WeddingContext())
     {
         context.Rsvps.Add(rsvp);
         context.SaveChanges();
     }
 }
Ejemplo n.º 5
0
 public bool Add(Dedicatory dedicatory)
 {
     using (WeddingContext weddingContext = new WeddingContext())
     {
         weddingContext.Dedicatories.Add(dedicatory);
         weddingContext.SaveChanges();
         return(dedicatory.DedicatoryID > 0);
     }
 }
Ejemplo n.º 6
0
 public Present UpdatePresent(Present present)
 {
     using (WeddingContext WeddingContext = new WeddingContext())
     {
         var updatePresentProductList = WeddingContext.Presents.Find(present.PresentID);
         updatePresentProductList.Status = present.Status;
         WeddingContext.SaveChanges();
         return(updatePresentProductList);
     }
 }
Ejemplo n.º 7
0
        public bool DeletePresent(int presentListID, int productID)
        {
            using (WeddingContext WeddingContext = new WeddingContext())
            {
                var productDelete = WeddingContext.Presents.Where(present => present.PresentListID == presentListID && present.ProductID == productID).First();
                WeddingContext.Presents.Remove(productDelete);

                return(WeddingContext.SaveChanges() > 0);
            };
        }
Ejemplo n.º 8
0
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        using (WeddingContext db = WeddingContext.New())
        {
            Debug.Assert(db.DatabaseExists());
            Debug.Assert(guestID != Guid.Empty);

            var query = from b in db.Guest
                        where b.GuestID == guestID
                        select b;

            Guest guest1 = query.Single();

            //if( !this.IsLodging )
            //{
            //	guest1._NeedAccommodations = Byte.Parse( this.RadioAccommodations.SelectedValue );
            //}
            guest1._Count      = Byte.Parse(this.RadioCount.SelectedValue);
            guest._Count       = Byte.Parse(this.RadioCount.SelectedValue);
            guest1._ArrivalDay = this.RadioArrival.SelectedValue;

            if (!String.IsNullOrEmpty(this.RadioTravel.SelectedValue))
            {
                guest1._Travel = Byte.Parse(this.RadioTravel.SelectedValue);
            }
            guest1._Notes    = this.TextBoxNotes.Text;
            guest1._RsvpDate = DateTime.Now;
            db.SubmitChanges();
        }

        if (this.IsAttending)
        {
            this.DivRsvpArrivalTravel.Visible = true;
            if (this.Lodging == LodgingEnum.ResortAssigned)
            {
                this.DivAccommodationsResort.Visible = true;
                this.DivAccommodationsOther.Visible  = false;
            }
            else
            {
                this.DivAccommodationsResort.Visible = false;
                this.DivAccommodationsOther.Visible  = true;
            }
        }
        else
        {
            this.DivRsvpArrivalTravel.Visible    = false;
            this.DivAccommodationsResort.Visible = false;
            this.DivAccommodationsOther.Visible  = false;
        }

        this.LabelSavedMessage.Text = "Got it -- thanks for letting us know!";
    }
Ejemplo n.º 9
0
    protected void ButtonLookup_Click(object sender, EventArgs e)
    {
        using (WeddingContext db = WeddingContext.New())
        {
            Debug.Assert(db.DatabaseExists());

            String searchString = this.TextBoxPartyName.Text.Trim()
                                  .Replace(" and ", " & ")
                                  .Replace(" + ", " & ");

            // Find person from db
            var query = from b in db.Guest
                        where b.GuestName == searchString &&
                        b.ZipCode == this.TextBoxZipCode.Text.Trim()
                        select b;

            guest = query.SingleOrDefault();

            if (guest != null)
            {
                HydrateElements();
                //HydrateCountList();
                //this.DivRsvpFindGuest.Visible = false;
                //this.DivRsvpDetails.Visible = true;

                //Session[ "GuestID" ] = guest.GuestID.ToString();

                //if( guest._Count.HasValue )
                //{
                //	// Guest has already RSVP'd, this is an update
                //	this.RadioCount.SelectedIndex = guest._Count.Value;
                //	this.RadioAccommodations.SelectedValue = guest._NeedAccommodations?.ToString();
                //	this.RadioArrival.SelectedValue = guest._ArrivalDay;
                //	this.RadioTravel.SelectedValue = guest._Travel?.ToString();
                //	this.TextBoxNotes.Text = guest._Notes;
                //	this.HyperLinkLodging.Text = guest.Lodging;
                //	this.HyperLinkLodging.NavigateUrl = guest.LodgingUri;
                //	this.LabelCost.Text = guest.Cost.ToString();
                //	this.LabelPaymentReceived.Text = ( guest.IsPaid.HasValue && guest.IsPaid.Value )
                //									? "<span style=\"color:green;font-weight:bold;font-size:14pt;\">Yes!</span></br>Thank you! :)"
                //									: "<span style=\"color:red;font-weight:bold;font-size:14pt;\">No</span></br>(Please PayPal to [email protected]<br/>so we can pay the resort)";
                //}
            }
            else
            {
                this.DivWarning.Visible = true;
                this.LabelWarning.Text  = @"Hmmm, we can't seem to figure out who you are.  Please make sure
										you're typing in your name and ZIP exactly as it appears on your envelope.
										Please try again, or else shoot Dave or Ellen an email, sorry for the pain!"                                        ;
            }
        }
    }
Ejemplo n.º 10
0
        public Product UpdateProduct(Product product, int quantity)
        {
            using (WeddingContext WeddingContext = new WeddingContext())
            {
                var productFound = WeddingContext.Products.Find(product.Id);

                productFound.Stock = quantity;

                WeddingContext.SaveChanges();

                return(productFound);
            }
        }
Ejemplo n.º 11
0
        public bool AddPresentList(List <Present> presents)
        {
            using (WeddingContext WeddingContext = new WeddingContext())
            {
                int changes = 0;

                foreach (var present in presents)
                {
                    WeddingContext.Presents.Add(present);

                    changes += WeddingContext.SaveChanges();
                }

                return(changes > 0);
            };
        }
Ejemplo n.º 12
0
        public Product UpdateProduct(Product product)
        {
            using (WeddingContext WeddingContext = new WeddingContext())
            {
                var productFound = WeddingContext.Products.Find(product.Id);

                productFound.Stock       = product.Stock;
                productFound.Brand       = product.Brand;
                productFound.Category    = product.Category;
                productFound.Description = product.Description;
                productFound.Id          = product.Id;
                productFound.ImageName   = product.ImageName;
                productFound.Name        = product.Name;
                productFound.Price       = product.Price;

                WeddingContext.SaveChanges();

                return(productFound);
            }
        }
Ejemplo n.º 13
0
        public static void SeeMenuOptions(this WeddingContext context)
        {
            context.Database.EnsureCreated();

            if (context.MenuOptions.Any())
            {
                return;
            }

            var menuOptions = new MenuOption[]
            {
                new MenuOption {
                    Name = "Brisket Sandwich", Caterer = "Oakmont BBQ"
                },
                new MenuOption {
                    Name = "Pulled Pork Nachos", Caterer = "Oakmont BBQ"
                },
                new MenuOption {
                    Name = "Brisket Mac", Caterer = "Oakmont BBQ"
                },
                new MenuOption {
                    Name = "St Louis Ribs", Caterer = "Oakmont BBQ"
                },
                new MenuOption {
                    Name = "Salmon Poke", Caterer = "Chop Shop"
                },
                new MenuOption {
                    Name = "Chicken Kale Caesar", Caterer = "Chop Shop"
                },
                new MenuOption {
                    Name = "Glorious Steak", Caterer = "Chop Shop"
                },
                new MenuOption {
                    Name = "Hearty Vegan", Caterer = "Chop Shop"
                }
            };

            Array.ForEach(menuOptions, x => context.MenuOptions.Add(x));
            context.SaveChanges();
        }
Ejemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Session["GuestID"] = null;
        }
        else
        {
            if (Session["GuestID"] != null)
            {
                if (!Guid.TryParse(Session["GuestID"].ToString(), out guestID))
                {
                    Debug.Fail("Invalid guid");
                }
                Debug.Assert(guestID != Guid.Empty);
            }

            if (guestID != Guid.Empty && guest == null)
            {
                using (WeddingContext db = WeddingContext.New())
                {
                    Debug.Assert(db.DatabaseExists());
                    Debug.Assert(guestID != Guid.Empty);

                    // Find person from db
                    var query = from b in db.Guest
                                where b.GuestID == guestID
                                select b;

                    guest = query.SingleOrDefault();
                }
            }

            if (guest != null)
            {
                HydrateCountList();
                // HydrateElements();
            }
        }
    }
Ejemplo n.º 15
0
 public ProductsRepository()
 {
     weddingContext = new WeddingContext();
 }
Ejemplo n.º 16
0
 public HomeController(WeddingContext context)
 {
     _dbContext = context;
 }
Ejemplo n.º 17
0
 public DashboardController(WeddingContext context)
 {
     _context = context;
 }
Ejemplo n.º 18
0
 public CouplesRepository()
 {
     weddingContext = new WeddingContext();
 }
Ejemplo n.º 19
0
 public GuestsController(WeddingContext context)
 {
     _context = context;
 }
Ejemplo n.º 20
0
 public AllWeddingsController(WeddingContext context)
 {
     _context = context;
 }
Ejemplo n.º 21
0
// Controller Constructor sets context file to db
//   - Creates a new controller object everytime a function is run
        public LogRegController(WeddingContext context)
        {
            db = context;
        }
Ejemplo n.º 22
0
 public UserController(WeddingContext context)
 {
     _context = context;
 }
Ejemplo n.º 23
0
 public WeddingController(WeddingContext wc)
 {
     context = wc;
 }
Ejemplo n.º 24
0
 public DashboardController(WeddingContext wcontext)
 {
     _wcontext = wcontext;
 }
Ejemplo n.º 25
0
 public AccountsRepository()
 {
     weddingContext = new WeddingContext();
 }
Ejemplo n.º 26
0
 public EventsController(WeddingContext context)
 {
     _context = context;
 }
Ejemplo n.º 27
0
 public WeddingController(WeddingContext context)
 {
     dbContext = context;
 }
Ejemplo n.º 28
0
 public WeddingRolesController(WeddingContext context)
 {
     _context = context;
 }
Ejemplo n.º 29
0
 public LoginController(WeddingContext context)
 {
     _context = context;
 }
 public RegistriesController(WeddingContext context)
 {
     _context = context;
 }