public ActionResult MyOrders()
        {
            Farmer      f = (Farmer)Session["Farmer"];
            PacketOrder p = new PacketOrder();

            p.FarmerID = f.FarmerID;
            DataTable dt = p.selectByFarmerIDAndStatus("SUBMITTED");

            return(View(dt));
        }
        public ActionResult OrderSummary()
        {
            Farmer      f = (Farmer)Session["Farmer"];
            PacketOrder p = new PacketOrder();

            p.FarmerID = f.FarmerID;
            DataTable dt = p.selectByFarmerIDAndStatus("PENDING");

            return(View(dt));
        }
        public ActionResult Checkout()
        {
            if (Session["Farmer"] != null)
            {
                Farmer      f  = (Farmer)Session["Farmer"];
                PacketOrder po = new PacketOrder();
                po.FarmerID = f.FarmerID;
                DataTable dt         = po.selectByFarmerIDAndStatus("PENDING");
                String    allpackets = "";
                double    totalprice = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    String packetname    = dr["Title"].ToString();
                    String qty           = dr["Qty"].ToString();
                    String netprice      = dr["NetPrice"].ToString();
                    String farmername    = f.Name;
                    String farmeremail   = f.Email;
                    String retailername  = dr["RetailerName"].ToString();
                    String retaileremail = dr["RetailerEmail"].ToString();
                    String PacketPhoto   = dr["Photo"].ToString();

                    SendEmail(retaileremail, "New Order Received from Agri Store !!!", "Order from " + farmername + ", \n" + packetname + "(QTY: " + qty + ")" + " = Rs. " + netprice);

                    allpackets += "\n" + packetname + "(QTY = " + qty + ")" + " = Rs. " + netprice;
                    totalprice += Convert.ToSingle(netprice);
                }



                // Email to 1 Farmer
                SendEmail(f.Email, "Thank you!", "Thank You " + f.Name + " for shopping with Agri Store!" + "\n" + allpackets + "\n\n\nTotal Price = " + totalprice);
                // Conbvert order to submitted
                f.MarkAllAsCheckedOut();
            }



            return(RedirectToAction("MyOrders", "Farmer"));
        }