public NewProductTypeForm(int?rowId = null) { InitializeComponent(); _productBusinessLogic = new ProductBusinessLogic(); _productTypeBusinessLogic = new ProductTypeBusinessLogic(); if (rowId == null) { return; } btn_InsertProductType.Text = @"Cập nhật"; _isUpdate = true; _rowId = (int)rowId; var productTpye = _productTypeBusinessLogic.GetDetailProductType(_rowId); txtB_NameProductType.Text = productTpye.Name; try { var image = GetImage(rowId); picBox_ImageProductType.Image = image; picBox_ImageProductType.SizeMode = PictureBoxSizeMode.CenterImage; picBox_ImageProductType.BackColor = Color.AliceBlue; } catch (Exception e) { // do not thing } }
public ImportProduct(int?rowId = null, int?SupplierId = null, int?ProductId = null) { InitializeComponent(); _supplierBusinessLogic = new SupplierBusinessLogic(); _productBusinessLogic = new ProductBusinessLogic(); _importBusinessLogic = new ImportBusinessLogic(); btn_importProduct.Enabled = false; txtB_Quantity.Enabled = false; txtB_UnitPrice.Enabled = false; if (rowId == null || SupplierId == null || ProductId == null) { return; } btn_Unclock.Text = @"Chỉnh sửa"; _isUpdate = true; _rowId = (int)rowId; _supplierId = (int)SupplierId; _productId = (int)ProductId; var supplier = _supplierBusinessLogic.GetDetailSupplier(_supplierId); txtB_SupplierName.Text = supplier.Name; txtB_SupplierEmail.Text = supplier.Email; txtB_SupplierPhone.Text = supplier.Phone; var product = _productBusinessLogic.GetProductById(_productId); txtB_ProductName.Text = product.Name; txtB_ProductPrice.Text = product.Price.ToString(); txtB_UnitInStock.Text = product.unitInStock.ToString(); txtB_UnitOnBill.Text = product.unitOnBill.ToString(); }
public bool Appoinment(PatientRegister SearchModel) { using (HMS_APIEntities hms = new HMS_APIEntities()) { // i put business logic in a (PatientRegister.cs) for sorting by Id,Name,Phone var business = new ProductBusinessLogic(); var model = business.PatientRegister(SearchModel); } return(true); }
public MainForm() { InitializeComponent(); _supplierBusinessLogic = new SupplierBusinessLogic(); _productBusinessLogic = new ProductBusinessLogic(); _userBusinessLogic = new UserBusinessLogic(); _billBusinessLogic = new BillBusinessLogic(); _shipperBusinessLogic = new ShipperBussinessLogic(); _productTypeBusinessLogic = new ProductTypeBusinessLogic(); _importBusinessLogic = new ImportBusinessLogic(); }
public BillDetailForm(int?BillId = null, int?CusId = null, int?ShipperId = null) { InitializeComponent(); _billBusinessLogic = new BillBusinessLogic(); _billDetailBusinessLogicLayer = new BillDetailBusinessLogicLayer(); _shipperBussinessLogic = new ShipperBussinessLogic(); _userBusinessLogic = new UserBusinessLogic(); _productBusinessLogic = new ProductBusinessLogic(); if (BillId == null || CusId == null || ShipperId == null) { return; } _BillId = (int)BillId; _CusId = (int)CusId; _ShipperId = (int)ShipperId; btn_UpdateNote.Enabled = false; btn_UpdateShipperForBill.Enabled = false; rTxtB_Note.Enabled = false; bill = _billBusinessLogic.GetBillById(_BillId); txtB_BillId.Text = bill.Id.ToString(); txtB_BillStatus.Text = bill.Status; txtB_DateOrder.Text = bill.DateOrder.ToString(); txtB_TotalMoney.Text = bill.Total.ToString(); txtB_Addr.Text = bill.Addr; txtB_Dis.Text = bill.Dis; txtB_city.Text = bill.City; rTxtB_Note.Text = bill.Note; customer = _userBusinessLogic.GetDetailUser(_CusId); txtB_NameCus.Text = customer.Name; GridView_BillDetails.DataSource = _billDetailBusinessLogicLayer.GetBillDetailsByBillId(_BillId); if (_ShipperId == 0) { return; } shipper = _shipperBussinessLogic.GetDetailShipper(_ShipperId); txtB_ShiperName.Text = shipper.Name; txtB_ShipperEmail.Text = shipper.Email; txtB_ShipperPhone.Text = shipper.Phone; }
public void ProductEmptyName_ShouldThrow() { // Arrange var sut = new ProductBusinessLogic( Mock.Of <IProductRepository>(), Mock.Of <IMapper>(), new CreateProductValidator(), Mock.Of <UpdateProductValidator>()); // Act // Assert Assert.Throws <ValidationException>(() => { sut.AddNew(new CreateProductDto() { ProductName = string.Empty }); }); }
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 } }
public void ProductBusinessLogic_ApplyBusinessRuleTest() { var model1 = new ProductModel() { Rating = 5, Featured = false, }; var model2 = new ProductModel() { Rating = 9, Featured = false, }; var bl = new ProductBusinessLogic(); bl.ApplyBusinessRules(model1); bl.ApplyBusinessRules(model2); Assert.False(model1.Featured); Assert.True(model2.Featured); }
public ProductController() { product = new ProductBusinessLogic(); }
public ApprovementController() { _business = new ProductBusinessLogic(); }
public ProductController() { _business = new ProductBusinessLogic(); _store = new StoreBusinessLogic(); }
public OrderController() { _business = new OrderBusinessLogic(); _product = new ProductBusinessLogic(); }
public ProductController(ProductBusinessLogic productLogic) { _productLogic = productLogic; }