Exemplo n.º 1
0
        public static void loadItemsByCategoryAndCompanyAndName(MSListBox list, String text)
        {
            try {
                DataTable dataTable_item = new DataTable();
                dataTable_item.Columns.Add("ID", typeof(int));
                dataTable_item.Columns.Add("name", typeof(String));

                String[] words    = text.Split(',');
                String   item     = "";
                String   company  = "";
                String   category = "";
                for (int i = 0; i < words.Length; i++)
                {
                    if (i == 0)
                    {
                        item += words[i] + "";
                    }
                    else if (i == 1)
                    {
                        company += words[i] + "";
                    }
                    else if (i == 2)
                    {
                        category += words[i] + "";
                    }
                }
                DataSet dataSet = CommonManagerImpl.getItemsForSearch(item, company, category);
                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    dataTable_item.Rows.Add(row[0], row[1] + " ( " + row[5] + ", " + row[3] + " )");
                }
                list.OptionGroup = dataTable_item;
            } catch (Exception) {
            }
        }
Exemplo n.º 2
0
        public static void recentItems(ListBox listBox, int count)
        {
            try {
                DataTable dataTable_item = new DataTable();
                dataTable_item.Columns.Add("ID", typeof(int));
                dataTable_item.Columns.Add("name", typeof(String));
                List <int> itemIds = CommonManagerImpl.getRecentSoldItemIds(count);

                listBox.ItemsSource       = dataTable_item.DefaultView;
                listBox.DisplayMemberPath = "name";
                listBox.SelectedValuePath = "id";
            } catch (Exception) {
            }
        }