Ejemplo n.º 1
0
        protected void uiGridViewItems_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteDetail")
            {
                IStock.BLL.PurchaseOrderDetails objData = new IStock.BLL.PurchaseOrderDetails();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                /*
                IStock.BLL.Items item = new IStock.BLL.Items();
                item.LoadByPrimaryKey(objData.ItemID);
                item.Quantity -= objData.NoOfPackages * objData.ItemOnPackages;
                item.Save();
                */

                objData.MarkAsDeleted();
                objData.Save();
                BindItems();
            }
        }
Ejemplo n.º 2
0
        protected void uiGridViewOrders_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditOrder")
            {
                IStock.BLL.PurchaseOrders objData = new IStock.BLL.PurchaseOrders();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxCode.Text = objData.PurchaseOrderNo;
                uiTextBoxDate.Text = objData.PurchaseOrderDate.ToString("dd/MM/yyy");
                uiDropDownListSuppliers.SelectedValue = objData.SupplierID.ToString();

                uiPanelAllOrders.Visible = false;
                uiPanelEditPurchaseOrder.Visible = true;
                uiPanelItems.Visible = true;
                CurrentPurchaseOrder = objData;
                BindItems();
                EnableDisableControls();

            }
            else if (e.CommandName == "DeleteOrder")
            {
                try
                {
                    IStock.BLL.PurchaseOrders objData = new IStock.BLL.PurchaseOrders();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                    IStock.BLL.PurchaseOrderDetails details = new IStock.BLL.PurchaseOrderDetails();
                    details.GetPurchaseOrderDetails(objData.PurchaseOrderID);
                    /*
                    if (details.RowCount > 0)
                    {
                        for(int i=0;i<details.RowCount;i++)
                        {
                            IStock.BLL.Items item = new IStock.BLL.Items();
                            item.LoadByPrimaryKey(details.ItemID);
                            item.Quantity -= details.NoOfPackages * details.ItemOnPackages;
                            item.Save();
                            details.MoveNext();
                        }
                    }
                    */
                    details.MarkAsDeleted();
                    details.Save();

                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentPurchaseOrder = null;
                    BindOrders();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
Ejemplo n.º 3
0
        protected void uiLinkButtonConfirm_Click(object sender, EventArgs e)
        {
            CurrentPurchaseOrder.Confirmed = true;
            CurrentPurchaseOrder.Save();
            uiLinkButtonConfirm.Enabled = false;

            IStock.BLL.PurchaseOrderDetails details = new IStock.BLL.PurchaseOrderDetails();
            details.GetPurchaseOrderDetails(CurrentPurchaseOrder.PurchaseOrderID);
            for (int i = 0; i < details.RowCount; i++)
            {
                IStock.BLL.Items item = new IStock.BLL.Items();
                item.LoadByPrimaryKey(details.ItemID);
                if (item.IsColumnNull("Quantity"))
                    item.SetColumn("Quantity", details.NoOfPackages * details.ItemOnPackages);
                else
                    item.Quantity += details.NoOfPackages * details.ItemOnPackages;
                item.Save();
                details.MoveNext();
            }
            EnableDisableControls();
            BindItems();
        }
Ejemplo n.º 4
0
 private void BindItems()
 {
     IStock.BLL.PurchaseOrderDetails details = new IStock.BLL.PurchaseOrderDetails();
     details.GetPurchaseOrderDetails(CurrentPurchaseOrder.PurchaseOrderID);
     uiGridViewItems.DataSource = details.DefaultView;
     uiGridViewItems.DataBind();
     uiTextBoxTotal.Text = CurrentPurchaseOrder.GetPurchaseOrderTotals(CurrentPurchaseOrder.PurchaseOrderID).ToString();
 }
Ejemplo n.º 5
0
        protected void uiLinkButtonAddItem_Click(object sender, EventArgs e)
        {
            IStock.BLL.PurchaseOrderDetails detail = new IStock.BLL.PurchaseOrderDetails();
            detail.AddNew();
            detail.PurchaseOrderID = CurrentPurchaseOrder.PurchaseOrderID;
            //detail.ItemID = Convert.ToInt32(uiDropDownListItems.SelectedValue);
            detail.ItemID = Convert.ToInt32(uiHiddenFieldCurrentItem.Value);
            detail.NoOfPackages = Convert.ToInt32(uiTextBoxNoOfPackages.Text);
            detail.ItemOnPackages = Convert.ToInt32(uiTextBoxItemOnPackages.Text);
            detail.PackagePrice = decimal.Parse(uiTextBoxPrice.Text);
            detail.Save();

            /*
            IStock.BLL.Items item = new IStock.BLL.Items();
            item.LoadByPrimaryKey(detail.ItemID);
            if (item.IsColumnNull("Quantity"))
                item.SetColumn("Quantity", detail.NoOfPackages * detail.ItemOnPackages);
            else
                item.Quantity += detail.NoOfPackages * detail.ItemOnPackages;
            item.Save();
            */
            BindItems();
        }