Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
         ReviewsGridView.DataSource = db.Reviews.ToList();
         ReviewsGridView.DataBind();
     }
 }
        protected void OSbtnSave_Click(object sender, EventArgs e)
        {
            DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
            Article story = db.Articles.Where(x => x.position == "operation").FirstOrDefault();

            db.Articles.Remove(story);

            db.Articles.Add(new Article {
                Id = 4, Body = Body.Text, position = "operation", description = "Operation hours"
            });
            db.SaveChanges();
            Response.Redirect("~/Admin/OpHoursAdminEdit.aspx");
        }
Exemplo n.º 3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
     if (Request.Params["id"] != null)
     {
         Guid     id   = Guid.Parse(Request.Params["id"]);
         FoodMenu item = db.FoodMenus.Where(x => x.Id == id).FirstOrDefault();
         db.FoodMenus.Remove(item);
     }
     DAL.FoodMenu data = fillItems();
     db.FoodMenus.Add(data);
     db.SaveChanges();
     Response.Redirect("~/Admin/FoodMenuAdmin.aspx");
 }
 private void loadData(string p)
 {
     if (Guid.TryParse(p, out Guid _id))
     {
         DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
         FoodCategory data            = db.FoodCategories.Where(x => x.Id == _id).FirstOrDefault();
         if (data != null)
         {
             lblID.Text    = data.Id.ToString();
             txtName.Text  = data.Name;
             txtTitle.Text = data.Description;
         }
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
            if (Request.Params["id"] != null)
            {
                var id  = Guid.Parse(Request.Params["id"]);
                var Cat = db.FoodCategories.Where(x => x.Id == id).FirstOrDefault();
                db.FoodCategories.Remove(Cat);
            }
            FoodCategory data = FillCat();

            db.FoodCategories.Add(data);
            db.SaveChanges();
            Response.Redirect("~/Admin/CategoryAdmin.aspx");
        }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
         drpFoodCats.Items.Clear();
         drpFoodCats.DataSource     = db.FoodCategories.ToList();
         drpFoodCats.DataTextField  = "Name";
         drpFoodCats.DataValueField = "Id";
         drpFoodCats.DataBind();
         if (Request.Params["id"] != null)
         {
             loadData(Request.Params["id"]);
         }
     }
 }
Exemplo n.º 7
0
 protected void ReviewsGridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Edit")
     {
         Response.Redirect("~/Admin/ReviewsAdminEdit.aspx?id=" + e.CommandArgument);
     }
     else if (e.CommandName == "del")
     {
         DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
         Guid    _id    = new Guid(e.CommandArgument.ToString());
         Reviews review = db.Reviews.Where(x => x.Id == _id).FirstOrDefault();
         db.Reviews.Remove(review);
         db.SaveChanges();
         ReviewsGridView.DataSource = db.Reviews.ToList();
         ReviewsGridView.DataBind();
     }
 }
Exemplo n.º 8
0
 protected void FoodGridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Edit")
     {
         Response.Redirect("~/Admin/FoodMenuAdminEdit.aspx?id=" + e.CommandArgument);
     }
     else if (e.CommandName == "del")
     {
         DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
         Guid _id  = Guid.Parse(e.CommandArgument.ToString());
         var  item = db.FoodMenus.Where(x => x.Id == _id).FirstOrDefault();
         db.FoodMenus.Remove(item);
         db.SaveChanges();
         FoodGridView.DataSource = db.FoodMenus.ToList();
         FoodGridView.DataBind();
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
            Article lftImg = db.Articles.Where(x => x.position == "left").FirstOrDefault();

            DAL.Image image = db.Images.Where(x => x.Id == lftImg.imageId).FirstOrDefault();
            db.Images.Remove(image);
            DAL.Image data = FillSliders();
            db.Images.Add(data);
            db.SaveChanges();
            db.Articles.Remove(lftImg);
            db.Articles.Add(new Article {
                Id = 2, imageId = data.Id, position = "left", title = "Left Image Body"
            });
            db.SaveChanges();
            Response.Redirect("~/Admin/LftBdyImgAdminEdit.aspx");
        }
Exemplo n.º 10
0
 private void loadData(string p)
 {
     if (Guid.TryParse(p, out Guid _id))
     {
         DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
         DAL.FoodMenu item            = db.FoodMenus.Where(x => x.Id == _id).FirstOrDefault();
         if (item != null)
         {
             lblID.Text                = item.Id.ToString();
             txtTitle.Text             = item.Name;
             txtDescription.Text       = item.Description;
             txtPrice.Text             = item.Price.ToString();
             txtOrder.Text             = item.MENU_ORDER.ToString();
             drpFoodCats.SelectedValue = item.CategoryID.ToString();
         }
     }
 }
Exemplo n.º 11
0
 protected void SlidersGridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Edit")
     {
         Response.Redirect("~/Admin/SliderAdminEdit.aspx?id=" + e.CommandArgument);
     }
     else if (e.CommandName == "del")
     {
         DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
         int _id    = int.Parse(e.CommandArgument.ToString());
         var slider = db.Sliders.Where(x => x.Id == _id).FirstOrDefault();
         var image  = db.Images.Where(x => x.Id == slider.ImageId).FirstOrDefault();
         db.Images.Remove(image);
         db.Sliders.Remove(slider);
         db.SaveChanges();
         SlidersGridView.DataSource = db.Sliders.ToList();
         SlidersGridView.DataBind();
     }
 }
Exemplo n.º 12
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
     if (Request.Params["id"] != null)
     {
         var id     = int.Parse(Request.Params["id"]);
         var slider = db.Sliders.Where(x => x.Id == id).FirstOrDefault();
         var image  = db.Images.Where(x => x.Id == slider.ImageId).FirstOrDefault();
         db.Images.Remove(image);
         db.Sliders.Remove(slider);
     }
     DAL.Image data = fillSliders();
     db.Images.Add(data);
     db.SaveChanges();
     db.Sliders.Add(new Slider {
         ImageId = data.Id, Active = chkActive.Checked
     });
     db.SaveChanges();
     Response.Redirect("~/Admin/SliderAdmin.aspx");
 }
Exemplo n.º 13
0
        protected void isActive_CheckedChanged(object sender, EventArgs e)
        {
            DAL.CrimsonCowardEntities db = new DAL.CrimsonCowardEntities();
            CheckBox check   = (CheckBox)sender;
            string   checkId = check.Attributes["reviewid"];

            if (checkId != null)
            {
                Guid    id      = new Guid(checkId);
                Reviews reviews = db.Reviews.Where(x => x.Id == id).FirstOrDefault();
                db.Reviews.Remove(reviews);
                db.SaveChanges();
                if (reviews.IsActive == true)
                {
                    reviews.IsActive = false;
                }
                else
                {
                    reviews.IsActive = true;
                }
                db.Reviews.Add(reviews);
                db.SaveChanges();
            }
        }