Exemplo n.º 1
0
        public JavaScriptResult SaveNewItem(string Name, int ItemTypeID, int ManufacturerID, string UPC, string Description, bool ItemNew, bool ItemTested, int OwnerID, string Cost, string Price, string Appraisal, bool Serialized)
        {
            string result = "";

            if (M.GetItemNameDuplicateCount(Name) < 1)
            {
                ITEMDATA newitem = new ITEMDATA {
                    Name = Name, ItemTypeID = ItemTypeID, ManufacturerID = ManufacturerID, OwnerID = OwnerID, Description = Description, ItemNew = ItemNew, ItemTested = ItemTested, UPC = UPC, Serialized = Serialized
                };

                newitem.LocID = 0; newitem.Quantity = 0;
                try { newitem.Cost = Convert.ToDecimal(Cost); }
                catch { newitem.Cost = 0; }
                try { newitem.Price = Convert.ToDecimal(Price); }
                catch { newitem.Price = 0; }
                try { newitem.Appraisal = Convert.ToDecimal(Appraisal); }
                catch { newitem.Appraisal = 0; }
                int ItemID = M.SaveItem(newitem);

                if (ItemID > 0)
                {
                    result = @" alert('New Item Saved');  $(PitemDiv).hide(); $(ddlItemList).append('<option value=" + ItemID + @">" + Name + @"</option>'); selvalItemList=" + ItemID + @"; ";
                }

                else
                {
                    result = @" alert('New Item Save Failed!'); ";
                }
            }
            else
            {
                result = @" alert('An item by that name already exists'); ";
            }
            return(JavaScript(result));
        }
Exemplo n.º 2
0
        public JavaScriptResult SaveItemEdit(int ItemID, string Name)
        {
            ITEMDATA edits = new ITEMDATA {
                Name = Name, ItemID = ItemID
            };
            string result = "";

            if (M.ItemEditSave(edits))
            {
                result = @" alert('" + Name + @" Succeeded');";
            }
            else
            {
                result = @" alert('" + Name + @" Failed');";
            }
            return(JavaScript(result));
        }
Exemplo n.º 3
0
        private HRESULT Initialize()
        {
            HRESULT hr = HRESULT.S_OK;

            for (var i = 0; hr.Succeeded && i < m_aData.Length; i++)
            {
                hr = LoadFolderViewImplDisplayString(i, out var str);
                if (hr.Succeeded)
                {
                    // Just hardcode the values here now.
                    m_aData[i] = new ITEMDATA {
                        nSize = i, nSides = 3, fIsFolder = ISFOLDERFROMINDEX(i), szName = str
                    };
                }
            }
            return(hr);
        }
Exemplo n.º 4
0
        public JavaScriptResult SaveItem(string Name, int ItemTypeID, int ManufacturerID, string UPC, string Description, string Quantity, bool ItemNew, bool ItemTested, int LocationID, int OwnerID, string Cost, string Price, string Appraisal)
        {
            string result    = "";
            int    ItemLocID = 0;

            if (M.GetItemNameDuplicateCount(Name) < 1)
            {
                ITEMDATA newitem = new ITEMDATA {
                    Name = Name, ItemTypeID = ItemTypeID, ManufacturerID = ManufacturerID, LocID = LocationID, OwnerID = OwnerID, Description = Description, ItemNew = ItemNew, ItemTested = ItemTested, UPC = UPC
                };

                try { newitem.Quantity = Convert.ToDecimal(Quantity); }
                catch { newitem.Quantity = 0; }
                try { newitem.Cost = Convert.ToDecimal(Cost); }
                catch { newitem.Cost = 0; }
                try { newitem.Price = Convert.ToDecimal(Price); }
                catch { newitem.Price = 0; }
                try { newitem.Appraisal = Convert.ToDecimal(Appraisal); }
                catch { newitem.Appraisal = 0; }
                int ItemID = M.SaveItem(newitem);
                if (ItemID > 0)
                {
                    ItemLocID = M.SaveQuantityLoc(ItemID, LocationID, newitem.Quantity);
                }
                if (ItemID > 0 && ItemLocID > 0)
                {
                    result = J.TableRecordPreppend("tblItemsbody", "newtblrecord", Name, M.GetItemTypeFromID(ItemTypeID), M.GetManufacturerFromID(ManufacturerID), UPC, Description, Quantity.ToString(), ItemNew.ToString(), ItemTested.ToString(), M.GetOwnerNameFromID(OwnerID), newitem.Cost.ToString(), newitem.Price.ToString(), newitem.Appraisal.ToString());
                }
                else
                {
                    result = @" alert('New Item Save Failed'); ";
                }
            }
            else
            {
                result = @" alert('An item by that name already exists'); ";
            }
            return(JavaScript(result));
        }