public static void Edititem(string Description, int quantity)
        {
            PurchaseGood goods = m.PurchaseGoods.Where(p => p.Description == Description && p.Status == "Pending").FirstOrDefault();

            goods.Order_Quantity = quantity;
            model.SaveChanges();
        }
        public static void Deleteitem(string Description)
        {
            PurchaseGood goods = m.PurchaseGoods.Where(p => p.Description == Description && p.Status == "Pending").FirstOrDefault();

            m.PurchaseGoods.Remove(goods);
            m.SaveChanges();
        }
Exemple #3
0
        protected void Btn_purchase_Click(object sender, EventArgs e)
        {
            PurchaseGood newPurchaseItem = new PurchaseGood();

            newPurchaseItem.Description        = ddl_Description.SelectedValue;
            newPurchaseItem.Item_Number        = ClerkMaintenanceBusinessLogic.getItemNumber(newPurchaseItem.Description);
            newPurchaseItem.Available_Quantity = ClerkMaintenanceBusinessLogic.GetAvailableQuantity(newPurchaseItem.Item_Number);
            newPurchaseItem.Order_Quantity     = Convert.ToInt32(txt_Quantity.Text);
            newPurchaseItem.Supplier_ID        = ddl_Supplier.SelectedValue;
            newPurchaseItem.Phonenumber        = (int)(models.Suppliers.Where(x => x.Supplier_ID == newPurchaseItem.Supplier_ID).Select(x => x.Phone_Num).FirstOrDefault());
            newPurchaseItem.Status             = "Pending";
            m.PurchaseGoods.Add(newPurchaseItem);
            m.SaveChanges();
            Response.Redirect("purchaseGoods.aspx");
        }