예제 #1
0
        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();
        }
예제 #2
0
        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];
        }
예제 #3
0
        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;
        }