Пример #1
0
        public static Item createITEM(ItemService IS, long catID, long numSchemeID, StringArray[] ItemNSFieldInputsDef, string itemTitle, string itemDesc)
        {
            try
            {
                GenVaultHelper.LibNotes();

                itemObj = IS.AddItemRevision(catID);
                ProductRestric[] pres;
                mID = new[] { itemObj.MasterId };
                sID = new[] { numSchemeID };
                rID = new[] { itemObj.RevId };

                ItemNum[] newNumbers = IS.AddItemNumbers(mID, sID, ItemNSFieldInputsDef, out pres);
                itemObj.ItemNum = newNumbers[0].ItemNum1;
                string[] itemNums = { itemObj.ItemNum };
                itemObj.Detail = itemTitle;
                itemObj.Title  = itemDesc;
                IS.CommitItemNumbers(mID, itemNums);
                IS.UpdateAndCommitItems(new Item[] { itemObj });
            }
            catch (System.Exception ex)
            {
                //return ex.ToString();
            }
            return(itemObj);// result = "Sucess";
        }
Пример #2
0
        private void CreateItem()
        {
            ItemService itemSvc = m_connection.WebServiceManager.ItemService;

            CreateItemForm form = new CreateItemForm(m_connection);

            form.ShowDialog();

            if (form.DialogResult != DialogResult.OK)
            {
                return;
            }

            try
            {
                // create the initial object
                Item item = itemSvc.AddItemRevision(form.Category.Id);

                // set the data
                item.Title = form.ItemTitle;

                // commit the item, which finalizes the object
                itemSvc.UpdateAndCommitItems(new Item [] { item });
            }
            catch (Exception e)
            {
                ErrorHandler.HandleError(e);
            }

            // MessageBox.Show("Item Created");
            RefreshItemList();
        }