Exemplo n.º 1
0
        private void ShowGridBrg(TreeViewEventArgs e)
        {
            var jenisID = "";
            var subID   = "";
            var merkID  = "";
            var colorID = "";

            if (e.Node.Level == 3)
            {
                colorID = e.Node.Name;

                var merkNode = e.Node.Parent;
                merkID = merkNode.Name;

                var subNode = merkNode.Parent;
                subID = subNode.Name;

                var jenisNode = subNode.Parent;
                jenisID = jenisNode.Name;
            }

            if (e.Node.Level == 2)
            {
                colorID = "";
                merkID  = e.Node.Name;

                var subNode = e.Node.Parent;
                subID = subNode.Name;

                var jenisNode = subNode.Parent;
                jenisID = jenisNode.Name;
            }

            if (e.Node.Level == 1)
            {
                colorID = "";
                merkID  = "";
                subID   = e.Node.Name;

                var jenisNode = e.Node.Parent;
                jenisID = jenisNode.Name;
            }

            if (e.Node.Level == 0)
            {
                colorID = "";
                merkID  = "";
                subID   = "";

                jenisID = e.Node.Name;
            }

            //  query data
            var listBrg = _brgBL.ListData(jenisID, subID, merkID, colorID);

            FillGrid(listBrg);
        }
Exemplo n.º 2
0
        void LoadBrgGrid(string subJenisBrgID)
        {
            BarangGrid.Rows.Clear();
            var subJenisBrg = new SubJenisBrgModel
            {
                SubJenisBrgID = subJenisBrgID
            };

            var listBrg = _brgBL.ListData(subJenisBrg);

            if (listBrg == null)
            {
                return;
            }

            PrgBar.Value   = 0;
            PrgBar.Maximum = listBrg.Count();
            foreach (var item in listBrg.OrderBy(x => x.BrgName))
            {
                PrgBar.Value++;
                object[] rowData = { item.BrgID,           item.BrgName,  item.JenisBrgName,
                                     item.SubJenisBrgName, item.MerkName, item.Kemasan,
                                     item.ColorID };
                BarangGrid.Rows.Add(rowData);
                if (item.ColorID.Trim() != "")
                {
                    var color = _colorBL.GetData(item.ColorID);
                    if (color != null)
                    {
                        BarangGrid.Rows[PrgBar.Value - 1].Cells["ColorID"].Style.BackColor = _colorBL.GetFromRGB(color);
                        if (color.IsWhiteForeColor)
                        {
                            BarangGrid.Rows[PrgBar.Value - 1].Cells["ColorID"].Style.ForeColor = Color.White;
                        }
                    }
                }
            }
            PrgBar.Value = 0;
            ClearDetilBrg();
        }