protected void btnSavePurchaseOrderGeneralGrid_Click(object sender, EventArgs e)
        {
            BLL.PurchaseOrder Pur = new BLL.PurchaseOrder();
            if (getQueryString_PurchaseOrder > 0)
            {
                Pur.LoadByPrimaryKey(getQueryString_PurchaseOrder);
            }
            else
            {
                Pur.AddNew();
                Pur.CreatedBy = new Guid(Membership.GetUser().ProviderUserKey.ToString());
                Pur.CreatedDate = DateTime.Now;
            }
            Pur.PurchaseOrderNumber = txtPurchaseOrderNumber.Text;
            Pur.PurchaseOrderDate = DateTime.ParseExact(txtPurchaseOrderDate.Text, "dd/MM/yyyy", null);
            Pur.Management = txtManagement.Text;
            Pur.DeliveryDate = DateTime.ParseExact(txtDeliveryDate.Text, "dd/MM/yyyy", null);
            Pur.DeliveryPlace = txtDeliveryPlace.Text;
            Pur.PaymentRequierment = txtPaymentRequirement.Text;
            Pur.ManagerName = TxtManagerName.Text;
            Pur.ISFinalProduct = uiCheckBoxListType.Items[0].Selected;
            Pur.ISProductUnderManufacturing = uiCheckBoxListType.Items[2].Selected;
            Pur.ISSample = uiCheckBoxListType.Items[1].Selected;
            Pur.UpdatedBy = new Guid(Membership.GetUser().ProviderUserKey.ToString());
            Pur.LastUpdatedDate = DateTime.Now;
            Pur.Save();

            PanelPurchaseOrdersGrid.Visible = true;
            PanelPurchaseOrderGeneral.Visible = false;
            PanelGrdPurcahseOrderDetails.Visible = true;
            PanelPurchaseOrderDetails.Visible = true;

            Response.Redirect("PurchaseOrder.aspx?PurchaseOrderID=" + Pur.PurchaseOrderID.ToString());
        }
        protected void GrdViewPurchaseOrders_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "editGeneralOrder")
            {
                int ID = int.Parse(e.CommandArgument.ToString());

                Response.Redirect("PurchaseOrder.aspx?PurchaseOrderID=" + ID.ToString());

            }
            else if (e.CommandName == "deleteGeneralOrder")
            {
               BLL.PurchaseOrder purdel = new BLL.PurchaseOrder();
                PurchaseOrderDetails Purddel = new PurchaseOrderDetails();
                purdel.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString()));
                Purddel.getPurchaseDetails(int.Parse(e.CommandArgument.ToString()));
                Purddel.DeleteAll();
                Purddel.Save();
                purdel.MarkAsDeleted();
                purdel.Save();
            }
            BindGeneralPurchaseOrder();
        }