Exemple #1
0
        protected void ItemSelectionList_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            MessageUserControl.Visible = true;

            if (int.Parse(VendorDLL.SelectedValue) == 0)
            {
                MessageUserControl.ShowInfo("you must first select vendor name to display Current Active Order and Vendor Stock Item for adding to Purchase Order.");
            }
            else
            {
                MessageUserControl.TryRun(() =>
                {
                    int vendorid    = int.Parse(VendorDLL.SelectedValue);
                    int stockitemid = int.Parse(e.CommandArgument.ToString());
                    PurchaseOrderDetailController sysmgr = new PurchaseOrderDetailController();
                    sysmgr.Add_LinItemToCurrentActivePurchaseOrdderList(vendorid, stockitemid);
                    Refresh_Displays();

                    VendorComtroller vendorinfo = new VendorComtroller();
                    Vendor results  = vendorinfo.Vendor_Get(int.Parse(VendorDLL.SelectedValue));
                    Name.Text       = results.VendorName;
                    Phone.Text      = results.Phone;
                    Address.Text    = results.Address;
                    City.Text       = results.City;
                    Province.Text   = results.Province;
                    PostalCode.Text = results.PostalCode;
                }, "Adding Item to Current Order", "Item successfully added to the list.");
            }
        }
Exemple #2
0
        protected void VendorFetch_Click(object sender, EventArgs e)
        {
            MessageUserControl.Visible = false;
            string username = User.Identity.Name;
            ApplicationUserManager secmgr = new ApplicationUserManager(
                new UserStore <ApplicationUser>(new ApplicationDbContext()));
            EmployeeInfo info = secmgr.User_GetEmployee(username);

            if (VendorDLL.SelectedIndex == 0)
            {
                MessageUserControl.ShowInfo("Please select Vendor to retrive information.");
            }
            else
            {
                MessageUserControl.TryRun(() =>
                {
                    VendorComtroller sysmgr = new VendorComtroller();
                    Vendor results          = sysmgr.Vendor_Get(int.Parse(VendorDLL.SelectedValue));
                    Name.Text       = results.VendorName;
                    Phone.Text      = null;
                    Address.Text    = null;
                    City.Text       = null;
                    Province.Text   = null;
                    PostalCode.Text = null;
                });
            }

            List <CurrentActiveOrderList> list = new List <CurrentActiveOrderList>();

            MessageUserControl.TryRun(() =>
            {
                int employeeid = info.EmployeeID;
                int vendorid   = int.Parse(VendorDLL.SelectedValue);
                for (int rowindex = 0; rowindex < OrderList.Rows.Count; rowindex++)
                {
                    CurrentActiveOrderList temp = new CurrentActiveOrderList();

                    temp.StockItemID     = int.Parse((OrderList.Rows[rowindex].FindControl("StockItemID") as Label).Text);
                    temp.Description     = (OrderList.Rows[rowindex].FindControl("Description") as Label).Text;
                    temp.QuantityOnHand  = int.Parse((OrderList.Rows[rowindex].FindControl("QuantityOnHand") as Label).Text);
                    temp.QuantityOnOrder = int.Parse((OrderList.Rows[rowindex].FindControl("QuantityOnOrder") as Label).Text);
                    temp.ReOrderLevel    = int.Parse((OrderList.Rows[rowindex].FindControl("ReOrderLevel") as Label).Text);
                    temp.QuantityToOrder = int.Parse((OrderList.Rows[rowindex].FindControl("QuantityToOrder") as TextBox).Text);
                    temp.Price           = decimal.Parse((OrderList.Rows[rowindex].FindControl("Price") as TextBox).Text, NumberStyles.Currency);
                    list.Add(temp);
                }
                PurchaseOrderDetailController sysmgr = new PurchaseOrderDetailController();
                List <CurrentActiveOrderList> result = sysmgr.List_StockItemsForSuggestedNewOrder(vendorid, employeeid);
                OrderList.DataSource = result;
                OrderList.DataBind();

                StockItemController sus             = new StockItemController();
                List <VendorStockItemsList> result1 = sus.List_VendorStockItemsForCurrentActiveOrder(vendorid, result);
                VendorStockItemList.DataSource      = result1;
                VendorStockItemList.DataBind();

                PurchaseOrderController order = new PurchaseOrderController();
                PurchaseOrder result2         = order.Order_GetByVendor(vendorid);
                GSTID.Text      = string.Format("{0:C2}", result2.TaxAmount);
                SubTotalID.Text = string.Format("{0:C2}", result2.SubTotal);
                TotalID.Text    = string.Format("{0:C2}", result2.Total);
            });
        }