コード例 #1
0
        /// <summary>
        /// Kelsey Blount
        /// created  2015/04/10
        /// Handles archival of a listing
        /// </summary>
        /// <remarks>
        /// Matt Lapka
        /// Updated 2015/04/15
        /// error messages added
        /// </remarks>
        /// <param name="ItemListID">item ID for the listing</param>
        public void DeleteList(int ItemListID)
        {
            try
            {
                ItemListing myList = _listedLists
                                     .Where(e => e.ItemListID == ItemListID).FirstOrDefault();

                listResult result = _myManager.ArchiveItemListing(myList);
                if (result == listResult.Success)
                {
                    lblMessage.Text = "Event listing successfully deleted.";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "showit", "showMessage()", true);
                }
                else
                {
                    lblMessage.Text = "Cannot delete listing with registered guests.";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "showit", "showMessage()", true);
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Event deleting listing: " + ex.Message;
                Page.ClientScript.RegisterStartupScript(this.GetType(), "showit", "showMessage()", true);
            }
        }
コード例 #2
0
        /// <summary>
        /// Tyler Collins
        /// Created: 2015/02/11
        /// DELETEs (Sets Boolean Active field to false) an ItemListing record in the Database using a Stored Procedure.
        /// </summary>
        /// <remarks>
        /// Tyler Collins
        /// Updated:  2015/02/26
        /// Now up to date with most recent ItemListing object class
        /// </remarks>
        /// <param name="itemListingToDelete">Requires the ItemListing object which matches the record to be DELETED in the Database.</param>
        /// <returns>Returns the number of rows affected.</returns>
        public static int DeleteItemListing(ItemListing itemListingToDelete)
        {
            var    conn            = DatabaseConnection.GetDatabaseConnection();
            string storedProcedure = "spDeleteItemListing";
            var    cmd             = new SqlCommand(storedProcedure, conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@ItemListID", itemListingToDelete.ItemListID);
            cmd.Parameters.AddWithValue("@StartDate", itemListingToDelete.StartDate);
            cmd.Parameters.AddWithValue("@EndDate", itemListingToDelete.EndDate);
            cmd.Parameters.AddWithValue("@EventItemID", itemListingToDelete.EventID);
            cmd.Parameters.AddWithValue("@Price", itemListingToDelete.Price);
            cmd.Parameters.AddWithValue("@MaxNumGuests", itemListingToDelete.MaxNumGuests);
            cmd.Parameters.AddWithValue("@CurrentNumGuests", itemListingToDelete.CurrentNumGuests);
            cmd.Parameters.AddWithValue("@SupplierID", itemListingToDelete.SupplierID);

            int rowsAffected;

            try
            {
                conn.Open();
                rowsAffected = cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }

            return(rowsAffected);
        }
コード例 #3
0
ファイル: Listing.cs プロジェクト: zougui1/Console-Game
 /// <summary>
 /// PaginateAction is used as an action to iterates over the list starting from the given minimum index ending to the given maximum index
 /// </summary>
 /// <param name="min">starting index</param>
 /// <param name="max">ending index</param>
 /// <param name="action">action to trigger</param>
 private void PaginateAction(int min, int max, ItemListing <TList> action)
 {
     for (int i = min; i < max; ++i)
     {
         action(List[i]);
     }
 }
コード例 #4
0
        /// <summary>
        /// Bryan Hurst
        /// Created:  4/23/2015
        /// Method for deletion of test records created with the unit tests
        /// </summary>
        /// <param name="TestListing">The ItemListing added during testing -- to be deleted</param>
        /// <returns>Number of rows affected</returns>
        public static int DeleteItemListingTestItem(ItemListing TestListing)
        {
            var conn         = DatabaseConnection.GetDatabaseConnection();
            var cmdText      = "spDeleteTestItemListing";
            var cmd          = new SqlCommand(cmdText, conn);
            var rowsAffected = 0;

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@EndDate", TestListing.EndDate);

            try
            {
                conn.Open();
                rowsAffected = cmd.ExecuteNonQuery();
                if (rowsAffected == 0)
                {
                    throw new ApplicationException("Concurrency Violation");
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return(rowsAffected);  // needs to be rows affected
        }
コード例 #5
0
        /// <summary>
        /// Hunter Lind
        /// Created:  2015/02/10
        /// Takes input from form to update the item listing
        /// </summary>
        /// <remarks>
        /// Pat Banks
        /// Updated:  2015/02/19
        /// fields updated to reflect all required data
        /// Added spinners and calendar for user input restrictions
        /// </remarks>
        private async void UpdateItemListing()
        {
            try
            {
                DateTime    formStartDate = (DateTime)(DateStart.SelectedDate);
                DateTime    formEndDate   = (DateTime)(DateEnd.SelectedDate);
                DateTime    formStartTime = (DateTime)(TpStartTime.Value);
                DateTime    formEndTime   = (DateTime)(TpEndTime.Value);
                ItemListing newListing    = new ItemListing
                {
                    ItemListID       = CurrentItemListing.ItemListID,
                    EventID          = CurrentItemListing.EventID,
                    StartDate        = DateTime.Parse(string.Format("{0} {1}", formStartDate.ToShortDateString(), formStartTime.ToLongTimeString())),
                    EndDate          = DateTime.Parse(string.Format("{0} {1}", formEndDate.ToShortDateString(), formEndTime.ToLongTimeString())),
                    Price            = (decimal)(UdPrice.Value),
                    MaxNumGuests     = (int)(UdSeats.Value),
                    CurrentNumGuests = CurrentItemListing.CurrentNumGuests,
                    SupplierID       = CurrentItemListing.SupplierID
                };

                var numRows = _productManager.EditItemListing(newListing, CurrentItemListing);

                if (numRows == listResult.Success)
                {
                    await this.ShowMessageDialog("Item successfully changed.");

                    DialogResult = true;
                    Close();
                }
            }
            catch (Exception ex)
            {
                throw new WanderingTurtleException(this, ex, "There was an error updating the Item Listing.");
            }
        }
コード例 #6
0
ファイル: Listing.cs プロジェクト: zougui1/Console-Game
 /// <summary>
 /// PaginationAction is used to "convert" an ItemListing action into a PaginateAction
 /// </summary>
 /// <param name="action"></param>
 /// <returns></returns>
 protected PaginateAction PaginationAction(ItemListing <TList> action)
 {
     return(new PaginateAction((int min, int max) =>
     {
         PaginateAction(min, max, action);
     }));
 }
コード例 #7
0
ファイル: ItemDrop.cs プロジェクト: LimaniSnicket/BumpkinRat
    public ItemDrop(int itemId, int amount)
    {
        int  cap  = Math.Max(amount, 0);
        Item item = ItemDataManager.GetItemById(itemId);

        itemDropData = new ItemListing(item, cap);
    }
コード例 #8
0
    private void IncreaseItemListingCount(ItemListing existingItemListing)
    {
        int count = Convert.ToInt32(existingItemListing.ItemCount.text);

        count++;
        existingItemListing.ItemCount.text = count.ToString();
    }
コード例 #9
0
 /// <summary>
 /// Miguel Santana
 /// Created:  2015/04/15
 /// opens the window with a selected item
 /// </summary>
 /// <param name="selectedItem"></param>
 /// <param name="readOnly"></param>
 private void OpenListing(ItemListing selectedItem = null, bool readOnly = false)
 {
     try
     {
         if (selectedItem == null)
         {
             if (new AddEditListing().ShowDialog() == false)
             {
                 return;
             }
             RefreshData();
         }
         else
         {
             if (new AddEditListing(selectedItem, readOnly).ShowDialog() == false)
             {
                 return;
             }
             if (readOnly)
             {
                 return;
             }
             RefreshData();
         }
     }
     catch (Exception ex)
     {
         throw new WanderingTurtleException(this, ex);
     }
 }
コード例 #10
0
    //remove item and listing from their lists.
    public void RemoveItem(Item item, ItemListing itemListing)
    {
        Item        instancedItem        = item;
        ItemListing instancedItemListing = itemListing;


        items.Remove(instancedItem);
        itemListings.Remove(instancedItemListing);
    }
コード例 #11
0
        /// <summary>
        /// Tyler Collins
        /// Created: 2015/02/10
        /// Retrieves all ItemListing data from the Database using a Stored Procedure.
        /// Creates an ItemListing object from retrieved data.
        /// Adds ItemListing object to List of ItemListing objects.
        /// </summary>
        /// <remarks>
        /// Tyler Collins
        /// Updated:  2015/02/26
        /// Now up to date with most recent ItemListing object class
        /// </remarks>
        /// <returns>List of Active ItemListing objects</returns>
        public static List <ItemListing> GetItemListingList()
        {
            List <ItemListing> itemListingList = new List <ItemListing>();

            var    conn            = DatabaseConnection.GetDatabaseConnection();
            string storedProcedure = "spSelectAllItemListings";
            var    cmd             = new SqlCommand(storedProcedure, conn);

            cmd.CommandType = CommandType.StoredProcedure;

            try
            {
                conn.Open();
                var reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ItemListing currentItemListing = new ItemListing();

                        currentItemListing.StartDate        = reader.GetDateTime(0);
                        currentItemListing.EndDate          = reader.GetDateTime(1);
                        currentItemListing.ItemListID       = reader.GetInt32(2);
                        currentItemListing.EventID          = reader.GetInt32(3);
                        currentItemListing.Price            = reader.GetDecimal(4);
                        currentItemListing.SupplierID       = reader.GetInt32(5);
                        currentItemListing.CurrentNumGuests = reader.GetInt32(6);
                        currentItemListing.MaxNumGuests     = reader.GetInt32(7);
                        currentItemListing.MinNumGuests     = reader.GetInt32(8);
                        currentItemListing.EventName        = reader.GetString(9);
                        currentItemListing.SupplierName     = reader.GetString(10);

                        if (currentItemListing.EndDate > DateTime.Now)
                        {
                            itemListingList.Add(currentItemListing);
                        }
                    }
                }
                else
                {
                    var pokeball = new ApplicationException("Data Not Found!");
                    throw pokeball;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }

            return(itemListingList);
        }
コード例 #12
0
        public ItemAnalysis Analyze(ItemListing itemListing, TesseractEngine engine)
        {
            var analysis = new ItemAnalysis();

            double conf;

            analysis.ItemName           = GetText(itemListing.Name, engine, out conf);
            analysis.ItemNameConfidence = conf;

            analysis.Highest           = TryParse(GetText(itemListing.Highest, engine, out conf));
            analysis.HighestConfidence = conf;
            if (analysis.Highest == -1)
            {
                analysis.HighestConfidence = 0;
            }

            analysis.Lowest           = TryParse(GetText(itemListing.Lowest, engine, out conf));
            analysis.LowestConfidence = conf;
            if (analysis.Lowest == -1)
            {
                analysis.LowestConfidence = 0;
            }

            analysis.MarketPrice           = TryParse(GetText(itemListing.MarketPrice, engine, out conf));
            analysis.MarketPriceConfidence = conf;
            if (analysis.MarketPrice == -1)
            {
                analysis.MarketPriceConfidence = 0;
            }

            analysis.LastPrice           = TryParse(GetText(itemListing.LastSalePrice, engine, out conf));
            analysis.LastPriceConfidence = conf;
            if (analysis.LastPrice == -1)
            {
                analysis.LastPriceConfidence = 0;
            }

            analysis.TotalTrades           = TryParse(GetText(itemListing.TotalSales, engine, out conf));
            analysis.TotalTradesConfidence = conf;
            if (analysis.TotalTrades == -1)
            {
                analysis.TotalTradesConfidence = 0;
            }

            analysis.CurrentListings           = TryParse(GetText(itemListing.CurrentListings, engine, out conf));
            analysis.CurrentListingsConfidence = conf;
            if (analysis.CurrentListings == -1)
            {
                analysis.CurrentListingsConfidence = 0;
            }

            analysis.Icon = itemListing.Icon.GetColorData();
            //analysis.IsEnhanced = IsEnhanced(analysis.Icon, analysis.ItemName);

            return(analysis);
        }
コード例 #13
0
    private void CreateNewItemListing(Food food)
    {
        GameObject  itemListingGO = Instantiate(itemListingPrefab, itemGrid.transform);
        ItemListing itemListing   = itemListingGO.GetComponent <ItemListing>();

        itemListing.ItemName.text  = food.Name;
        itemListing.ItemCount.text = "1";
        itemListing.ApplyIcon();
        itemList.Add(itemListing);
    }
コード例 #14
0
    private ItemListing GetItemListingForId(bool createNewListing, int id, int amount = 0)
    {
        if (createNewListing)
        {
            var itemListing = new ItemListing(ItemDataManager.GetItemById(id), amount);
            inventoryListingsByItemId.Add(id, itemListing);
        }

        return(inventoryListingsByItemId[id]);
    }
コード例 #15
0
 int SortItemsAlphaNumeric(ItemListing a, ItemListing b)
 {
     if (sortDirection == 0)
     {
         return(AlphaSort(a.name, b.name));
     }
     else
     {
         return(AlphaSort(b.name, a.name));
     }
 }
コード例 #16
0
 int SortItemsCategory(ItemListing a, ItemListing b)
 {
     if (sortDirection == 0)
     {
         return(AlphaSort(a.category, b.category));
     }
     else
     {
         return(AlphaSort(b.category, a.category));
     }
 }
コード例 #17
0
        public void EditSetup()
        {
            SupplierManager mySupMan = new SupplierManager();

            mySupMan.AddANewSupplier(testSupp, "Test");
            modSupp = getSupplierListCompName(suppList);
            itemListingToEdit.SupplierID = modSupp.SupplierID;
            ItemListingAccessor.AddItemListing(itemListingToTest);
            itemListingToTest            = getItemListingTestObject(itemList);
            itemListingToEdit.SupplierID = modSupp.SupplierID;
        }
コード例 #18
0
 int SortItemsLastUpdated(ItemListing a, ItemListing b)
 {
     if (sortDirection == 1)
     {
         return(a.lastUpdatedRaw.CompareTo(b.lastUpdatedRaw));
     }
     else
     {
         return(b.lastUpdatedRaw.CompareTo(a.lastUpdatedRaw));
     }
 }
コード例 #19
0
    private void SpawnButtonForItemListing(ItemListing i)
    {
        if (inventoryButtons == null)
        {
            inventoryButtons = new List <InventoryButton>();
        }

        InventoryButton inventoryButton = SpawnInventoryButtonFromPrefab();

        inventoryButton.SetFromItemListing(i);

        inventoryButtons.Add(inventoryButton);
    }
コード例 #20
0
    private void AddItemToInventory(Item item, int amount)
    {
        bool addingNew = !Owned(item.itemId);

        ItemListing listing = this.GetItemListingForId(addingNew, item.itemId);

        listing.Add(amount);

        InventoryAdjustment adjustment = addingNew ? InventoryAdjustment.ADD : InventoryAdjustment.UPDATE;
        var adjustmentArgs             = new InventoryAdjustmentEventArgs(listing, adjustment);

        InventoryAdjusted.BroadcastEvent(this, adjustmentArgs);
    }
        public void Print(String ProductID, String ProductID_2, Boolean isLanded) // Product Listing Report
        {
            String Sql = "";

            if (ProductID.Trim().Length > 0 && ProductID_2.Trim().Length > 0)
            {
                Sql = String.Format(" And ProductID >='{0}' And ProductID<='{1}' ", ProductID, ProductID_2);
            }

            if (ProductID.Trim().Length > 0 && ProductID_2.Trim().Length == 0)
            {
                Sql = String.Format(" And ProductID ='{0}'", ProductID);
            }


            frmViewReport oViewReport = new frmViewReport();

            ItemListing           oRpt   = new ItemListing();
            ItemListingLandedCost oRpt_1 = new ItemListingLandedCost();

            DataSet ds = new DataSet();

            if (isLanded)
            {
                ds.Tables.Add(oMySql.GetDataTable("Select ProductID, Description, Size,VendorItem,ONPO,Commited,Sold,Received,p.UnitCost as Cost  From Product p Where CompanyID='" + CompanyID + "'" + Sql, "Product"));
            }
            else
            {
                ds.Tables.Add(oMySql.GetDataTable("Select p.*,p.Cost as FinalCost  From Product p Where CompanyID='" + CompanyID + "'" + Sql, "Product"));
            }



            //  ds.WriteXml("dataset1002.xml", XmlWriteMode.WriteSchema);

            oRpt.SetDataSource(ds);


            //oRpt.PrintToPrinter(1, true, 1, 100);
            if (isLanded)
            {
                oRpt.SetParameterValue("Title", "ITEM LISTING LANDED COST");
                oViewReport.cReport.ReportSource = oRpt;
            }
            else
            {
                oRpt.SetParameterValue("Title", "ITEM LISTING");
                oViewReport.cReport.ReportSource = oRpt;
            }
            oViewReport.ShowDialog();
        }
コード例 #22
0
    public void renderInventory(Inventory inventory)
    {
        clearSlots();
        List <ItemListing> itemList = inventory.itemList;

        for (int i = 0; i < itemList.Count; i++)
        {
            ItemListing listing     = itemList[i];
            GameObject  slot        = itemSlots[i];
            Text        itemSlotGui = slot.GetComponent <Text>();
            itemSlotGui.text    = listing.item.name;
            itemSlotGui.enabled = true;
        }
    }
コード例 #23
0
        /// <summary>
        /// Miguel Santana
        /// Created:  2015/04/05
        /// Initializes the AddEditListing screen if it is edit or readonly
        /// Combined the Edit/Add screens
        /// </summary>
        /// <exception cref="WanderingTurtleException">Occurs making components readonly.</exception>
        public AddEditListing(ItemListing currentItemListing, bool readOnly = false)
        {
            CurrentItemListing = currentItemListing;
            Setup();
            Title = "Editing Listing: " + CurrentItemListing.EventName;

            EventCbox.IsEnabled    = false;
            SupplierCbox.IsEnabled = false;

            if (readOnly)
            {
                (Content as Panel).MakeReadOnly(BtnCancel);
            }
        }
コード例 #24
0
        public void BuyItem_Fails_If_Buyer_Is_Seller()
        {
            var seller = PartyA;

            this.mockPersistentState.Setup(s => s.GetAddress(nameof(ItemListing.Seller))).Returns(seller);

            this.mockContractState.Setup(s => s.Message.Sender).Returns(ParentContract);
            var itemListing = new ItemListing(this.mockContractState.Object, "Test", 1, seller, ParentContract, PartyA, PartyB);

            // Make the sender the seller.
            this.mockContractState.Setup(s => s.Message.Sender).Returns(seller);

            Assert.Throws <SmartContractAssertException>(() => itemListing.BuyItem());
        }
コード例 #25
0
        /// <summary>
        /// Tyler Collins
        /// Created: 2015/02/10
        /// Retrieves ItemListing data from the Database using a Stored Procedure.
        /// Creates an ItemListing object.
        /// </summary>
        /// <remarks>
        /// Tyler Collins
        /// Updated:  2015/02/26
        /// Now up to date with most recent ItemListing object class
        /// </remarks>
        /// <param name="itemListID">Requires the ItemListID to SELECT the correct ItemListing record.</param>
        /// <returns>ItemListing object</returns>
        public static ItemListing GetItemListing(string itemListID)
        {
            ItemListing itemListingToRetrieve = new ItemListing();

            SqlConnection conn            = DatabaseConnection.GetDatabaseConnection();
            string        storedProcedure = "spSelectItemListing";
            SqlCommand    cmd             = new SqlCommand(storedProcedure, conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@ItemListID", itemListID);

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();

                    itemListingToRetrieve.StartDate  = reader.GetDateTime(0);
                    itemListingToRetrieve.EndDate    = reader.GetDateTime(1);
                    itemListingToRetrieve.ItemListID = reader.GetInt32(2);
                    itemListingToRetrieve.EventID    = reader.GetInt32(3);
                    itemListingToRetrieve.Price      = reader.GetDecimal(4);

                    //Are we using QuanityOffered and ProductSize since these are Event Items? O.o
                    itemListingToRetrieve.SupplierID       = reader.GetInt32(5);
                    itemListingToRetrieve.MaxNumGuests     = reader.GetInt32(7);
                    itemListingToRetrieve.MinNumGuests     = reader.GetInt32(8);
                    itemListingToRetrieve.CurrentNumGuests = reader.GetInt32(6);
                }
                else
                {
                    var pokeball = new ApplicationException("Requested ID did not match any records.");
                    throw pokeball;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }

            return(itemListingToRetrieve);
        }
コード例 #26
0
        private static List <ItemValue> GetItemValues(List <ItemStack> itemStacks, List <ItemListing> itemListings, List <Item> items)
        {
            var itemValues = new List <ItemValue>();

            foreach (ItemStack itemStack in itemStacks)
            {
                if (itemStack == null)
                {
                    continue;
                }

                //Retrieve item bound status and vendor price
                bool      isBound     = false;
                ItemPrice vendorPrice = null;

                if (items.Any(i => i.ID == itemStack.ID))
                {
                    Item item = items.Single(i => i.ID == itemStack.ID);
                    if (IsBound(item))
                    {
                        isBound = true;
                    }
                    if (items.Any(i => i.ID == item.ID))
                    {
                        if (IsSellable(item))
                        {
                            vendorPrice = new ItemPrice(items.Single(i => i.ID == item.ID).VendorValue);
                        }
                    }
                }

                //Retrieve itemListing
                ItemListing itemListing = null;

                if (itemListings.Any(i => i.ID == itemStack.ID))
                {
                    itemListing = itemListings.Single(i => i.ID == itemStack.ID);
                }

                itemValues.Add(new ItemValue()
                {
                    IsBound     = isBound,
                    ItemStack   = itemStack,
                    VendorPrice = vendorPrice,
                    ItemListing = itemListing
                });
            }
            return(itemValues);
        }
コード例 #27
0
    //You do not have a stack of this item
    public void itemHasNotBeenFound(Item item)
    {
        ItemListing instancedItemListingPrefab = Instantiate(itemListingPrefab, itemListingParent);

        Item instancedItem = item;

        currentTotalCarryWeight = currentTotalCarryWeight + instancedItem.ItemWeight;
        WeightCheck();

        items.Add(instancedItem);
        //Instantiate the listing if item not found.
        itemListings.Add(instancedItemListingPrefab);

        instancedItemListingPrefab.GetComponent <ItemListing>().InitItemListing(instancedItem);
    }
コード例 #28
0
        /// <summary>
        /// Hunter Lind
        /// Created:  2015/02/18
        /// validates the user input and passes data to Business logic
        /// </summary>
        /// <remarks>
        /// Miguel Santana
        /// Updated:  2015/04/05
        /// Combined Edit and Add screens
        /// </remarks>
        private async void AddItemListing()
        {
            if (!Validator())
            {
                return;
            }
            ItemListing newListing = new ItemListing();

            try
            {
                DateTime formStartDate = (DateTime)(DateStart.SelectedDate);
                DateTime formEndDate   = (DateTime)(DateEnd.SelectedDate);

                DateTime formStartTime = (DateTime)(TpStartTime.Value);
                DateTime formEndTime   = (DateTime)(TpEndTime.Value);

                //date is your existing Date object, time is the nullable DateTime object from your TimePicker
                newListing.StartDate = DateTime.Parse(string.Format("{0} {1}", formStartDate.ToShortDateString(), formStartTime.ToLongTimeString()));
                newListing.EndDate   = DateTime.Parse(string.Format("{0} {1}", formEndDate.ToShortDateString(), formEndTime.ToLongTimeString()));

                if (newListing.StartDate > newListing.EndDate)
                {
                    throw new WanderingTurtleException(this, "End Date must be after Start Date");
                }

                newListing.EventID      = ((Event)EventCbox.SelectedItem).EventItemID;
                newListing.SupplierID   = ((Supplier)SupplierCbox.SelectedItem).SupplierID;
                newListing.Price        = (decimal)(UdPrice.Value);
                newListing.MaxNumGuests = (int)(UdSeats.Value);
            }
            catch (Exception)
            {
                throw new WanderingTurtleException(this, "Please enter valid start and end dates.");
            }

            try
            {
                _productManager.AddItemListing(newListing);
                await this.ShowMessageDialog("Listing successfully added!");

                DialogResult = true;
                Close();
            }
            catch (Exception)
            {
                throw new WanderingTurtleException(this, "Error adding the Item Listing.");
            }
        }
コード例 #29
0
        public void EditItemListing_DateInPast()
        {
            Setup();

            EditSetup();
            itemListingToEdit.StartDate = new DateTime(2014, 5, 28, 10, 30, 0);
            itemListingToEdit.EndDate   = new DateTime(2015, 5, 28, 8, 30, 0);
            itemListingToTest           = itemListingToEdit;

            listResult actual = pMgr.EditItemListing(itemListingToEdit, itemListingToTest);

            Setup();
            Cleanup();

            Assert.AreEqual(listResult.DateInPast, actual);
        }
コード例 #30
0
        public CommerceServiceTest()
        {
            _updatedPrice = new ItemPrice
            {
                Buys = new Listing {Quantity = 100, UnitPrice = 125},
                Sells = new Listing {Quantity = 200, UnitPrice = 250}
            };

            _updatedListing = new ItemListing
            {
                Buys = new Listing[] {new Listing {Quantity = 100, UnitPrice = 125}},
                Sells = new Listing[] {new Listing {Quantity = 200, UnitPrice = 250}}
            };

            _tpWrapper = new TradingPostApiWrapperMock(_updatedPrice, _updatedListing);
            _testDataFactory = new TestDataFactory();
        }
コード例 #31
0
    private void DownloadItem(ItemListing listing, bool silentInstall = false)
    {
        downloading = true;
#if UNITY_2018_3_OR_NEWER
        downloadConnection = UnityWebRequest.Get(baseAddress + listing.url);
        downloadConnection.SendWebRequest();
#else
        downloadConnection = new WWW(baseAddress + listing.url);
#endif
        currentExtension = listing.name;

        ContinuationManager.Add(() => downloadConnection.isDone, () =>
        {
            if (downloading)
            {
                downloading = false;
                if (!string.IsNullOrEmpty(downloadConnection.error))
                {
                    Debug.LogError(downloadConnection.error);
                    ShowNotification(new GUIContent(currentExtension + " - Download Failed"));
                }
                else if (downloadConnection.isDone)
                {
#if UNITY_2018_3_OR_NEWER
                    File.WriteAllBytes(Application.dataPath + "/" + currentExtension + ".unitypackage", downloadConnection.downloadHandler.data);
#else
                    File.WriteAllBytes(Application.dataPath + "/" + currentExtension + ".unitypackage", downloadConnection.bytes);
#endif
                    if (!silentInstall)
                    {
                        ShowNotification(new GUIContent(currentExtension + " Downloaded"));
                    }
                    AssetDatabase.ImportPackage(Application.dataPath + "/" + currentExtension + ".unitypackage", !silentInstall);
                    File.Delete(Application.dataPath + "/" + currentExtension + ".unitypackage");
                    if (silentInstall)
                    {
                        Close();
                    }
                }
                else
                {
                    ShowNotification(new GUIContent(currentExtension + " Download Cancelled"));
                }
            }
        });
    }
コード例 #32
0
ファイル: frmMain.cs プロジェクト: CorlenS/ROILootManager
        public frmMain()
        {
            InitializeComponent();
            Refresh();
            logger.Info("Main form initialized.");

            try {
                roster = new Roster();
                lootLog = new LootLog();
                logReader = new LogReader();
                logReader.logEvent += new LogReaderEvent(logReaderEvent);
                itemListing = new ItemListing();

                string savedFile = PropertyManager.getManager().getProperty("EQlogFile");
                if (savedFile != null) {
                    if (logReader.setLogFile(savedFile)) {
                        logReader.start();
                        grpChatLogs.Text = String.Format("Chat Logs ({0})", savedFile);
                    }

                }

                logRefresher = new Thread(updateLootLog);
                logRefresher.Start();

                this.Text = "ROI Loot Manager - v" + Constants.PROGRAM_VERSION;

            } catch (Exception e) {
                string message = "Could not get one of the worksheets used. A severe error occured or you may not have access. The program will close.";
                logger.Error(message, e);
                MessageBox.Show(message);
                System.Environment.Exit(-1);
            }

            cmbName.DataSource = roster.getActiveNames();
            cmbName.DisplayMember = Roster.NAME_COL;
            cmbName.ValueMember = Roster.NAME_COL;
            cmbName.SelectedIndex = -1;

            cmbEvent.DataSource = lootLog.getEvents();
            cmbEvent.DisplayMember = "shortName";
            cmbEvent.ValueMember = "shortName";
            cmbEvent.SelectedIndex = -1;

            cmbSlot.DataSource = lootLog.getArmorTypes();
            cmbSlot.DisplayMember = "armorType";
            cmbSlot.ValueMember = "armorType";
            cmbSlot.SelectedIndex = -1;

            dteRaidDate.Value = DateTime.Today;

            updateEqLogControls();

            loadRosterNames();

            List<String> savedTierList = new List<String>(PropertyManager.getManager().getProperty(PropertyManager.LAST_TIER_SELECTED).Split(','));
            List<String> tierList = lootLog.getTiers();

            foreach(String t in tierList) {

                ListViewItem item = new ListViewItem(t);
                item.Text = t;
                item.Name = t;

                if (savedTierList.Contains(t)) {
                    item.Checked = true;
                }

                lvTierSelection.Items.Add(item);
            }

            includeRots = false;

            chkIncludeRots.Checked = includeRots;

            dgvLootSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvVisibleSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvNonVisibleSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvWeaponSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            lvRosterNames.ItemChecked += new ItemCheckedEventHandler(lvRosterNames_ItemChecked);
            lvTierSelection.ItemChecked += new ItemCheckedEventHandler(lvTierSelection_ItemChecked);
        }
コード例 #33
0
 public TradingPostApiWrapperMock(ItemPrice priceToReturn, ItemListing listingToReturn)
 {
     _priceToReturn = priceToReturn;
     _listingToReturn = listingToReturn;
     ExceptionToThrow = TestException.None;
 }