public void SetOptions(int itemOptionSetId)
        {
            int index = 0;

            Visibility = Visibility.Visible;
            ItemOptionSet set = ItemOptionSet.Get(itemOptionSetId);

            IsBeingUsed = !set.IsPizzaStyle;
            if (IsBeingUsed)
            {
                foreach (ItemOption option in ItemOption.GetInSet(itemOptionSetId))
                {
                    TextBlockButton button = Buttons[index];
                    button.Tag        = option.Id.ToString(CultureInfo.InvariantCulture);
                    button.IsChecked  = false;
                    button.Text       = StringHelper.ThinString(option.Name);
                    button.Visibility = Visibility.Visible;
                    index++;
                }
                SelectedMaximum = set.SelectedMaximum;
                SelectedMinimum = set.SelectedMinimum;
            }
            for (int i = index; i < Buttons.Length; i++)
            {
                TextBlockButton button = Buttons[i];
                button.Tag        = "0";
                button.IsChecked  = false;
                button.Text       = "";
                button.Visibility = Visibility.Hidden;
            }
        }
Exemple #2
0
        // Roll new bonus stats and values
        public static List <ItemStat> RollBonusStats(int itemId, int rarity, int level)
        {
            if (!ItemOptionsMetadataStorage.GetRandomBonus(itemId, out List <ItemOption> randomBonusList))
            {
                return(null);
            }

            Random     random     = new Random();
            ItemOption itemOption = randomBonusList.FirstOrDefault(options => options.Rarity == rarity && options.Slots > 0);

            if (itemOption == null)
            {
                return(null);
            }

            List <ItemStat> itemStats = new List <ItemStat>();

            foreach (ItemAttribute attribute in itemOption.Stats)
            {
                itemStats.Add(NormalStat.Of(GetRange(itemId)[attribute][Roll(level)]));
            }

            foreach (SpecialItemAttribute attribute in itemOption.SpecialStats)
            {
                itemStats.Add(SpecialStat.Of(GetSpecialRange(itemId)[attribute][Roll(level)]));
            }

            return(itemStats.OrderBy(x => random.Next()).Take(itemOption.Slots).ToList());
        }
Exemple #3
0
        // Roll new bonus stats and values except the locked stat
        public static List <ItemStat> RollBonusStatsWithStatLocked(int itemId, int rarity, int slots, int level, short ignoreStat, bool isSpecialStat)
        {
            if (!ItemOptionsMetadataStorage.GetRandomBonus(itemId, out List <ItemOption> randomBonusList))
            {
                return(null);
            }

            Random     random     = new Random();
            ItemOption itemOption = randomBonusList.FirstOrDefault(options => options.Rarity == rarity && options.Slots > 0);

            if (itemOption == null)
            {
                return(null);
            }

            List <ItemStat> itemStats = new List <ItemStat>();

            List <ItemAttribute>        attributes        = isSpecialStat ? itemOption.Stats : itemOption.Stats.Where(x => (short)x != ignoreStat).ToList();
            List <SpecialItemAttribute> specialAttributes = isSpecialStat ? itemOption.SpecialStats.Where(x => (short)x != ignoreStat).ToList() : itemOption.SpecialStats;

            foreach (ItemAttribute attribute in attributes)
            {
                itemStats.Add(NormalStat.Of(GetRange(itemId)[attribute][Roll(level)]));
            }

            foreach (SpecialItemAttribute attribute in specialAttributes)
            {
                itemStats.Add(SpecialStat.Of(GetSpecialRange(itemId)[attribute][Roll(level)]));
            }

            return(itemStats.OrderBy(x => random.Next()).Take(slots).ToList());
        }
        public static List <ItemOption> List()
        {
            List <ItemOption> ItemOptionList = new List <ItemOption>();
            SqlConnection     connection     = OnlineSales2Data.GetConnection();
            string            selectStatement
                = "SELECT "
                  + "     [ItemOptionId] "
                  + "FROM "
                  + "     [ItemOption] "
                  + "";
            SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

            try
            {
                connection.Open();
                SqlDataReader reader     = selectCommand.ExecuteReader();
                ItemOption    ItemOption = new ItemOption();
                while (reader.Read())
                {
                    ItemOption = new ItemOption();
                    ItemOption.ItemOptionId = System.Convert.ToInt32(reader["ItemOptionId"]);
                    ItemOptionList.Add(ItemOption);
                }
                reader.Close();
            }
            catch (SqlException)
            {
                return(ItemOptionList);
            }
            finally
            {
                connection.Close();
            }
            return(ItemOptionList);
        }
        private void ProcessItemOption(IEnumerable <TicketItemOption> ticketItemOptions,
                                       int setId, ref string itemName)
        {
            bool found = false;

            foreach (TicketItemOption ticketItemOption in ticketItemOptions)
            {
                foreach (ItemOption itemOption in ItemOption.GetInSet(setId))
                {
                    if (itemOption.Id == ticketItemOption.ItemOptionId)
                    {
                        if (found)
                        {
                            itemName += ", ";
                        }
                        found     = true;
                        itemName += itemOption.Name;
                    }
                }
            }
            if (found)
            {
                itemName += Environment.NewLine;
            }
        }
Exemple #6
0
        // Roll new bonus stats and values except the locked stat
        public static List <ItemStat> RollBonusStatsWithStatLocked(Item item, short ignoreStat, bool isSpecialStat)
        {
            int  id        = item.Id;
            int  level     = item.Level;
            bool isTwoHand = item.IsTwoHand;

            if (!ItemOptionsMetadataStorage.GetRandomBonus(id, out List <ItemOption> randomBonusList))
            {
                return(null);
            }

            Random     random     = new Random();
            ItemOption itemOption = randomBonusList.FirstOrDefault(options => options.Rarity == item.Rarity && options.Slots > 0);

            if (itemOption == null)
            {
                return(null);
            }

            List <ItemStat> itemStats = new List <ItemStat>();

            List <ItemAttribute>        attributes        = isSpecialStat ? itemOption.Stats : itemOption.Stats.Where(x => (short)x != ignoreStat).ToList();
            List <SpecialItemAttribute> specialAttributes = isSpecialStat ? itemOption.SpecialStats.Where(x => (short)x != ignoreStat).ToList() : itemOption.SpecialStats;

            foreach (ItemAttribute attribute in attributes)
            {
                Dictionary <ItemAttribute, List <ParserStat> > dictionary = GetRange(id);
                if (!dictionary.ContainsKey(attribute))
                {
                    continue;
                }

                NormalStat normalStat = NormalStat.Of(dictionary[attribute][Roll(level)]);
                if (isTwoHand)
                {
                    normalStat.Flat    *= 2;
                    normalStat.Percent *= 2;
                }
                itemStats.Add(normalStat);
            }

            foreach (SpecialItemAttribute attribute in specialAttributes)
            {
                Dictionary <SpecialItemAttribute, List <ParserSpecialStat> > dictionary = GetSpecialRange(id);
                if (!dictionary.ContainsKey(attribute))
                {
                    continue;
                }

                SpecialStat specialStat = SpecialStat.Of(dictionary[attribute][Roll(level)]);
                if (isTwoHand)
                {
                    specialStat.Flat    *= 2;
                    specialStat.Percent *= 2;
                }
                itemStats.Add(specialStat);
            }

            return(itemStats.OrderBy(x => random.Next()).Take(item.Stats.BonusStats.Count).ToList());
        }
Exemple #7
0
        private void AddRandomExcOptions(Item item)
        {
            var possibleItemOptions = item.Definition.PossibleItemOptions;
            var excellentOptions    = possibleItemOptions.FirstOrDefault(o => o.PossibleOptions.Any(p => p.OptionType == ItemOptionTypes.Excellent));

            if (excellentOptions == null)
            {
                return;
            }

            for (int i = item.ItemOptions.Count(o => o.ItemOption.OptionType == ItemOptionTypes.Excellent); i < excellentOptions.MaximumOptionsPerItem; i++)
            {
                if (i == 0)
                {
                    var itemOptionLink = new ItemOptionLink();
                    itemOptionLink.ItemOption = excellentOptions.PossibleOptions.SelectRandom(this.randomizer);
                    item.ItemOptions.Add(itemOptionLink);
                    continue;
                }

                if (this.randomizer.NextRandomBool(excellentOptions.AddChance))
                {
                    ItemOption option = excellentOptions.PossibleOptions.SelectRandom(this.randomizer);
                    while (item.ItemOptions.Any(o => o.ItemOption == option))
                    {
                        option = excellentOptions.PossibleOptions.SelectRandom(this.randomizer);
                    }

                    var itemOptionLink = new ItemOptionLink();
                    itemOptionLink.ItemOption = option;
                    item.ItemOptions.Add(itemOptionLink);
                }
            }
        }
Exemple #8
0
        // Get basic stats
        public List <ItemStat> GetBasicStats(int itemId, int rarity, int level, bool isTwoHand)
        {
            if (!ItemOptionsMetadataStorage.GetBasic(itemId, out List <ItemOption> basicList))
            {
                return(null);
            }
            ItemOption itemOptions = basicList.Find(options => options.Rarity == rarity);

            if (itemOptions == null)
            {
                return(null);
            }

            // Weapon and pet atk comes from each Item option and not from stat ranges
            if (itemOptions.MaxWeaponAtk != 0)
            {
                BasicStats.Add(NormalStat.Of(ItemAttribute.MinWeaponAtk, itemOptions.MinWeaponAtk));
                BasicStats.Add(NormalStat.Of(ItemAttribute.MaxWeaponAtk, itemOptions.MaxWeaponAtk));
            }
            if (itemOptions.PetAtk != 0)
            {
                BasicStats.Add(NormalStat.Of(ItemAttribute.PetBonusAtk, itemOptions.PetAtk));
            }

            List <ItemStat> itemStats = RollStats(itemId, level, isTwoHand, itemOptions);

            return(itemStats);
        }
Exemple #9
0
        private void DeleteOption()
        {
            FormattedListBoxItem item = listBoxOptions.SelectedItem as FormattedListBoxItem;

            if (item == null || (item.ReferenceObject == null))
            {
                return;
            }
            if (PosDialogWindow.ShowDialog(
                    Strings.ItemSetupConfirmDeleteItemOption, Strings.Confirmation,
                    DialogButtons.YesNo) != DialogButton.Yes)
            {
                return;
            }
            ItemOption option = item.ReferenceObject as ItemOption;

            if (option == null)
            {
                return;
            }
            option.Discontinue();
            listBoxOptions.Items.Remove(item);
            buttonDelete.IsEnabled         = false;
            editorControl.IsEnabled        = false;
            editorControl.ActiveItemOption = null;
        }
Exemple #10
0
    // Token: 0x0600030F RID: 783 RVA: 0x00017F44 File Offset: 0x00016144
    public Item clone()
    {
        Item item = new Item();

        item.template = this.template;
        if (this.options != null)
        {
            item.options = new MyVector();
            for (int i = 0; i < this.options.size(); i++)
            {
                ItemOption itemOption = new ItemOption();
                itemOption.optionTemplate = ((ItemOption)this.options.elementAt(i)).optionTemplate;
                itemOption.param          = ((ItemOption)this.options.elementAt(i)).param;
                item.options.addElement(itemOption);
            }
        }
        item.itemId       = this.itemId;
        item.playerId     = this.playerId;
        item.indexUI      = this.indexUI;
        item.quantity     = this.quantity;
        item.isLock       = this.isLock;
        item.sys          = this.sys;
        item.upgrade      = this.upgrade;
        item.buyCoin      = this.buyCoin;
        item.buyCoinLock  = this.buyCoinLock;
        item.buyGold      = this.buyGold;
        item.buyGoldLock  = this.buyGoldLock;
        item.saleCoinLock = this.saleCoinLock;
        item.typeUI       = this.typeUI;
        item.isExpires    = this.isExpires;
        return(item);
    }
Exemple #11
0
        public ActionResult Edit([Bind(Include =
                                           " ItemOptionId"
                                           + ",Description"
                                       )] ItemOption ItemOption)
        {
            ItemOption oItemOption = new ItemOption();

            oItemOption.ItemOptionId = System.Convert.ToInt32(ItemOption.ItemOptionId);
            oItemOption = ItemOptionData.Select_Record(ItemOption);

            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = ItemOptionData.Update(oItemOption, ItemOption);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Update");
                }
            }

            return(View(ItemOption));
        }
        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);

            Event.ConfigureForDatabase(builder);
            Region.ConfigureForDatabase(builder);
            LocationGroup.ConfigureForDatabase(builder);
            Location.ConfigureForDatabase(builder);

            BagCategory.ConfigureForDatabase(builder);
            Item.ConfigureForDatabase(builder);
            PlacedItem.ConfigureForDatabase(builder);
            Currency.ConfigureForDatabase(builder);
            CurrencyAmount.ConfigureForDatabase(builder);

            ElementalType.ConfigureForDatabase(builder);
            ElementalTypeRelation.ConfigureForDatabase(builder);
            Ability.ConfigureForDatabase(builder);
            PvpTier.ConfigureForDatabase(builder);
            PokemonAvailability.ConfigureForDatabase(builder);
            PokemonVarietyUrl.ConfigureForDatabase(builder);

            Entities.PokemonSpecies.ConfigureForDatabase(builder);
            PokemonVariety.ConfigureForDatabase(builder);
            PokemonForm.ConfigureForDatabase(builder);
            Evolution.ConfigureForDatabase(builder);

            MoveDamageClass.ConfigureForDatabase(builder);
            Move.ConfigureForDatabase(builder);
            MoveTutor.ConfigureForDatabase(builder);
            MoveTutorMove.ConfigureForDatabase(builder);
            MoveTutorMovePrice.ConfigureForDatabase(builder);
            MoveLearnMethod.ConfigureForDatabase(builder);
            MoveLearnMethodLocation.ConfigureForDatabase(builder);
            MoveLearnMethodLocationPrice.ConfigureForDatabase(builder);
            LearnableMove.ConfigureForDatabase(builder);
            LearnableMoveLearnMethod.ConfigureForDatabase(builder);

            TimeOfDay.ConfigureForDatabase(builder);
            Season.ConfigureForDatabase(builder);
            SeasonTimeOfDay.ConfigureForDatabase(builder);
            SpawnType.ConfigureForDatabase(builder);
            Spawn.ConfigureForDatabase(builder);
            SpawnOpportunity.ConfigureForDatabase(builder);

            Nature.ConfigureForDatabase(builder);
            HuntingConfiguration.ConfigureForDatabase(builder);
            Build.ConfigureForDatabase(builder);
            ItemOption.ConfigureForDatabase(builder);
            MoveOption.ConfigureForDatabase(builder);
            NatureOption.ConfigureForDatabase(builder);

            ItemStatBoost.ConfigureForDatabase(builder);
            Entities.ItemStatBoostPokemon.ConfigureForDatabase(builder);

            ImportSheet.ConfigureForDatabase(builder);
        }
Exemple #13
0
        public SearchProject(String q, string teamIDStr, string myIDStr)
        {
            int teamID = Convert.ToInt32(teamIDStr);
            int myID   = Convert.ToInt32(myIDStr);

            var itemOptions = new List <ItemOption>();

            var dbml = new ProjectModelDbEntities();
            //?

            List <Sales_JobMasterList> projects =
                dbml.Sales_JobMasterList.Where(x => (x.FW_Employees.Team == teamID | teamID == 0) &
                                               (myID == x.sales | myID == x.sa1ID | myID == 5020) |
                                               myID == x.sales |
                                               myID == x.sa1ID
                                               ).OrderBy(x => x.jobTitle).ToList();

            string[] search = q.Split(' ');

            try
            {
                foreach (Sales_JobMasterList item in projects)
                {
                    if (IsThisJobAlreadSelected(item.jobID, itemOptions))
                    {
                        continue;
                    }

                    string namevalue = item.jobTitle + " - " + item.jobNumber;
                    if (!MyString.IsContainsAny(namevalue, search))
                    {
                        continue;
                    }


                    var st = new ItemOption
                    {
                        Name       = namevalue,
                        SelectedID = Convert.ToString(item.jobID),
                        Value      = namevalue
                    };
                    itemOptions.Add(st);
                }
            }


            catch (Exception ex)
            {
                string exp = ex.ToString(); //Setup a breakpoint here to verify any exceptions raised.
            }

            //Return
            Items = itemOptions;
        }
Exemple #14
0
 // Token: 0x0600030E RID: 782 RVA: 0x00017EF8 File Offset: 0x000160F8
 public bool isHaveOption(int id)
 {
     for (int i = 0; i < this.itemOption.Length; i++)
     {
         ItemOption itemOption = this.itemOption[i];
         if (itemOption != null && itemOption.optionTemplate.id == id)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #15
0
        public SearchWorkorderByNumber(String q, string teamIDStr, string myIDStr)
        {
            string[] search          = q.Split(' ');
            var      workorderNumber = search[0];
            int      teamID          = Convert.ToInt32(teamIDStr);
            int      myID            = Convert.ToInt32(myIDStr);

            var itemOptions = new List <ItemOption>();

            var dbml = new ProjectModelDbEntities();

            List <Sales_JobMasterList_WO> query;

            if (workorderNumber.Length == 7)
            {
                query = dbml.Sales_JobMasterList_WO.Where(x => x.WorkorderNumber == workorderNumber).ToList();
            }
            else
            {
                query = dbml.Sales_JobMasterList_WO.Where(x => x.WorkorderNumber.Contains(workorderNumber)).ToList();
            }
            query = query.Where(
                x => x.FW_Employees.Team == teamID && myID == 5020 ||
                (teamID == 0 && myID == x.Sa1ID || myID == x.Sales || myID == 5020) ||
                myID == x.Sa1ID ||
                myID == x.Sales
                ).OrderBy(x => x.WorkorderNumber).ToList();

            try
            {
                foreach (Sales_JobMasterList_WO item in query)
                {
                    string namevalue = item.WorkorderNumber + "V" + item.woRev.ToString() + "-" + item.jobTitle;

                    var st = new ItemOption
                    {
                        Name       = namevalue,
                        SelectedID = Convert.ToString(item.woID),
                        Value      = namevalue
                    };
                    itemOptions.Add(st);
                }
            }

            catch (Exception ex)
            {
                string exp = ex.ToString(); //Setup a breakpoint here to verify any exceptions raised.
            }


            Items = itemOptions;
        }
Exemple #16
0
 public void Update()
 {
     if (ActiveItemOption == null)
     {
         if (radioButtonUsesIngredient.IsSelected)
         {
             ActiveItemOption = ItemOption.Add(ActiveItemOptionSet.Id,
                                               textBoxName.Text, GetCostForExtra(), true, GetIngredientId(),
                                               GetPortionAmount(), _measurementUnit);
         }
         else if (radioButtonUsesItem.IsSelected)
         {
             ActiveItemOption = ItemOption.Add(ActiveItemOptionSet.Id,
                                               textBoxName.Text, GetCostForExtra(), false, GetItemId(),
                                               GetPortionAmount(), _measurementUnit);
         }
         else
         {
             ActiveItemOption = ItemOption.Add(ActiveItemOptionSet.Id,
                                               textBoxName.Text, GetCostForExtra(), false, null, null, null);
         }
     }
     else
     {
         ActiveItemOption.SetName(textBoxName.Text);
         ActiveItemOption.SetCostForExtra(GetCostForExtra());
         if (radioButtonUsesIngredient.IsSelected)
         {
             ActiveItemOption.SetUsesIngredient(true);
             ActiveItemOption.SetProductId(GetIngredientId());
             ActiveItemOption.SetProductAmount(GetPortionAmount());
             ActiveItemOption.SetProductMeasurementUnit(_measurementUnit);
         }
         else if (radioButtonUsesItem.IsSelected)
         {
             ActiveItemOption.SetUsesIngredient(false);
             ActiveItemOption.SetProductId(GetItemId());
             ActiveItemOption.SetProductAmount(GetPortionAmount());
             ActiveItemOption.SetProductMeasurementUnit(MeasurementUnit.Unit);
         }
         else
         {
             ActiveItemOption.SetUsesIngredient(false);
             ActiveItemOption.SetProductId(null);
             ActiveItemOption.SetProductAmount(null);
             ActiveItemOption.SetProductMeasurementUnit(null);
         }
         ActiveItemOption.Update();
     }
 }
Exemple #17
0
        private void CreateSetGroup(int setLevel, ItemOption option, ICollection <ItemDefinition> group)
        {
            var setForDefense = this.Context.CreateNew <ItemSetGroup>();

            setForDefense.Name             = $"{group.First().Name.Split(' ')[0]} Defense Bonus (Level {setLevel})";
            setForDefense.MinimumItemCount = group.Count;
            setForDefense.Options.Add(option);
            setForDefense.SetLevel = (byte)setLevel;

            foreach (var item in group)
            {
                var itemOfSet = this.Context.CreateNew <ItemOfItemSet>();
                itemOfSet.ItemDefinition = item;
                setForDefense.Items.Add(itemOfSet);
            }
        }
Exemple #18
0
        public SearchProjectByNumber(String q, string teamIDStr, string myIDStr)
        {
            int teamID = Convert.ToInt32(teamIDStr);
            int myID   = Convert.ToInt32(myIDStr);

            var itemOptions = new List <ItemOption>();

            var dbml = new ProjectModelDbEntities();

            string[] search        = q.Split(' ');
            var      projectNumber = search[0];
            List <Sales_JobMasterList> projects;

            if (projectNumber.Length == 8)
            {
                projects = dbml.Sales_JobMasterList.Where(x => x.jobNumber == projectNumber).ToList();
            }
            else
            {
                projects = dbml.Sales_JobMasterList.Where(x => x.jobNumber.Contains(projectNumber)).ToList();
            }


            projects = projects.Where(x => (x.FW_Employees.Team == teamID | teamID == 0) &
                                      (myID == x.sales | myID == x.sa1ID | myID == 5020) |
                                      myID == x.sales |
                                      myID == x.sa1ID
                                      ).OrderBy(x => x.jobTitle).ToList();

            if (projects.Any())
            {
                foreach (Sales_JobMasterList item in projects)
                {
                    string namevalue = item.jobTitle + " - " + item.jobNumber;
                    var    st        = new ItemOption
                    {
                        Name       = namevalue,
                        SelectedID = Convert.ToString(item.jobID),
                        Value      = namevalue
                    };
                    itemOptions.Add(st);
                }
            }
            //Return
            Items = itemOptions;
        }
Exemple #19
0
        private void InitializeItemOptionsListBox()
        {
            IEnumerable <ItemOption> options = ItemOption.GetInSet(_activeItemOptionSet.Id);
            FormattedListBoxItem     first   = null;

            foreach (ItemOption option in options)
            {
                FormattedListBoxItem item = new FormattedListBoxItem(option,
                                                                     option.Name, true);
                if (first == null)
                {
                    first = item;
                }
                listBoxOptions.Items.Add(item);
            }
            listBoxOptions.UpdateLayout();
            listBoxOptions.ScrollIntoView(first);
        }
Exemple #20
0
        private ItemOptionLink GetOption(AttributeDefinition targetAttribute, float value)
        {
            var option = new ItemOption
            {
                OptionType        = ItemOptionTypes.Option,
                PowerUpDefinition = new PowerUpDefinition
                {
                    TargetAttribute = targetAttribute,
                    Boost           = new TestPowerUpDefinitionValue(new SimpleElement {
                        Value = value
                    })
                }
            };

            return(new ItemOptionLink {
                ItemOption = option, Level = 1
            });
        }
        public static ItemOption Select_Record(ItemOption ItemOptionPara)
        {
            ItemOption    ItemOption = new ItemOption();
            SqlConnection connection = OnlineSales2Data.GetConnection();
            string        selectStatement
                = "SELECT "
                  + "     [ItemOptionId] "
                  + "    ,[Description] "
                  + "FROM "
                  + "     [ItemOption] "
                  + "WHERE "
                  + "     [ItemOptionId] = @ItemOptionId "
                  + "";
            SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

            selectCommand.CommandType = CommandType.Text;
            selectCommand.Parameters.AddWithValue("@ItemOptionId", ItemOptionPara.ItemOptionId);
            try
            {
                connection.Open();
                SqlDataReader reader
                    = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    ItemOption.ItemOptionId = System.Convert.ToInt32(reader["ItemOptionId"]);
                    ItemOption.Description  = System.Convert.ToString(reader["Description"]);
                }
                else
                {
                    ItemOption = null;
                }
                reader.Close();
            }
            catch (SqlException)
            {
                return(ItemOption);
            }
            finally
            {
                connection.Close();
            }
            return(ItemOption);
        }
Exemple #22
0
        private void listBoxOptions_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((e.AddedItems == null) || (e.AddedItems.Count == 0))
            {
                return;
            }
            FormattedListBoxItem item = e.AddedItems[0] as FormattedListBoxItem;

            if (item == null)
            {
                return;
            }
            ItemOption option = item.ReferenceObject as ItemOption;

            editorControl.ActiveItemOptionSet = ActiveItemOptionSet;
            editorControl.ActiveItemOption    = option;
            editorControl.IsEnabled           = true;
            buttonDelete.IsEnabled            = true;
        }
Exemple #23
0
        // Get bonus stats
        public static List <ItemStat> GetBonusStats(int itemId, int rarity, int level, bool isTwoHand)
        {
            if (!ItemOptionsMetadataStorage.GetRandomBonus(itemId, out List <ItemOption> randomBonusList))
            {
                return(null);
            }

            Random     random     = new Random();
            ItemOption itemOption = randomBonusList.FirstOrDefault(options => options.Rarity == rarity && options.Slots > 0);

            if (itemOption == null)
            {
                return(null);
            }

            List <ItemStat> itemStats = RollStats(itemId, level, isTwoHand, itemOption);

            return(itemStats.OrderBy(x => random.Next()).Take(itemOption.Slots).ToList());
        }
Exemple #24
0
        public SearchInvoice(String q, string teamIDStr, string myIDStr)
        {
            int teamID = Convert.ToInt32(teamIDStr);
            int myID   = Convert.ToInt32(myIDStr);

            Items = new List <ItemOption>();
            var mi = new MyInvoice();
            List <Sales_JobMasterList_Invoice> items = mi.GetInvoicesBySalesID(myID);


            try
            {
                string[] search = q.Split(' ');

                if (items.Count == 0)
                {
                    return;
                }
                foreach (Sales_JobMasterList_Invoice item in items)
                {
                    string namevalue = item.invoiceNo + "V" + item.Revision.ToString() + "-" + item.Title;
                    if (!MyString.IsContainsAny(namevalue, search))
                    {
                        continue;
                    }

                    var st = new ItemOption
                    {
                        Name       = namevalue,
                        SelectedID = Convert.ToString(item.invoiceID),
                        Value      = namevalue
                    };
                    Items.Add(st);
                }
            }


            catch (Exception ex)
            {
                string exp = ex.ToString(); //Setup a breakpoint here to verify any exceptions raised.
            }
        }
Exemple #25
0
        public ActionResult Create([Bind(Include =
                                             "Description"
                                         )] ItemOption ItemOption)
        {
            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = ItemOptionData.Add(ItemOption);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Insert");
                }
            }

            return(View(ItemOption));
        }
        public static bool Update(ItemOption oldItemOption,
                                  ItemOption newItemOption)
        {
            SqlConnection connection = OnlineSales2Data.GetConnection();
            string        updateStatement
                = "UPDATE "
                  + "     [ItemOption] "
                  + "SET "
                  + "     [Description] = @NewDescription "
                  + "WHERE "
                  + "     [ItemOptionId] = @OldItemOptionId "
                  + " AND [Description] = @OldDescription "
                  + "";
            SqlCommand updateCommand = new SqlCommand(updateStatement, connection);

            updateCommand.CommandType = CommandType.Text;
            updateCommand.Parameters.AddWithValue("@NewDescription", newItemOption.Description);
            updateCommand.Parameters.AddWithValue("@OldItemOptionId", oldItemOption.ItemOptionId);
            updateCommand.Parameters.AddWithValue("@OldDescription", oldItemOption.Description);
            try
            {
                connection.Open();
                int count = updateCommand.ExecuteNonQuery();
                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (SqlException)
            {
                return(false);
            }
            finally
            {
                connection.Close();
            }
        }
Exemple #27
0
        private static void PrintTicketItemOptions(PosPrinter printer, TicketItem ticketItem)
        {
            Item item = Item.Get(ticketItem.ItemId);

            // Get the option sets for this category
            List <ItemOption> options1 = new List <ItemOption>(ItemOption.GetInSet(item.ItemOptionSetIds[0]));
            List <ItemOption> options2 = new List <ItemOption>(ItemOption.GetInSet(item.ItemOptionSetIds[1]));
            List <ItemOption> options3 = new List <ItemOption>(ItemOption.GetInSet(item.ItemOptionSetIds[2]));

            // Get the options for this ticket item's category
            List <TicketItemOption> ticketItemOptions = new List <TicketItemOption>(
                TicketItemOption.GetAll(ticketItem.PrimaryKey));

            if (options1.Count > 0)
            {
                string line = "";
                if (ProcessItemOption(ticketItemOptions, options1, ref line))
                {
                    PrintLineToReceipt(printer, PrinterEscapeCodes.SetSize(5) +
                                       "[" + line + "]");
                }
            }
            if (options2.Count > 0)
            {
                string line = "";
                if (ProcessItemOption(ticketItemOptions, options2, ref line))
                {
                    PrintLineToReceipt(printer, PrinterEscapeCodes.SetSize(5) +
                                       "[" + line + "]");
                }
            }
            if (options3.Count > 0)
            {
                string line = "";
                if (ProcessItemOption(ticketItemOptions, options3, ref line))
                {
                    PrintLineToReceipt(printer, PrinterEscapeCodes.SetSize(5) +
                                       "[" + line + "]");
                }
            }
        }
        public static bool Add(ItemOption ItemOption)
        {
            SqlConnection connection = OnlineSales2Data.GetConnection();
            string        insertStatement
                = "INSERT "
                  + "     [ItemOption] "
                  + "     ( "
                  + "     [Description] "
                  + "     ) "
                  + "VALUES "
                  + "     ( "
                  + "     @Description "
                  + "     ) "
                  + "";
            SqlCommand insertCommand = new SqlCommand(insertStatement, connection);

            insertCommand.CommandType = CommandType.Text;
            insertCommand.Parameters.AddWithValue("@Description", ItemOption.Description);
            try
            {
                connection.Open();
                int count = insertCommand.ExecuteNonQuery();
                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (SqlException)
            {
                return(false);
            }
            finally
            {
                connection.Close();
            }
        }
Exemple #29
0
        internal void SetItemOptions(Item item)
        {
            if ((item.ItemOptionSetIds[0] == 0) &&
                (item.ItemOptionSetIds[1] == 0) &&
                (item.ItemOptionSetIds[2] == 0))
            {
                Visibility = Visibility.Collapsed;
                Clear();
                return;
            }

            int           index = 0;
            ItemOptionSet set   = ItemOptionSet.Get(item.ItemOptionSetIds[0]);

            IsBeingUsed = set.IsPizzaStyle;
            Visibility  = (IsBeingUsed ? Visibility.Visible : Visibility.Collapsed);
            if (IsBeingUsed)
            {
                IEnumerable <ItemOption> options = ItemOption.GetInSet(item.ItemOptionSetIds[0]);
                foreach (ItemOption option in options)
                {
                    TextBlockButton button = Buttons[index];
                    button.Tag        = option.Id.ToString(CultureInfo.InvariantCulture);
                    button.IsChecked  = false;
                    button.Text       = StringHelper.ThinString(option.Name);
                    button.Visibility = Visibility.Visible;
                    index++;
                }
                //SelectedMaximum = set.SelectedMaximum;
                //SelectedMinimum = set.SelectedMinimum;
            }
            for (int i = index; i < Buttons.Count; i++)
            {
                TextBlockButton button = Buttons[i];
                button.Tag        = "0";
                button.IsChecked  = false;
                button.Text       = "";
                button.Visibility = Visibility.Hidden;
            }
        }
Exemple #30
0
        public SearchInvoiceByNumber(String q, string teamIDStr, string myIDStr)
        {
            Items = new List <ItemOption>();

            int teamID = Convert.ToInt32(teamIDStr);
            int myID   = Convert.ToInt32(myIDStr);

            string[] search    = q.Split(' ');
            string   invNumber = search[0];
            List <Sales_JobMasterList_Invoice> invoices;
            var db = new ProjectModelDbEntities();

            if (invNumber.Length == 7)
            {
                invoices = db.Sales_JobMasterList_Invoice.Where(x => x.invoiceNo == invNumber).ToList();
            }
            else
            {
                invoices = db.Sales_JobMasterList_Invoice.Where(x => x.invoiceNo.Contains(invNumber)).ToList();
            }

            invoices = invoices.Where(x => myID == x.Sales || myID == x.SA1 || myID == 5020).OrderBy(x => x.invoiceNo).ToList();

            if (invoices.Count == 0)
            {
                return;
            }
            foreach (Sales_JobMasterList_Invoice item in invoices)
            {
                string namevalue = item.invoiceNo + "V" + item.Revision.ToString() + "-" + item.Title;

                var st = new ItemOption
                {
                    Name       = namevalue,
                    SelectedID = Convert.ToString(item.invoiceID),
                    Value      = namevalue
                };
                Items.Add(st);
            }
        }