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;
                StockItemDB      sidb   = new StockItemDB();
                List <stockitem> 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 (stockitem 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 void fillStockItemGridViewComboNew(DataGridViewComboBoxCell cmb, string CategoryName)
 {
     cmb.Items.Clear();
     try
     {
         StockItemDB      stockitemdb = new StockItemDB();
         List <stockitem> StockItems  = stockitemdb.getStockItems();
         //foreach (stockitem si in StockItems)
         //{
         //    //if (CategoryName.Length > 0 && CategoryName != si.Category)
         //    //{
         //    //    continue;
         //    //}
         //    if (si.status == 1)
         //    {
         //        cmb.Items.Add(si.StockItemID + "-" + si.Name);
         //    }
         //}
         foreach (stockitem si in StockItems)
         {
             if (si.status == 1)
             {
                 Structures.GridViewComboBoxItem ch =
                     new Structures.GridViewComboBoxItem(si.Name, si.StockItemID);
                 cmb.Items.Add(ch);
             }
         }
         cmb.DisplayMember = "Name";  // Name Property will show(Editing)
         cmb.ValueMember   = "Value"; // Value Property will save(Saving)
     }
     catch (Exception ex)
     {
         MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
 }
Esempio n. 3
0
        public DataGridView getStockItemlistGrid()
        {
            DataGridView StockItemGgrid = new DataGridView();

            try
            {
                DataGridViewCheckBoxColumn colChk = new DataGridViewCheckBoxColumn();
                colChk.Width      = 50;
                colChk.Name       = "Select";
                colChk.HeaderText = "Select";
                colChk.ReadOnly   = false;

                DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
                dataGridViewCellStyle1.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
                dataGridViewCellStyle1.BackColor          = System.Drawing.Color.LightSeaGreen;
                dataGridViewCellStyle1.Font               = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                dataGridViewCellStyle1.ForeColor          = System.Drawing.SystemColors.WindowText;
                dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
                dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
                dataGridViewCellStyle1.WrapMode           = System.Windows.Forms.DataGridViewTriState.True;
                StockItemGgrid.SelectionMode              = DataGridViewSelectionMode.FullRowSelect;
                StockItemGgrid.EnableHeadersVisualStyles  = false;

                StockItemGgrid.AllowUserToAddRows            = false;
                StockItemGgrid.AllowUserToDeleteRows         = false;
                StockItemGgrid.BackgroundColor               = System.Drawing.SystemColors.GradientActiveCaption;
                StockItemGgrid.BorderStyle                   = System.Windows.Forms.BorderStyle.None;
                StockItemGgrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
                StockItemGgrid.EditMode            = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
                StockItemGgrid.ColumnHeadersHeight = 27;
                StockItemGgrid.RowHeadersVisible   = false;
                StockItemGgrid.Columns.Add(colChk);


                StockItemDB SIDB = new StockItemDB();
                List <StockItemSelection> StockSElList = SIDB.getStockItemsForGridView();

                StockItemGgrid.DataSource = StockSElList;
            }
            catch (Exception ex)
            {
            }

            return(StockItemGgrid);
        }
Esempio n. 4
0
 public static void fillStockItemGridViewCombo(DataGridViewComboBoxCell cmb, string CategoryName)
 {
     cmb.Items.Clear();
     try
     {
         StockItemDB      stockitemdb = new StockItemDB();
         List <stockitem> StockItems  = stockitemdb.getStockItems();
         foreach (stockitem 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. 5
0
        public static TreeView getStockItemTreeViewNew()
        {
            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.Sort();
                //tv.CheckBoxes = "leaf";
                // tv.sho
                tv.FullRowSelect = true;
                StockItemDB      sidb       = new StockItemDB();
                List <stockitem> stockitems = sidb.getFilteredStockItems("", 6).Where(si => si.status == 1 && si.documentStatus == 99).ToList();
                TreeNode         tNode;
                string           RootDesc       = "";
                string           SubRootDesc    = "";
                string           SubSubRootDesc = "";
                int j = 0;
                int k = 0;
                int l = 0;
                foreach (stockitem 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);
                        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);
                            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);
                                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);
                                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);
        }