Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Master.PageTitle = "اوامر الشراء";

                BindGeneralPurchaseOrder();

                if (getQueryString_PurchaseOrder > 0)
                {
                    BLL.PurchaseOrder PoG = new BLL.PurchaseOrder();
                    PoG.LoadByPrimaryKey(getQueryString_PurchaseOrder);
                    txtPurchaseOrderNumber.Text = PoG.PurchaseOrderNumber;
                    txtPurchaseOrderDate.Text = PoG.PurchaseOrderDate.ToString("dd/MM/yyyy");
                    txtManagement.Text = PoG.Management;

                    //if(CheckBoxList1.Items.IndexOf(0)
                    //{

                    //}
                    txtDeliveryDate.Text = PoG.DeliveryDate.ToString("dd/MM/yyyy");
                    txtDeliveryPlace.Text = PoG.DeliveryPlace;
                    txtPaymentRequirement.Text = PoG.PaymentRequierment;
                    TxtManagerName.Text = PoG.ManagerName;
                    uiCheckBoxListType.Items[0].Selected = PoG.ISFinalProduct;
                    uiCheckBoxListType.Items[1].Selected = PoG.ISSample;
                    uiCheckBoxListType.Items[2].Selected = PoG.ISProductUnderManufacturing;
                    BindDetailsPurchaseOrder();

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

                }
                if(getQueryString_PurchaseOrderDetails > 0)
                {
                    PurchaseOrderDetails POD = new PurchaseOrderDetails();
                    POD.LoadByPrimaryKey(getQueryString_PurchaseOrderDetails);
                    txtTotalValue.Text = POD.TotalValue.ToString();
                    txtUnitPrice.Text = POD.UnitPrice.ToString();
                    txtQuantityRequired.Text = POD.QuantityRequired.ToString();
                    txtStockOnHands.Text = POD.StockOnHand.ToString();
                    txtUnit.Text = POD.Unit.ToString();
                    txtDescription.Text = POD.Description;

                }

            }
            //BindGeneralPurchaseOrder();
            //BindDetailsPurchaseOrder();
        }
Пример #2
0
        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());
        }
Пример #3
0
        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();
        }