protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         grid.DataSource = CatalogAccess.GetAllMessages();
         grid.DataBind();
     }
 }
    protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string id = grid.DataKeys[e.RowIndex].Value.ToString();

        CatalogAccess.AdminDeleteProductReview(id);
        grid.EditIndex = -1;
        DenetimleriDoldur();
    }
    protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string id = grid.DataKeys[e.RowIndex].Value.ToString();

        CatalogAccess.AdminDeleteMessage(id);
        grid.EditIndex = -1;
        Response.Redirect("Messages.aspx");
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     // CatalogAccess.GetDepartments returns a DataTable object containing
     // department data, which is read in the ItemTemplate of the DataList
     list.DataSource = CatalogAccess.GetDepartments();
     // Needed to bind the data bound controls to the data source
     list.DataBind();
 }
Beispiel #5
0
        public void getFoodUnitTEST2()
        {
            string foodName     = "Onion rings";
            double unitExpected = 113;
            double unitActual   = CatalogAccess.getFoodUnit(foodName);

            Assert.AreEqual(unitExpected, unitActual);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Repeater1.DataSource = CatalogAccess.CustomersGetSliders();
         Repeater1.DataBind();
     }
 }
Beispiel #7
0
    // Create a new category
    protected void createCategory_Click(object sender, EventArgs e)
    {
        string departmentId = Request.QueryString["DepartmentID"];
        bool   success      = CatalogAccess.CreateCategory(departmentId, newName.Text, newDescription.Text);

        statusLabel.Text = success ? "Успешно създаване" : "Неуспешно създаване";

        BindGrid();
    }
Beispiel #8
0
    public static string ToProduct(string productId)
    {
        // prepare product URL name
        ProductDetails p           = CatalogAccess.GetProductDetails(productId.ToString());
        string         prodUrlName = PrepareUrlText(p.Name);

        // build product URL
        return(BuildAbsolute(String.Format("{0}-p{1}/", prodUrlName, productId)));
    }
Beispiel #9
0
    protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string id   = grid.DataKeys[e.RowIndex].Value.ToString();
        bool   stat = CatalogAccess.AdminDeleteProduct(id);

        grid.EditIndex = -1;
        lblStatus.Text = stat ? "Başarılı" : "Başarısız";
        BindGridView();
    }
Beispiel #10
0
        public void getFoodIDIDTEST2()
        {
            string FoodName       = "Onion rings";
            int    FoodIDExpected = 24;

            int FoodIDActual = CatalogAccess.getFoodID(FoodName);

            Assert.AreEqual(FoodIDExpected, FoodIDActual);
        }
Beispiel #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["CustomerID"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     calorie = CatalogAccess.getFoodCalorie(ddlFoodName.Text);
     unit    = CatalogAccess.getFoodUnit(ddlFoodName.Text);
 }
    protected void btnAddReview_Click(object sender, EventArgs e)
    {
        string customerID = Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey.ToString();
        string productID  = Request.QueryString["ProductID"];

        CatalogAccess.AddReview(customerID, productID, TextBox1.Text);

        Response.Redirect(HttpContext.Current.Request.RawUrl);
    }
 // delete a product from the catalog
 protected void deleteButton_Click(object sender, EventArgs e)
 {
     // Delete the product from the catalog
     CatalogAccess.DeleteProduct(currentProductId);
     // Need to go back to the categories page now
     Response.Redirect(Request.ApplicationPath + "/CatalogAdmin.aspx" +
                       "?DepartmentID=" + currentDepartmentId +
                       "&CategoryID=" + currentCategoryId);
 }
Beispiel #14
0
    private void PopulateControls()
    {
        // Retrieve DepartmentID from the query string
        string departmentId = Request.QueryString["DepartmentID"];
        // Retrieve CategoryID from the query string
        string categoryId = Request.QueryString["CategoryID"];
        // Retrieve Page from the query string
        string page = Request.QueryString["Page"];

        if (page == null)
        {
            page = "1";
        }
        // How many pages of products?
        int howManyPages = 1;
        // pager links format
        string firstPageUrl = "";
        string pagerFormat  = "";

        // If browsing a category...
        if (categoryId != null)
        {
            // Retrieve list of products in a category
            list.DataSource =
                CatalogAccess.GetProductsInCategory(categoryId, page, out howManyPages);
            list.DataBind();
            // get first page url and pager format
            firstPageUrl = Link.ToCategory(departmentId, categoryId, "1");
            pagerFormat  = Link.ToCategory(departmentId, categoryId, "{0}");
        }
        else if (departmentId != null)
        {
            // Retrieve list of products on department promotion
            list.DataSource = CatalogAccess.GetProductsOnDeptPromo
                                  (departmentId, page, out howManyPages);
            list.DataBind();
            // get first page url and pager format
            firstPageUrl = Link.ToDepartment(departmentId, "1");
            pagerFormat  = Link.ToDepartment(departmentId, "{0}");
        }
        else
        {
            // Retrieve list of products on catalog promotion
            list.DataSource =
                CatalogAccess.GetProductsOnFrontPromo(page, out howManyPages);
            list.DataBind();
            // have the current page as integer
            int currentPage = Int32.Parse(page);
        }
        // Display pager controls
        topPager.Show(int.Parse(page), howManyPages, firstPageUrl, pagerFormat,
                      true);
        bottomPager.Show(int.Parse(page), howManyPages, firstPageUrl,
                         pagerFormat,
                         true);
    }
Beispiel #15
0
        public void convertSystemPlanToUserPlanTEST()
        {
            int    PlanID               = 9;
            int    CustID               = 1;
            String planDesc             = "for 3000 calories";
            int    rowsAffectedExpected = 131;
            int    rowsAffectedActual   = CatalogAccess.convertSystemPlanToUserPlan(PlanID, CustID, planDesc);

            Assert.AreEqual(rowsAffectedExpected, rowsAffectedActual);
        }
Beispiel #16
0
        public void getMealCalorieTEST()
        {
            string day             = "Monday";
            int    PlanID          = 2;
            string MealType        = "Breakfast";
            double calorieExpected = 400;
            double calorieActual   = CatalogAccess.getMealCalorie(day, PlanID, MealType);

            Assert.AreEqual(calorieExpected, calorieActual);
        }
Beispiel #17
0
    public static DataTable GetItems()
    {
        DbCommand command = DataAccess.CreateCommand();

        command.CommandText = "CartGetItems";

        command.Parameters.Add(CatalogAccess.NewParameter("@CartID", cartID, DbType.String, 36, command));

        return(DataAccess.ExecuteSelectedCommand(command));
    }
Beispiel #18
0
    protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string id      = grid.DataKeys[e.RowIndex].Value.ToString();
        bool   success = CatalogAccess.DeleteCategory(id);

        grid.EditIndex   = -1;
        statusLabel.Text = success ? "Успешно изтриване" : "Неуспешно изтриване";

        BindGrid();
    }
Beispiel #19
0
    public static decimal GetTotalAmount()
    {
        DbCommand command = DataAccess.CreateCommand();

        command.CommandText = "CartGetTotalAmount";

        command.Parameters.Add(CatalogAccess.NewParameter("@CartID", cartID, DbType.String, 36, command));

        return(Convert.ToDecimal(DataAccess.ExecuteScalar(command)));
    }
    // Create a new department
    protected void createDepartment_Click(object sender, EventArgs e)
    {
        // Execute the insert command
        bool success = CatalogAccess.AddDepartment(newName.Text, newDescription.Text);

        // Display status message
        statusLabel.Text = success ? "Insert successful" : "Insert failed";
        // Reload the grid
        BindGrid();
    }
Beispiel #21
0
    public static DataTable GetOrdersByRecent(int cout)
    {
        DbCommand command = DataAccess.CreateCommand();

        command.CommandText = "AdminGetOrdersByRecent";

        command.Parameters.Add(CatalogAccess.NewParameter("@Count", cout.ToString(), DbType.Int32, -1, command));

        return(DataAccess.ExecuteSelectedCommand(command));
    }
Beispiel #22
0
    public static void OrderMarkCanceled(string orderID)
    {
        DbCommand cmd = DataAccess.CreateCommand();

        cmd.CommandText = "AdminOrderMarkCanceled";

        cmd.Parameters.Add(CatalogAccess.NewParameter("@OrderID", orderID, DbType.Int32, -1, cmd));

        DataAccess.ExecuteNonQuery(cmd);
    }
Beispiel #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Repeater1.DataSource = CatalogAccess.GetCategories();
         Repeater1.DataBind();
     }
     //DataList1.DataSource = CatalogAccess.GetCatagories();
     //DataList1.DataBind();
 }
        protected void createDepartment_Click(object sender, EventArgs e)
        {
            // Execute the insert command
            bool success = CatalogAccess.AddDepartment(newName.Text, newDescription.Text);

            // Display status message
            lblStatus.Text = success ? "Въвеждането успешно" : "Въеждането неуспешно";
            // Reload the grid
            BindGrid();
        }
Beispiel #25
0
    public static void AdminProductReviewMarkVerified(string reviewID)
    {
        DbCommand cmd = DataAccess.CreateCommand();

        cmd.CommandText = "AdminProductReviewMarkVerified";

        cmd.Parameters.Add(CatalogAccess.NewParameter("@ReviewID", reviewID, DbType.Int32, -1, cmd));

        DataAccess.ExecuteNonQuery(cmd);
    }
    // Populate the GridView with data
    private void BindGrid()
    {
        // Get DepartmentID from the query string
        string departmentId = Request.QueryString["DepartmentID"];

        // Get a DataTable object containing the categories
        grid.DataSource = CatalogAccess.GetCategoriesInDepartment(departmentId);
        // Bind the data grid to the data source
        grid.DataBind();
    }
Beispiel #27
0
    public static DataTable GetOrderDetails(string orderID)
    {
        DbCommand cmd = DataAccess.CreateCommand();

        cmd.CommandText = "AdminGetOrderDetails";

        cmd.Parameters.Add(CatalogAccess.NewParameter("@OrderID", orderID, DbType.Int32, -1, cmd));

        return(DataAccess.ExecuteSelectedCommand(cmd));
    }
    protected void addReviewButton_Click(object sender, EventArgs e)
    {
        string customerId = Membership.GetUser(
            HttpContext.Current.User.Identity.Name)
                            .ProviderUserKey.ToString();
        string productId = Request.QueryString["ProductID"];

        CatalogAccess.AddReview(customerId, productId, reviewTextBox.Text, ratingBox.SelectedValue);
        Response.Redirect(HttpContext.Current.Request.RawUrl);
    }
Beispiel #29
0
    // Populate the GridView with data
    private void BindGrid()
    {
        // Get CategoryID from the query string
        string categoryId = Request.QueryString["CategoryID"];

        // Get a DataTable object containing the products
        grid.DataSource = CatalogAccess.GetAllProductsInCategory(categoryId);
        // Needed to bind the data bound controls to the data source
        grid.DataBind();
    }
Beispiel #30
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string Name        = txtAddName.Text;
        string Description = txtAddDescription.Text;
        bool   stat        = CatalogAccess.AdminAddCategory(Name, Description);

        // lblStatus.Text = Description;
        lblStatus.Text = stat ? "Başarılı" : "Başarısız";
        BindGridView();
    }