Esempio n. 1
0
        public static ListView getStockItemListView()
        {
            ListView lv = new ListView();

            try
            {
                lv.View               = View.Details;
                lv.LabelEdit          = true;
                lv.AllowColumnReorder = true;
                lv.CheckBoxes         = true;
                lv.FullRowSelect      = true;
                lv.GridLines          = true;
                lv.Sorting            = System.Windows.Forms.SortOrder.Ascending;
                StockItemDB3      sidb   = new StockItemDB3();
                List <stockitem3> SIList = sidb.getFilteredStockItems("", 6);
                ////int index = 0;
                lv.Columns.Add("Select", -2, HorizontalAlignment.Left);
                lv.Columns.Add("StockItem ID", -2, HorizontalAlignment.Left);
                lv.Columns.Add("StockItem Name", -2, HorizontalAlignment.Left);

                foreach (stockitem3 si in SIList)
                {
                    ListViewItem item1 = new ListViewItem();
                    item1.Checked = false;
                    item1.SubItems.Add(si.StockItemID.ToString());
                    item1.SubItems.Add(si.Name);
                    lv.Items.Add(item1);
                }
            }
            catch (Exception)
            {
            }
            return(lv);
        }
Esempio n. 2
0
        public static ListView ProductCodeSelectionView()
        {
            ListView lv = new ListView();

            try
            {
                lv.View               = View.Details;
                lv.LabelEdit          = true;
                lv.AllowColumnReorder = true;
                lv.CheckBoxes         = true;
                lv.FullRowSelect      = true;
                lv.GridLines          = true;
                lv.Sorting            = System.Windows.Forms.SortOrder.Ascending;
                StockItemDB3      sidb       = new StockItemDB3();
                List <stockitem3> stockitems = sidb.getFilteredStockItems("", 6);
                ////int index = 0;
                lv.Columns.Add("Select", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Item Id", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Item Name", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Cat", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Group", -2, HorizontalAlignment.Left);
                lv.Columns.Add("Type", -2, HorizontalAlignment.Center);
                foreach (stockitem3 si in stockitems)
                {
                    ListViewItem item1 = new ListViewItem();
                    item1.Checked = false;
                    item1.SubItems.Add(si.StockItemID);
                    item1.SubItems.Add(si.Name.ToString());
                    item1.SubItems.Add(si.Group1CodeDescription.ToString());
                    item1.SubItems.Add(si.Group2CodeDescription.ToString());
                    item1.SubItems.Add(si.Group3CodeDescription.ToString());
                    lv.Items.Add(item1);
                }
            }
            catch (Exception)
            {
            }
            return(lv);
        }
Esempio n. 3
0
 public static void fillStockItemGridViewCombo(DataGridViewComboBoxCell cmb, string CategoryName)
 {
     cmb.Items.Clear();
     try
     {
         StockItemDB3      stockitemdb = new StockItemDB3();
         List <stockitem3> StockItems  = stockitemdb.getStockItems();
         foreach (stockitem3 si in StockItems)
         {
             //if (CategoryName.Length > 0 && CategoryName != si.Category)
             //{
             //    continue;
             //}
             if (si.status == 1)
             {
                 cmb.Items.Add(si.StockItemID + "-" + si.Name);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
Esempio n. 4
0
        public static TreeView getStockItemTreeView()
        {
            TreeView tv = new TreeView();

            try
            {
                tv.CheckBoxes = true;
                //tv.Location = new System.Drawing.Point(264, 90);
                //tv.Size = new System.Drawing.Size(332, 161);
                tv.LabelEdit  = true;
                tv.ShowLines  = true;
                tv.CheckBoxes = true;

                //tv.CheckBoxes = "leaf";
                // tv.sho
                tv.FullRowSelect = true;
                StockItemDB3      sidb       = new StockItemDB3();
                List <stockitem3> stockitems = sidb.getFilteredStockItems("", 6);
                TreeNode          tNode;
                string            RootDesc       = "";
                string            SubRootDesc    = "";
                string            SubSubRootDesc = "";
                int j = 0;
                int k = 0;
                int l = 0;
                foreach (stockitem3 item in stockitems)
                {
                    l++;
                    int n = tv.Nodes.Count;
                    if (item.Group1CodeDescription != RootDesc)
                    {
                        j = 0; k = 0;

                        tNode = tv.Nodes.Add(item.Group1CodeDescription);
                        tv.Nodes[n].Nodes.Add(item.Group2CodeDescription);
                        tv.Nodes[n].Nodes[j].Nodes.Add(item.Group3CodeDescription);
                        tv.Nodes[n].Nodes[j].Nodes[k].Nodes.Add(item.StockItemID + "-" + item.Name);
                        RootDesc       = item.Group1CodeDescription;
                        SubRootDesc    = item.Group2CodeDescription;
                        SubSubRootDesc = item.Group3CodeDescription;
                    }
                    else
                    {
                        if (item.Group2CodeDescription != SubRootDesc)
                        {
                            j = j + 1; k = 0;
                            tv.Nodes[n - 1].Nodes.Add(item.Group2CodeDescription);
                            tv.Nodes[n - 1].Nodes[j].Nodes.Add(item.Group3CodeDescription);
                            tv.Nodes[n - 1].Nodes[j].Nodes[k].Nodes.Add(item.StockItemID + "-" + item.Name);
                            SubRootDesc    = item.Group2CodeDescription;
                            SubSubRootDesc = item.Group3CodeDescription;
                        }
                        else
                        {
                            if (item.Group3CodeDescription != SubSubRootDesc)
                            {
                                k = k + 1;
                                tv.Nodes[n - 1].Nodes[j].Nodes.Add(item.Group3CodeDescription);
                                tv.Nodes[n - 1].Nodes[j].Nodes[k].Nodes.Add(item.StockItemID + "-" + item.Name);
                                SubSubRootDesc = item.Group3CodeDescription;
                            }
                            else
                            {
                                tv.Nodes[n - 1].Nodes[j].Nodes[k].Nodes.Add(item.StockItemID + "-" + item.Name);
                            }
                        }
                    }
                }
                // MessageBox.Show("Count:" + l);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in TreeView");
            }
            return(tv);
        }