//xử lý phần loại sản phẩm
 private void tabNaviPage_ProductType_VisibleChanged(object sender, EventArgs e)
 {
     if (tabPaneMainForm.SelectedPage != tabNaviPage_LoaiSanPham)
     {
         return;
     }
     productTypeGridControl.DataSource = _productTypeBusinessLogic.GetAllProductTypes();
 }
Example #2
0
 private void NewProductForm_VisibleChanged(object sender, EventArgs e)
 {
     if (Visible)
     {
         cmbProductType.DataSource = _productTypeBusinessLogic.GetAllProductTypes();
         if (product != null)
         {
             cmbProductType.SelectedValue = product.IdType;
         }
     }
 }
Example #3
0
        public NewProductForm(int?rowId = null)
        {
            InitializeComponent();
            _productTypeBusinessLogic = new ProductTypeBusinessLogic();
            _productBusinessLogic     = new ProductBusinessLogic();


            var productTypes = _productTypeBusinessLogic.GetAllProductTypes();

            cmbProductType.DisplayMember = "Name";
            cmbProductType.ValueMember   = "Id";
            cmbProductType.DataSource    = productTypes;

            if (rowId == null)
            {
                return;
            }
            btn_NewProduct.Text = @"Cập nhật thay đổi";
            _isUpdate           = true;
            _rowId = (int)rowId;

            product = _productBusinessLogic.GetProductById(rowId);

            txtB_ProductName.Text         = product.Name;
            txtB_ProductPrice.Text        = product.Price.ToString();
            cmbProductType.SelectedValue  = product.IdType;
            chB_TopProduct.Checked        = product.Inew == 1;
            rTxtB_DescriptionProduct.Text = product.Description;

            try
            {
                var image = GetImage(rowId);
                picB_ImageProduct.Image     = image;
                picB_ImageProduct.SizeMode  = PictureBoxSizeMode.CenterImage;
                picB_ImageProduct.BackColor = Color.AliceBlue;
            }
            catch (Exception e)
            {
                // do not thing
            }
        }