Пример #1
0
        private void LoadProductInformation()
        {
            if (cbxPurchaseReceiveDetail.SelectedItem == null || cbxPurchaseReceiveDetail.SelectedIndex < 0)
            {
                btnPriceDetail.Enabled = false;
                return;
            }

            btnPriceDetail.Enabled = true;
            long purchaseReceiveDetailId = Convert.ToInt64(cbxPurchaseReceiveDetail.SelectedValue);

            _purchaseReceiveDetail = _purchaseReceiveDetailList.FirstOrDefault(p => p.Id == purchaseReceiveDetailId);
            if (_purchaseReceiveDetail != null)
            {
                txtProductId.Text               = Convert.ToString(_purchaseReceiveDetail.ProductId);
                txtProductName.Text             = _purchaseReceiveDetail.ProductName;
                txtProductCategory.Text         = _purchaseReceiveDetail.ProductCategoryName;
                txtSupplier.Text                = _purchaseReceiveDetail.SupplierName;
                txtPurchaseReceiveQuantity.Text = Convert.ToString(_purchaseReceiveDetail.ProductQuantity);
            }

            LoadDataGridView();
            _currentIndex = 0;
            LoadFormWithData();
        }
Пример #2
0
        public ProductPriceForm(PurchaseReceiveDetailModel purchaseReceiveDetail)
        {
            InitializeComponent();
            IKernel kernel = BootStrapper.Initialize();

            _productPriceService   = kernel.GetService(typeof(ProductPriceService)) as ProductPriceService;
            _purchaseReceiveDetail = purchaseReceiveDetail;
        }
        public PurchaseReceiveDetailsForm(PurchaseReceiveModel purchaseReceive)
        {
            InitializeComponent();
            IKernel kernel = BootStrapper.Initialize();

            _purchaseReceiveDetailService = kernel.GetService(typeof(PurchaseReceiveDetailService)) as PurchaseReceiveDetailService;
            _purchaseChallanDetailService = kernel.GetService(typeof(PurchaseChallanDetailService)) as PurchaseChallanDetailService;
            _productCategoryService       = kernel.GetService(typeof(ProductCategoryService)) as ProductCategoryService;
            _productService = kernel.GetService(typeof(ProductService)) as ProductService;

            _purchaseReceive       = purchaseReceive;
            _purchaseReceiveDetail = new PurchaseReceiveDetailModel();
        }
        private void LoadFormWithData()
        {
            if (_purchaseReceiveDetailList == null || _purchaseReceiveDetailList.Count <= 0)
            {
                _isAddNewMode = true;
                ClearForm();
                return;
            }

            _purchaseReceiveDetail = _purchaseReceiveDetailList[_currentIndex];

            txtPurchaseReceiveDetailId.Text        = Convert.ToString(_purchaseReceiveDetail.Id);
            cbxPurchaseChallanDetail.SelectedValue = _purchaseReceiveDetail.PurchaseChallanDetailId;

            cbxProductCategory.SelectedValue = _purchaseReceiveDetail.ProductCategoryId;
            cbxProduct.SelectedValue         = _purchaseReceiveDetail.ProductId;
            txtProductName.Text = _purchaseReceiveDetail.ProductName;

            txtProductUnitPrice.TextChanged -= txtProductUnitPrice_TextChanged;
            txtProductUnitPrice.Text         = Convert.ToString(_purchaseReceiveDetail.ProductUnitPrice);
            txtProductUnitPrice.TextChanged += txtProductUnitPrice_TextChanged;

            txtProductQuantity.TextChanged -= txtProductQuantity_TextChanged;
            txtProductQuantity.Text         = Convert.ToString(_purchaseReceiveDetail.ProductQuantity);
            txtProductQuantity.TextChanged += txtProductQuantity_TextChanged;

            txtTotalProductPrice.Text = Convert.ToString(_purchaseReceiveDetail.TotalPrice);

            txtDescription.Text = _purchaseReceiveDetail.Description;
            chkIsActive.Checked = _purchaseReceiveDetail.IsActive;

            dgvProductDetailList.Rows[_currentIndex].Selected = true;
            dgvProductDetailList.CurrentCell = dgvProductDetailList.Rows[_currentIndex].Cells[0];
            _isChanged    = false;
            _isAddNewMode = false;
        }