Example #1
0
    protected void ShowOrder_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowNumber = Convert.ToInt32(e.CommandArgument);
        int orderId   = Convert.ToInt32(ShowOrder.Rows[rowNumber].Cells[0].Text);

        Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
        if (e.CommandName == "SeeDetails")
        {
            DataSet ds = webser.GetDetailsAboutOrder(orderId);
            ShowDetails.Visible    = true;
            ShowDetails.DataSource = ds;
            ShowDetails.DataBind();
            for (int i = 0; i < ShowOrder.Rows.Count; i++)
            {
                ShowOrder.Rows[i].Font.Bold = false;
            }
            ShowOrder.Rows[rowNumber].Font.Bold = true;
        }
        if (e.CommandName == "DeleteOrder")
        {
            DateTime orderDate = Convert.ToDateTime(ShowOrder.Rows[rowNumber].Cells[2].ToString());
            if (orderDate.AddDays(2) < DateTime.Now)
            {
                webser.DeleteOrder(orderId);
                SortDDL_SelectedIndexChanged(sender, e);
            }
            else
            {
                Response.Write("<script>alert('לא ניתן לבטל את ההזמנה')</script>");
            }
        }
    }
Example #2
0
    protected void ShowOrder_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowNumber = Convert.ToInt32(e.CommandArgument);
        int orderId   = Convert.ToInt32(ShowOrder.Rows[rowNumber].Cells[0].Text);

        Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
        if (e.CommandName == "SendOrder")
        {
            webser.UpdateOrderSupplied(orderId);
            //show all the orders
            SortButton_Click(sender, e);
        }
        if (e.CommandName == "DeleteOrder")
        {
            webser.DeleteOrder(orderId);
            //show all the orders
            SortButton_Click(sender, e);
        }
        if (e.CommandName == "SeeDetails")
        {
            if (ShowDetails.Visible == false)
            {
                DataSet ds = webser.GetDetailsAboutOrder(orderId);
                ShowDetails.Visible    = true;
                ShowDetails.DataSource = ds;
                ShowDetails.DataBind();
                for (int i = 0; i < ShowOrder.Rows.Count; i++)
                {
                    ShowOrder.Rows[i].Font.Bold = false;
                }
                ShowOrder.Rows[rowNumber].Font.Bold = true;
            }
        }
    }