Esempio n. 1
0
        void LbstoreItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            ListViewItem item   = e.Item;
            StoreC       storec = new StoreC();
            Store        store  = storec.GetOneStore(new Store()
            {
                Id = int.Parse(e.Item.SubItems[0].Text.ToString())
            });

            tbstorename.Text  = store.Name;
            tbstoretype.Text  = store.Type;
            tbstorenote.Text  = store.Note;
            btneditstore.Text = "Edit";
            DisEnableStoreTextBox();
        }
Esempio n. 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];
        }
Esempio n. 3
0
        void GetStoreByRule()
        {
            StoreRulesC src = new StoreRulesC();

            List <StoreRules> lsr = src.GetStoreRulesByRuleId(_user.Rule_id);

            foreach (StoreRules sr in lsr)
            {
                StoreC sc = new StoreC();
                try {
                    string storeName = sc.GetOneStore(new Store()
                    {
                        Id = sr.Store_id
                    }).Name;
                    cbstore.Items.Add(storeName);
                } catch (Exception) {
                    Debug.WriteLine("Error When Get Store Name Update Class");
                }
            }
        }
        void CbruleSelectedIndexChanged(object sender, EventArgs e)
        {
            PermissionTableC pts   = new PermissionTableC();
            RuleC            rules = new RuleC();
            StoreC           ssc   = new StoreC();
            StoreRulesC      src   = new StoreRulesC();


            Rules             rule = rules.GetRuleByName(cbrule.Text);
            List <Permission> lpt  = pts.GetPermissionTable(rule);
            List <StoreRules> lsr  = src.GetStoreRule(rule);

            _rule.Id = rule.Id;
            ComboBox b = (ComboBox)sender;

            tvfalse.Nodes.Clear();
            tvtrue.Nodes.Clear();
            tvstorefalse.Nodes.Clear();
            tvstoretrue.Nodes.Clear();

            src = new StoreRulesC();
            if (ssc.Count() > src.Count(_rule.Id))
            {
                Debug.WriteLine("Store In DataBase More Than StoreRules Store=" + ssc.Count() + " StoreRules=" + src.Count(_rule.Id));

                StoreC      stores = new StoreC();
                StoreRulesC sRc    = new StoreRulesC();
                sRc.InsertList(stores.GetStore(), new Rules()
                {
                    Id = _rule.Id
                });
            }
            else
            {
                Debug.WriteLine("Store In DataBase Less Than StoreRulesStore=" + ssc.Count() + " StoreRules=" + src.Count(_rule.Id));
            }

            foreach (Permission pt in lpt)
            {
                if (pt.Rule_id != 1)
                {
                    if (pt.Values.Equals("0"))
                    {
                        var tvfalsenode = new TreeNode(pt.Name);
                        tvfalse.Nodes.Add(tvfalsenode);
                    }
                    else
                    {
                        var tvtruenode = new TreeNode(pt.Name);
                        tvtrue.Nodes.Add(tvtruenode);
                    }
                }
            }

            foreach (StoreRules sr in lsr)
            {
                StoreC storec = new StoreC();
                Store  sstore = storec.GetOneStore(new Store()
                {
                    Id = sr.Store_id
                });
                if (sr.Rules_id != 1)
                {
                    if (sr.Val == 0)
                    {
                        var tvstorefalsenode = new TreeNode(sstore.Name);
                        tvstorefalse.Nodes.Add(tvstorefalsenode);
                    }
                    else
                    {
                        var tvstoretruenode = new TreeNode(sstore.Name);
                        tvstoretrue.Nodes.Add(tvstoretruenode);
                    }
                }
            }

            _pt.Name     = "!";
            _sr.Store_id = -1;
        }
        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;
        }
        /// <summary>
        ///
        /// </summary>
        void GetStoreByRule()
        {
            StoreRulesC src     = new StoreRulesC();
            bool        isFirst = true;

            _listStoreRules = src.GetStoreRulesByRuleId(_user.Rule_id);

            foreach (StoreRules sr in _listStoreRules)
            {
                StoreC sc = new StoreC();
                Debug.WriteLine(sr.Store_id.ToString());

                if (isFirst)
                {
                    _query = " store_id=" + sr.Store_id;
                }
                else
                {
                    _query += " or store_id=" + sr.Store_id;
                }

                isFirst = false;
                try {
                    string storeName = sc.GetOneStore(new Store()
                    {
                        Id = sr.Store_id
                    }).Name;
                    cbplace.Items.Add(storeName);
                    _store.Add(new Store {
                        Name = storeName, Id = sr.Store_id
                    });
                } catch (Exception) {
                    Debug.WriteLine("Error When Get Store Name MainForm Class");
                }
            }
            isFirst    = true;
            finalquery = _query;
            getAll("");
            //foreach (Store st in _store)
            // {
            //     GUI.ETabPage etp = new GUI.ETabPage();
            //     etp.Name = st.Name;
            //     etp.Text = st.Name;

            //     GUI.EListView etl = new GUI.EListView(st.Name);


            //     etp.AddToTabPage(etl.GetList());
            //     _listListView.Add(etl.GetList());

            //  tabControl1.Controls.Add(etp.GetTabPage());
            //     _listTabPage.Add(etp.GetTabPage());

            //  //   tabControl1.TabPages[st.Name].Text = st.Name;
            //  //   tabControl1.TabPages[st.Name].Controls.Add(new GUI.TestButton().GetButton(st.Name+4,"click"));
            //}
            // Debug.WriteLine(_listTabPage.Count);
            // foreach (ListView l in _listListView)
            // {
            //     Debug.WriteLine(l.Name);
            // }
            Debug.WriteLine("this is query=>" + _query);
        }