static Boolean ItemExist(Dictionary <string, int> C, String newItem)
        {
            foreach (KeyValuePair <string, int> Tran in C)
            {
                int cpt = 0;
                foreach (String ItemC in Tran.Key.Split(','))
                {
                    foreach (String ne in newItem.Trim().Split(','))
                    {
                        if (ItemC.Equals(ne))
                        {
                            cpt++; continue;
                        }
                    }
                }
                if (cpt == Tran.Key.Split(',').Count())
                {
                    return(true);
                }
            }



            return(false);
        }
        void LvitemItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            var litviewitem = (ListViewItem)e.Item;

            var items = new ItemC();

            btnitemnew.Text = "New";
            var it = items.GetOneItem(e.Item.SubItems[0].Text);

            _item = it;
            //lbiditem.Text=it.Id.ToString();
            tbitem.Text = it.Name;
            cbtype.Text = it.Type;
            var size = it.Size.ToString().Split(' ');

            try
            {
                tbsize.Text = size[0].ToString();
                cbsize.Text = size[1].ToString();
            }
            catch (Exception)
            {
                tbsize.Text = it.Size.ToString();
            }

            tbcode.Text = it.Code;
            DisenableItem();
        }
        void BtnitemnewClick(object sender, EventArgs e)
        {
            Button b = (Button)sender;

            if (b.Text.Equals("Save") && !tbitem.Text.Equals("") && !tbsize.Text.Equals("") && !cbtype.Text.Equals(""))
            {
                ItemC items = new ItemC();
                Item  item  = new Item()
                {
                    Name = tbitem.Text, Size = tbsize.Text + " " + cbsize.Text, Type = cbtype.Text, Code = tbcode.Text
                };
                items.Insert(item);

                ShowItemListAsListView();
            }
            else
            {
                EnableItem();

                tbitem.Text = "";
                tbsize.Text = "";
                cbtype.Text = "";
                b.Text      = "Save";
            }
        }
Exemple #4
0
 private void AddItemC(ItemC result, Dictionary <string, THashSet <string> > report)
 {
     if (result.__isset.fieldA)
     {
         // server expects "true" and not "True"
         AddField("fieldA", result.FieldA.ToString().ToLower(), report);
     }
 }
        void BtnitemdeleteClick(object sender, EventArgs e)
        {
            ItemC items = new ItemC();
            Item  it    = new Item();

            it.Id = int.Parse(lvitem.SelectedItems[0].Text);
            items.Delete(it);
            ShowItemListAsListView();
        }
        void GetItem()
        {
            ItemC items = new ItemC();

            foreach (Item item in items.GetItem())
            {
                cbitem.Items.Add(item.Name + "," + item.Size + "," + item.Type);
            }
        }
            public void itemC_IsAnItem()
            {
                //Arrange
                var itemC = new ItemC();

                //Act


                //Assert
                itemC.Should().BeAssignableTo <Item>();
            }
 static Boolean ExistItemSet(String Item, String Set)
 {
     foreach (String ItemC in Set.Split(','))
     {
         if (ItemC.Equals(Item))
         {
             return(true);
         }
     }
     return(false);
 }
 static Boolean ExistItem(String Item, String Transaction)
 {
     foreach (String ItemC in Transaction.Split(' '))
     {
         if (ItemC.Equals(Item))
         {
             return(true);
         }
     }
     return(false);
 }
            public void TheoryItemCsPrice(int quantity, decimal expectedTotalPrice)
            {
                //Arrange
                var itemC = new ItemC();
                //Act

                //Assert
                var total = itemC.GetPriceForQuantity(quantity);

                total.Should().Be(expectedTotalPrice);
            }
        void GetQuery(int id)
        {
            EpisodeC episodes = new EpisodeC();

            ItemC   item  = new ItemC();
            StoreC  store = new StoreC();
            Episode eps   = episodes.GetOneEpisode(new Episode()
            {
                Id = id
            });
            Item  it = item.GetOneItem(eps.Item_id.ToString());
            Store st = store.GetOneStore(new Store()
            {
                Id = eps.Stoke_id
            });

            cbitem.Text      = it.Name + "," + it.Size + "," + it.Type;
            cbstore.Text     = st.Name;
            batchNum.Text    = eps.Batch;
            medAmount.Text   = eps.Amount.ToString();
            _notes.Text      = eps.Notes;
            cbamountype.Text = eps.AmountType;
            string[] x = eps.Expdate.Split('-');
            intYear = Convert.ToInt32(x[0]);

            comboYear.Items.AddRange(new object[] {
                intYear - 3,
                intYear - 2,
                intYear - 1,
                intYear,
                intYear + 1,
                intYear + 2,
                intYear + 3,
                intYear + 4,
                intYear + 5,
            });


            comboYear.Text  = x[0];
            comboMonth.Text = x[1];
            dayNumber.Text  = x[2];
        }
        void ShowItemListAsListView()
        {
            var items = new ItemC();

            lvitem.Items.Clear();
            foreach (Item item in items.GetItem())
            {
                var t = new ListViewItem(item.Id.ToString());
                t.SubItems.Add(item.Name);
                lvitem.Items.Add(t);

                tbitem.Text     = "";
                cbtype.Text     = "";
                tbsize.Text     = "";
                cbsize.Text     = "";
                tbcode.Text     = "";
                btnitemnew.Text = "New";
                DisenableItem();
            }
        }
        static int getOCCItem(String Tran)
        {
            Dictionary <string, int> _TempCount = new Dictionary <string, int>();

            foreach (String Line in Transactions)
            {
                string LineItem = Line.Trim();
                if (LineItem.Split(' ').Count() < Tran.Split(',').Count())
                {
                    continue;
                }
                int cptLine = 0;
                //COMPARE BETWEEN COMIBINITION AND LINE TRANSACTION
                foreach (String ItemC in Tran.Split(','))
                {
                    foreach (String ItemL in Line.Trim().Split(' '))
                    {
                        if (ItemC.Equals(ItemL))
                        {
                            cptLine++; continue;
                        }
                    }
                }
                if (cptLine == Tran.Split(',').Count())
                {
                    if (_TempCount.ContainsKey(Tran))
                    {
                        _TempCount[Tran] += 1;
                    }
                    else
                    {
                        _TempCount.Add(Tran, 1);
                    }
                }
            }
            return(_TempCount[Tran]);
        }
        void BtnitemeditClick(object sender, EventArgs e)
        {
            Button b = (Button)sender;

            if (b.Text.Equals("Save") && !tbitem.Text.Equals("") && !tbsize.Text.Equals("") && !cbtype.Text.Equals(""))
            {
                ItemC items = new ItemC();
                Item  item  = new Item()
                {
                    Id = _item.Id, Name = tbitem.Text, Size = tbsize.Text + cbsize.Text, Type = cbtype.Text, Code = tbcode.Text
                };
                items.Update(item);

                ShowItemListAsListView();
                b.Text = "Edit";
            }
            else
            {
                EnableItem();


                b.Text = "Save";
            }
        }
        public void getAll(string sort)
        {
            lsv.Items.Clear();

            EpisodeC episodes = new EpisodeC();



            int c  = 1;
            int lx = 0;

            foreach (Episode eps in episodes.GetEpisodeWithLimitStore(_query, sort))
            {
                StoreC stores = new StoreC();

                ListViewItem t = new ListViewItem(eps.Id.ToString());
                t.SubItems.Add(c.ToString());
                t.SubItems.Add(eps.Batch);
                try
                {
                    ItemC items = new ItemC();
                    Item  item  = items.GetOneItem(eps.Item_id.ToString());

                    t.SubItems.Add(item.Name + "," + item.Size);
                    t.SubItems.Add(item.Type.ToUpper());
                }
                catch (Exception)
                {
                    t.SubItems.Add("NULL");
                    Debug.WriteLine("Item table is null getall method in mainform.class");
                }

                LimitC setdate = new LimitC();
                t.SubItems.Add(setdate.SetDateWithoutDay(eps.Expdate));
                t.SubItems.Add(stores.GetOneStore(new Store()
                {
                    Id = eps.Stoke_id
                }).Name);
                t.SubItems.Add(eps.Amount.ToString() + eps.AmountType);
                //				// notes for medicine
                string itemNote = "";
                if (eps.Notes.Equals(""))
                {
                    itemNote = getTimeline(eps.Expdate);
                }
                else
                {
                    itemNote = getTimeline(eps.Expdate) + " *";
                }
                t.SubItems.Add(itemNote);

                lsv.Items.Add(t);

                lsv.Items[lx].UseItemStyleForSubItems = false;
                if (setColor == Dates.EXP)
                {
                    lsv.Items[lx].SubItems[8].BackColor = Color.Red;
                }

                if (setColor == Dates.NEAR)
                {
                    lsv.Items[lx].SubItems[8].BackColor = Color.Orange;
                }
                if (setColor == Dates.ATTENTION)
                {
                    lsv.Items[lx].SubItems[8].BackColor = Color.LightGreen;
                }
                if (setColor == Dates.SAFF)
                {
                    lsv.Items[lx].SubItems[8].BackColor = Color.LightSalmon;
                }
                if (setColor == Dates.LONG)
                {
                    lsv.Items[lx].SubItems[8].BackColor = Color.White;
                }

                c++;
                lx++;
            }
            c = 1;
        }
Exemple #16
0
 void ChangeValue(ItemC classItem)
 {  //referece
     classItem.name = "Master Sword";
 }
        static Dictionary <string, int> getCN(Dictionary <string, int> Ln_1, int N)
        {
            Dictionary <string, int> CN = new Dictionary <string, int>();

            //CONCATENATION
            for (int i = 0; i < Ln_1.Count; i++)
            {
                for (int j = i + 1; j < Ln_1.Count; j++)
                {   //ELIMINATE OCCURENCE IN EACH TRANSACTION
                    String newItem = EliminateOcc(Ln_1.ElementAt(i).Key + "," + Ln_1.ElementAt(j).Key);
                    if (newItem.Split(',').Count() != N)
                    {
                        continue;
                    }

                    // ELIMINATE OCCURENCE IN TRANSACTION
                    if (!ItemExist(CN, newItem))
                    { //Console.WriteLine(newItem);
                        CN.Add(newItem, 0);
                    }
                }
            }
            Dictionary <string, int> _TempCount = new Dictionary <string, int>();

            //GET SUPPORT COUNT
            foreach (KeyValuePair <String, int> Tran in CN)
            {
                foreach (String Line in Transactions)
                {
                    string LineItem = Line.Trim();
                    if (LineItem.Split(' ').Count() < Tran.Key.Split(',').Count())
                    {
                        continue;
                    }
                    int cptLine = 0;
                    //COMPARE BETWEEN COMIBINITION AND LINE TRANSACTION
                    foreach (String ItemC in Tran.Key.Split(','))
                    {
                        foreach (String ItemL in Line.Trim().Split(' '))
                        {
                            if (ItemC.Equals(ItemL))
                            {
                                cptLine++; continue;
                            }
                        }
                    }
                    if (cptLine == Tran.Key.Split(',').Count())
                    {
                        if (_TempCount.ContainsKey(Tran.Key))
                        {
                            _TempCount[Tran.Key] += 1;
                        }
                        else
                        {
                            _TempCount.Add(Tran.Key, 1);
                        }
                    }
                }
            }
            foreach (KeyValuePair <String, int> Tran in _TempCount)
            {
                CN[Tran.Key] = Tran.Value;
            }

            return(CN);
        }
    void Update()
    {
        AudioSource fire = FirePlace.GetComponent <AudioSource>();

        ChsdCell = InventoryScript.ChsdCell;
        if (Fire == true && int.Parse(OvenInv[1, 1]) != 0)
        {
            Timer += Time.timeScale / 10;
            if (fire.isPlaying == false)
            {
                fire.Play();
            }
        }
        else
        {
            fire.Stop();
            Timer = 0;
            Fire  = false;
        }
        if (Timer > CookingTime)
        {
            for (int i = 0; i < Items.Length; i++)
            {
                if (OvenInv[0, 6] == Items[i])
                {
                    for (int k = 0; k < 7; k++)
                    {
                        OvenInv[2, k] = Food[i].GetComponent <ItemScript>().Item[0, k];
                        if (k != 1)
                        {
                            OvenInv[0, k] = null;
                        }
                        else
                        {
                            OvenInv[0, k] = "" + 0;
                        }
                    }
                }
            }
            Timer         = 0;
            Fire          = false;
            OvenInv[1, 1] = "" + (int.Parse(OvenInv[1, 1]) - 1);
        }
        if (Active == true)
        {
            if (OvenInv[0, 3] != null)
            {
                if (int.Parse(OvenInv[0, 1]) != 0)
                {
                    ItemC.GetComponentInChildren <RawImage>().texture = InventoryScript.ICONS[int.Parse(OvenInv[0, 3])];
                }
                else
                {
                    ItemC.GetComponentInChildren <RawImage>().texture = null;
                }
            }
            else
            {
                ItemC.GetComponentInChildren <RawImage>().texture = null;
            }
            if (OvenInv[1, 3] != null)
            {
                if (int.Parse(OvenInv[1, 1]) != 0)
                {
                    FuelC.GetComponentInChildren <RawImage>().texture = InventoryScript.ICONS[int.Parse(OvenInv[1, 3])];
                }
                else
                {
                    FuelC.GetComponentInChildren <RawImage>().texture = null;
                }
            }
            else
            {
                FuelC.GetComponentInChildren <RawImage>().texture = null;
            }
            if (OvenInv[2, 3] != null)
            {
                if (int.Parse(OvenInv[2, 1]) != 0)
                {
                    FoodC.GetComponentInChildren <RawImage>().texture = InventoryScript.ICONS[int.Parse(OvenInv[2, 3])];
                }
                else
                {
                    FoodC.GetComponentInChildren <RawImage>().texture = null;
                }
            }
            else
            {
                FoodC.GetComponentInChildren <RawImage>().texture = null;
            }
            Timeleft.GetComponent <Text>().text = Timer.ToString("f0") + " / 30";
        }
    }
Exemple #19
0
        int GetItemId(string str)
        {
            ItemC items = new ItemC();

            return(items.GetItemId(str));
        }
        public double Calculate(ItemC itemC)

        {
            return(itemC.NoOfItems * itemC.Cost);
        }