private void LoadFormWithData() { if (_purchaseChallanDetailList == null || _purchaseChallanDetailList.Count <= 0) { _isAddNewMode = true; ClearForm(); return; } _purchaseChallanDetail = _purchaseChallanDetailList[_currentIndex]; txtPurchaseChallanDetailId.Text = Convert.ToString(_purchaseChallanDetail.Id); cbxProductCategory.SelectedValue = _purchaseChallanDetail.ProductCategoryId; cbxProduct.SelectedValue = _purchaseChallanDetail.ProductId; txtProductName.Text = _purchaseChallanDetail.ProductName; txtProductUnitPrice.TextChanged -= txtProductUnitPrice_TextChanged; txtProductUnitPrice.Text = Convert.ToString(_purchaseChallanDetail.ProductUnitPrice); txtProductUnitPrice.TextChanged += txtProductUnitPrice_TextChanged; txtProductQuantity.TextChanged -= txtProductQuantity_TextChanged; txtProductQuantity.Text = Convert.ToString(_purchaseChallanDetail.ProductQuantity); txtProductQuantity.TextChanged += txtProductQuantity_TextChanged; txtTotalProductPrice.Text = Convert.ToString(_purchaseChallanDetail.TotalPrice); txtDescription.Text = _purchaseChallanDetail.Description; chkIsActive.Checked = _purchaseChallanDetail.IsActive; dgvProductDetailList.Rows[_currentIndex].Selected = true; dgvProductDetailList.CurrentCell = dgvProductDetailList.Rows[_currentIndex].Cells[0]; _isChanged = false; _isAddNewMode = false; }
public PurchaseChallanDetailsForm(PurchaseChallanModel purchaseChallan) { InitializeComponent(); IKernel kernel = BootStrapper.Initialize(); _purchaseChallanDetailService = kernel.GetService(typeof(PurchaseChallanDetailService)) as PurchaseChallanDetailService; _productCategoryService = kernel.GetService(typeof(ProductCategoryService)) as ProductCategoryService; _productService = kernel.GetService(typeof(ProductService)) as ProductService; _purchaseChallan = purchaseChallan; _purchaseChallanDetail = new PurchaseChallanDetailModel(); }