예제 #1
0
        private void FillGrid(IEnumerable <BrgModel> listData)
        {
            BrgGrid.Rows.Clear();

            if (listData == null)
            {
                return;
            }

            PrgBar.Value   = 0;
            PrgBar.Maximum = listData.Count();
            foreach (var item in listData.OrderBy(x => x.BrgName))
            {
                PrgBar.Value++;
                object[] rowData = { item.BrgID,           item.BrgName,  item.JenisBrgName,
                                     item.SubJenisBrgName, item.MerkName, item.ColorID, "Rp. " };
                BrgGrid.Rows.Add(rowData);
                if (item.ColorID.Trim() != "")
                {
                    var color = _colorBL.GetData(item.ColorID);
                    if (color != null)
                    {
                        BrgGrid.Rows[PrgBar.Value - 1].Cells["BrgColorCol"].Style.BackColor = _colorBL.GetFromRGB(color);
                        if (color.IsWhiteForeColor)
                        {
                            BrgGrid.Rows[PrgBar.Value - 1].Cells["BrgColorCol"].Style.ForeColor = Color.White;
                        }
                    }
                }
                RefreshPrice(PrgBar.Value - 1);
            }
            PrgBar.Value = 0;
        }
예제 #2
0
        public void GetData_CallDalGetData()
        {
            //  arrange

            //  act
            var actual = _colorBL.GetData("A1");

            //  assert
            _colorDal.Verify(x => x.GetData(It.IsAny <string>()), Times.Once);
        }
예제 #3
0
        void LoadColorCombo()
        {
            ColorComboBox.DataSource = null;
            ColorComboBox.Items.Clear();

            //  ambil data
            var listColor = _colorBL.ListData();

            //  exit jika kosong
            if (listColor == null)
            {
                return;
            }

            var listColorWithHue =
                from c in listColor
                select new
            {
                c.ColorID,
                c.RedValue,
                c.GreenValue,
                c.BlueValue,
                Hue = Color.FromName(c.ColorID).GetHue()
            };

            listColorWithHue = listColorWithHue
                               .OrderBy(x => x.RedValue)
                               .ThenBy(x => x.GreenValue)
                               .ThenBy(x => x.BlueValue)
                               .ToList();
            ColorComboBox.DataSource    = listColorWithHue;
            ColorComboBox.DisplayMember = "ColorID";
            ColorComboBox.ValueMember   = "ColorID";
            var color = _colorBL.GetData(ColorComboBox.SelectedValue.ToString());

            ColorPanel.BackColor = _colorBL.GetFromRGB(color);

            ColorComboBox.SelectedItem = null;
        }
예제 #4
0
        public BrgModel TryValidate(BrgModel brg)
        {
            var result = brg;

            if (brg == null)
            {
                throw new ArgumentNullException(nameof(brg));
            }

            if (brg.BrgName.Trim() == "")
            {
                throw new ArgumentException("BrgName empty");
            }

            var subJenisBrg = _subJenisBrgBL.GetData(brg.SubJenisBrgID);

            if (subJenisBrg == null)
            {
                throw new ArgumentException("SubJenisBrgID invalid");
            }
            else
            {
                brg.SubJenisBrgName = subJenisBrg.SubJenisBrgName;
            }

            if (brg.MerkID.Trim() != "")
            {
                var merk = _merkBL.GetData(brg.MerkID);
                if (merk == null)
                {
                    throw new ArgumentException("MerkID invalid");
                }
                else
                {
                    brg.MerkName = merk.MerkName;
                }
            }

            if (brg.ColorID.Trim() != "")
            {
                var color = _colorBL.GetData(brg.ColorID);
                if (color == null)
                {
                    throw new ArgumentException("ColorID invalid");
                }
            }
            return(result);
        }
예제 #5
0
        private void LoadDataColor()
        {
            var color = _colorBL.GetData(ColorIDComboBox.Text);

            if (color == null)
            {
                RedTextBox.Value   = 0;
                GreenTextBox.Value = 0;
                BlueTextBox.Value  = 0;
                return;
            }
            RedTextBox.Value               = color.RedValue;
            GreenTextBox.Value             = color.GreenValue;
            BlueTextBox.Value              = color.BlueValue;
            WhiteForeColorCheckBox.Checked = color.IsWhiteForeColor;
        }