public void SendEmailToSupplier(int empid, string body, string subject)
        {
            PurchaseOrderBLL pobll = new PurchaseOrderBLL();

            EmployeeBLL empbll = new EmployeeBLL();
            Employee currentuser = new Employee();
            currentuser = empbll.GetEmployeeById(empid);

            Supplier toSupplier = new Supplier();
            toSupplier = supbll.GetSupplierByName(ddlSupplierList.SelectedValue);

            string bodymsg = "Purchase Order Number: " + poNum + "<br/>" + body + "<br/>With Regards,<br/>" + currentuser.EmployeeName;

            pobll.SendEmailToSupplier(toSupplier.Email, currentuser.Email, bodymsg, subject);
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //int orderBy = Convert.ToInt32(Session["LoginUser"].ToString());  //need to change later. has to be the login user
            int orderBy = Convert.ToInt32(Session["loginUser"]);
            DateTime orderDate = DateTime.Today;
            DateTime reqDate = DateTime.Parse(txtRequestDeliveryDate.Text);
            string sup = ddlSupplierList.SelectedValue.ToString();
            Supplier s = supbll.GetSupplierByName(sup);
            string scode = s.Supplier_Code;
            //string record_status = "NO";

            PurchaseOrderBLL pobll = new PurchaseOrderBLL();
            poNum = pobll.addNewPO(orderDate, scode, orderBy, reqDate);

            foreach (GridViewRow row in gvPurchaseOrder.Rows)
            {
                string itemDesc = HttpUtility.HtmlDecode(row.Cells[2].Text);

                Stock_Item stock = stkbll.GetItembyDesc(itemDesc);

                string itemcode = stock.Item_Code;

                int qty = Convert.ToInt32(row.Cells[3].Text);

                PurchaseOrderDetailBLL podbll = new PurchaseOrderDetailBLL();
                int poDetailID = podbll.addNewPOD(poNum, itemcode, qty);        //////change type
            }

            lblMsg.Text = "Inserted into PO and POD";

            //SendUsingGmail();

            //send using logic uni email
               // int currentid = Convert.ToInt32(Session["LoginUser"].ToString());

            int currentid = Convert.ToInt32(Session["loginUser"]); //change later

            string gridviewforemail = formatGridview();
            string emailsubject = "Purchase order from Logic University Stationery Store: (PONumber" + poNum + ")";
            string emailBody = gridviewforemail;

            SendEmailToSupplier(currentid, emailBody, emailsubject);

            //Debug.WriteLine("email sent successfully");
        }