Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Item_tbl item_tbl = db.Item_tbl.Find(id);

            db.Item_tbl.Remove(item_tbl);
            db.SaveChanges();
            TempData["message"] = "Item Deleted!";
            return(RedirectToAction("ItemManagement"));
        }
Beispiel #2
0
        private void iadd_b_Click(object sender, RoutedEventArgs e)
        {
            String   mesg;
            Item_tbl ItemInfo = new Item_tbl();

            ItemInfo.Item_Id          = Convert.ToInt32(txtiid.Text);
            ItemInfo.Item_Name        = txtiname.Text;
            ItemInfo.Item_Description = txt_d.Text;
            ItemInfo.Supplier_Id      = int.Parse(txt_s.Text);
            ItemInfo.Price            = Convert.ToInt32(txtre_o.Text);
            mesg = ServiceClientObject.InsertItemDetails(ItemInfo);
            MessageBox.Show(mesg);
        }
Beispiel #3
0
        // GET: Item/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Item_tbl item_tbl = db.Item_tbl.Find(id);

            if (item_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(item_tbl));
        }
        public string DeleteItemDetails(int item_ID)
        {
            String   message;
            Item_tbl Delete_item = Namal_S.Item_tbls.FirstOrDefault(a => a.Item_Id.Equals(item_ID));

            try
            {
                Namal_S.Item_tbls.DeleteOnSubmit(Delete_item);
                Namal_S.SubmitChanges();
                message = "Details Deleted successfully";
            }
            catch
            {
                message = "Details not Deleted successfully";
            }
            return(message);
        }
Beispiel #5
0
        // GET: Item/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Item_tbl item_tbl = db.Item_tbl.Find(id);

            if (db.BookingItem_tbl.Where(a => a.Itm_Id == item_tbl.Itm_Id).Count() > 0)
            {
                TempData["message"] = "Item cannot be delete as it associated with some booking!";
                return(View());
            }
            if (item_tbl == null)
            {
                return(HttpNotFound());
            }
            return(View(item_tbl));
        }
        public string UpdateItemDetails(Item_tbl ItemInfo)
        {
            String   message;
            Item_tbl modify_item = Namal_S.Item_tbls.FirstOrDefault(a => a.Item_Id.Equals(ItemInfo.Item_Id));

            modify_item.Item_Name        = ItemInfo.Item_Name;
            modify_item.Item_Description = ItemInfo.Item_Description;
            modify_item.Supplier_Id      = ItemInfo.Supplier_Id;

            try
            {
                Namal_S.SubmitChanges();
                message = "Details Modified successfully";
            }
            catch
            {
                message = "Details not Modified successfully";
            }
            return(message);
        }
Beispiel #7
0
        public ActionResult Create([Bind(Include = "Itm_Id,Cust_Id,Itm_Name,Itm_Description")] Item_tbl item_tbl)
        {
            if (ModelState.IsValid)
            {
                if (db.Item_tbl.Where(a => a.Itm_Name == item_tbl.Itm_Name && a.Cust_Id == item_tbl.Cust_Id).Count() > 0)
                {
                    TempData["message"] = "The customer already have item with same name!";
                    ViewBag.custList    = getCustomer();
                    return(View());
                }
                else
                {
                    db.Item_tbl.Add(item_tbl);
                    db.SaveChanges();
                    TempData["message"] = "New item registered!";
                    return(RedirectToAction("ItemManagement"));
                }
            }

            return(View(item_tbl));
        }
        public String InsertItemDetails(Item_tbl ItemInfo)
        {
            String   message;
            Item_tbl iD = new Item_tbl();

            iD.Item_Id          = ItemInfo.Item_Id;
            iD.Item_Name        = ItemInfo.Item_Name;
            iD.Item_Description = ItemInfo.Item_Description;
            iD.Supplier_Id      = ItemInfo.Supplier_Id;

            try
            {
                Namal_S.Item_tbls.InsertOnSubmit(iD);
                Namal_S.SubmitChanges();
                message = "Details inserted successfully";
            }
            catch (Exception ex)
            {
                message = "Details not inserted successfully";
            }
            return(message);
        }
Beispiel #9
0
        private void iupdt_b_Click(object sender, RoutedEventArgs e)
        {
            String mesg, mesg2;

            mesg2 = ServiceClientObject.ItemDetails(Convert.ToInt32(txtiid.Text));
            MessageBoxResult re = MessageBox.Show(mesg2, "You are going to Update Item", MessageBoxButton.OKCancel, MessageBoxImage.Information);

            if (re.Equals(MessageBoxResult.OK))
            {
                Item_tbl ItemInfo = new Item_tbl();
                ItemInfo.Item_Id          = Convert.ToInt32(txtiid.Text);
                ItemInfo.Item_Name        = txtiname.Text;
                ItemInfo.Item_Description = txt_d.Text;
                ItemInfo.Supplier_Id      = int.Parse(txt_s.Text);
                ItemInfo.Price            = Convert.ToInt32(txtre_o.Text);
                mesg = ServiceClientObject.UpdateItemDetails(ItemInfo);
                MessageBox.Show(mesg);
                cleartxt();
            }
            else
            {
                cleartxt();
            }
        }