Example #1
0
        public void GetData_CallDalGetData()
        {
            //  arrange

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

            //  assert
            _subJenisBrgDal.Verify(x => x.GetData(It.IsAny <string>()), Times.Once);
        }
Example #2
0
        private void ShowSubJenisBrg(string id)
        {
            SubJenisBrgIDTextBox.Text = id;
            var subJenisBrg = _subJenisBrgBL.GetData(id);

            if (subJenisBrg != null)
            {
                SubJenisBrgNameTextBox.Text = subJenisBrg.SubJenisBrgName;
            }
            else
            {
                SubJenisBrgNameTextBox.Text = "";
            }
        }
Example #3
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);
        }
Example #4
0
        void LoadDataBrg(string brgID)
        {
            var brg = _brgBL.GetData(brgID);

            BrgIDText.Text = brgID;
            if (brg == null)
            {
                BrgNameText.Clear();
                KeteranganText.Clear();
                LoadJenisBrgCombo();
                LoadColorCombo();
                LoadMerkCombo();
                LoadKemasanComboBox();
            }
            else
            {
                BrgNameText.Text    = brg.BrgName;
                KeteranganText.Text = brg.Keterangan;
                var subJenisBrg = _subJenisBrgBL.GetData(brg.SubJenisBrgID);
                if (subJenisBrg != null)
                {
                    JenisBrgComboBox.SelectedValue = subJenisBrg.JenisBrgID;
                }
                else
                {
                    JenisBrgComboBox.SelectedValue = "";
                }

                LoadSubJenisBrgCombo();
                SubJenisBrgComboBox.SelectedValue = brg.SubJenisBrgID;

                MerkComboBox.SelectedValue  = brg.MerkID;
                ColorComboBox.SelectedValue = brg.ColorID;
                KemasanComboBox.Text        = brg.Kemasan;
                AktifCheckBox.Checked       = brg.IsAktif;
            }
        }