private void DepartmentStockInExtra_Load(object sender, EventArgs e) { var eventArgs = new DepartmentStockInEventArgs(); EventUtility.fireEvent(FillDepartmentEvent, this, eventArgs); IList departmentList = new ArrayList(); departmentList.Add(new Department { DepartmentId = 0, DepartmentName = "--- Hãy chọn cửa hàng xuất ---" }); foreach (Department department in eventArgs.DepartmentList) { departmentList.Add(department); } bdsDept.DataSource = departmentList; deptSIDetailList = new DepartmentStockInDetailCollection(bdsStockIn); bdsStockIn.DataSource = deptSIDetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); deptSIDetailList = new DepartmentStockInDetailCollection(bdsStockIn); bdsStockIn.DataSource = deptSIDetailList; dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError); // create DepartmentStockIn if (deptSI == null) { deptSI = new DepartmentStockIn(); deptSI.CreateDate = DateTime.Now; deptSI.UpdateDate = DateTime.Now; deptSI.CreateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.UpdateId = ClientInfo.getInstance().LoggedUser.Name; deptSI.ExclusiveKey = 0; CreateNewStockInDetail(); // load products to extra combo box LoadProductMasterToComboBox(); deptSIDetailList.RemoveAt(0); bdsStockIn.EndEdit(); } else { // btnBarcode.Visible = true; // numericUpDownBarcode.Visible = true; // btnPreview.Visible = true; IList deptStockInDetails = deptSI.DepartmentStockInDetails; foreach (DepartmentStockInDetail detail in deptStockInDetails) { if (detail.DelFlg == CommonConstants.DEL_FLG_NO) { deptSIDetailList.Add(detail); detail.OldQuantity = detail.Quantity; } } for (int i = 0; i < dgvDeptStockIn.Columns.Count; i++) { dgvDeptStockIn.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; if (i != QUANTITY_POS && i != PRICE_POS && i != SELL_PRICE_POS) { dgvDeptStockIn.Columns[i].ReadOnly = true; } } txtDexcription.Text = deptSI.Description; } deptSI.DepartmentStockInDetails = ObjectConverter.ConvertToNonGenericList<DepartmentStockInDetail>(deptSIDetailList); }