private void LoadFormWithData() { txtPurchaseReceiveId.Text = Convert.ToString(_purchaseReceiveDetail.PurchaseReceiveId); txtPurchaseReceiveDetailId.Text = Convert.ToString(_purchaseReceiveDetail.Id); txtProductId.Text = Convert.ToString(_purchaseReceiveDetail.ProductId); txtProductName.Text = _purchaseReceiveDetail.ProductName; txtProductCategory.Text = _purchaseReceiveDetail.ProductCategoryName; txtSupplier.Text = _purchaseReceiveDetail.SupplierName; _productPrice = _productPriceService.GetAll().FirstOrDefault(p => p.PurchaseReceiveDetailId == _purchaseReceiveDetail.Id); if (_productPrice == null) { _isAddNewMode = true; ClearForm(); return; } txtProductPriceId.Text = Convert.ToString(_productPrice.Id); txtPurchaseUnitPrice.Text = Convert.ToString(_productPrice.PurchaseUnitPrice); txtDiscountInPercentage.TextChanged -= txtDiscountInPercentage_TextChanged; txtDiscountInPercentage.Text = Convert.ToString(_productPrice.DiscountInPercentage); txtDiscountInPercentage.TextChanged += txtDiscountInPercentage_TextChanged; txtProductCost.TextChanged -= txtProductCost_TextChanged; txtProductCost.Text = Convert.ToString(_productPrice.ProductCost); txtProductCost.TextChanged += txtProductCost_TextChanged; txtProductSalePrice.Text = Convert.ToString(_productPrice.ProductSalePrice); txtDescription.Text = _productPrice.Description; chkIsActive.Checked = _productPrice.IsActive; _isChanged = false; _isAddNewMode = false; }