Ejemplo n.º 1
0
    protected void btn_Accepted_Click(object sender, EventArgs e)
    {
        // Get button from the gridview, sender is the object of the butotn
        Button btn = (Button)sender;

        // Gets the row of the button in the gridview
        GridViewRow gvr = (GridViewRow)btn.NamingContainer;


        // Gets the order id from the gridview
        string order_id = gvr.Cells[0].Text;

        // Create object and use the method
        OrderDriver orders = new OrderDriver();
        int         result = orders.orderUpdateStatus(order_id, "Completed");



        //Reload the table
        bind(); // NOTE THAT WHEN YOU UPDATE TO ACCEPTED, IT WILL NOT SHOW ON DRIVER.ASPX BECAUSE BIND() VARIABLE IS "NEW" (Line 21)


        //NEW PLAN
        //click pickup update status to collected

        //BELOW IS OLD PLAN

        /*
         * Session["orderID"] = 1; //change 1 to order id of the row you click
         * Session["hello"] = "pickup";
         *
         *
         * //in other aspx.cs page_load
         * if(Session["hello"].Equals("pickup"))
         * {
         *  //display all the pickup info
         * }
         * else if (Session["hello"].Equals("delivery"))
         * { //display all the pickup info
         *
         * }
         */
    }
Ejemplo n.º 2
0
    protected void btn_Accepted_Click(object sender, EventArgs e)
    {
        // Get button from the gridview, sender is the object of the butotn
        Button btn = (Button)sender;

        // Gets the row of the button in the gridview
        GridViewRow gvr = (GridViewRow)btn.NamingContainer;


        // Gets the order id from the gridview
        string order_id = gvr.Cells[0].Text;

        // Create object and use the method
        OrderDriver orders = new OrderDriver();
        int         result = orders.orderUpdateStatus(order_id, "Completed");

        string email;

        /*
         * Open database and using customer pk to find it
         *         string customer_ID = gvr.Cells[3].Text;
         *         customer.getcustomer(customer_Id); //get single customer data out from database
         *         email = customer.email.tostring(); // make string email to the customer email
         * */
        Email_orderDriver Eo          = new Email_orderDriver();
        string            customer_ID = gvr.Cells[3].Text;
        Email_orderDriver customer    = Eo.getOrder(customer_ID);

        email = customer.email.ToString();

        //Response.Write(String.Format("<script>alert('{0}');</script>", email));

        if (result > 0)
        { // If validated properly
            Response.Write("<script>alert('Product updated');</script>");

            //ADD EMAIL HERE
            string psender = "*****@*****.**";
            string subject = "Order Completed";
            string body    = "Order have been Completed. Enjoy";

            try
            {
                MailMessage message = new MailMessage(psender, email, subject, body);
                message.IsBodyHtml = true;

                SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                client.EnableSsl   = true;
                client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Ebusiness");
                client.Send(message);
            }
            catch (Exception ex)
            {
            }
        }
        else
        { // If something went wrong
            Response.Write("<script>alert('Product NOT updated');</script>");
        }

        //Reload the table
        bind(); // NOTE THAT WHEN YOU UPDATE TO ACCEPTED, IT WILL NOT SHOW ON DRIVER.ASPX BECAUSE BIND() VARIABLE IS "NEW" (Line 21)


        //NEW PLAN
        //click pickup update status to collected

        //BELOW IS OLD PLAN

        /*
         * Session["orderID"] = 1; //change 1 to order id of the row you click
         * Session["hello"] = "pickup";
         *
         *
         * //in other aspx.cs page_load
         * if(Session["hello"].Equals("pickup"))
         * {
         *  //display all the pickup info
         * }
         * else if (Session["hello"].Equals("delivery"))
         * { //display all the pickup info
         *
         * }
         */
    }
Ejemplo n.º 3
0
    protected void btn_Rejected_Click(object sender, EventArgs e)
    {
        // Get button from the gridview, sender is the object of the butotn
        Button btn = (Button)sender;

        // Gets the row of the button in the gridview
        GridViewRow gvr = (GridViewRow)btn.NamingContainer;


        // Gets the order id from the gridview
        string order_id = gvr.Cells[0].Text;

        // Create object and use the method
        OrderDriver orders = new OrderDriver();
        int         result = orders.orderUpdateStatus(order_id, "REJECTED");

        string email;

        /*
         * Open database and using customer pk to find it
         *         string customer_ID = gvr.Cells[3].Text;
         *         customer.getcustomer(customer_Id); //get single customer data out from database
         *         email = customer.email.tostring(); // make string email to the customer email
         * */
        Email_orderDriver Eo          = new Email_orderDriver();
        string            customer_ID = gvr.Cells[3].Text;
        Email_orderDriver customer    = Eo.getOrder(customer_ID);

        email = customer.email.ToString();

        //Response.Write(String.Format("<script>alert('{0}');</script>", email));

        if (result > 0)
        { // If validated properly
            Response.Write("<script>alert('Product updated');</script>");

            //ADD EMAIL HERE
            string psender = "*****@*****.**";
            string subject = "Found Driver";
            string body    = "Order have been cancel. Please try again later";

            try
            {
                MailMessage message = new MailMessage(psender, email, subject, body);
                message.IsBodyHtml = true;

                SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                client.EnableSsl   = true;
                client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Ebusiness");
                client.Send(message);
            }
            catch (Exception ex)
            {
            }
        }
        else
        { // If something went wrong
            Response.Write("<script>alert('Product NOT updated');</script>");
        }

        //Reload the table
        bind(); // NOTE THAT WHEN YOU UPDATE TO ACCEPTED, IT WILL NOT SHOW ON DRIVER.ASPX BECAUSE BIND() VARIABLE IS "NEW" (Line 21)
    }