Example #1
0
        static public string AddItem(Item item)
        {
            HLFEntities ctx = new HLFEntities();

            try
            {
                ctx.Item.Add(item);
                ctx.SaveChanges();
                return(HLFMsg.AddItemOKMsg);
            }
            catch (Exception) { return(HLFMsg.AddItemNGMsg); throw; }
        }
Example #2
0
        static public string RemoveItem(string itemID)
        {
            HLFEntities ctx = new HLFEntities();

            try
            {
                Item original = SearchItem(itemID);
                if (original == null)
                {
                    return(HLFMsg.FindItemNGMsg);
                }
                ctx.Item.Remove(original);
                ctx.SaveChanges();
                return(HLFMsg.RemoveItemOKMsg);
            }
            catch (Exception) { return(HLFMsg.RemoveItemNGMsg); throw; }
        }
Example #3
0
        static public string UpdateItem(Item item)
        {
            HLFEntities ctx = new HLFEntities();

            try
            {
                Item original = SearchItem(item.ItemID);
                if (original == null)
                {
                    return(HLFMsg.FindItemNGMsg);
                }
                original = item;
                ctx.SaveChanges();
                return(HLFMsg.UpdateItemOKMsg);
            }
            catch (Exception) { return(HLFMsg.UpdateItemNGMsg);  throw; }
        }