/// <summary> /// Sets the cell san pham With SanPhamModel from outsite /// We need to save it to model of ChiTietHoaDon /// One HoaDon complete - create and pham /// </summary> /// <param name="value">The value.</param> public void SetCellSanPham(SanPhamModel value) { if (dataGridView != null) { if (dataGridView.Rows.Count > 0) { if (currentRowSelected != -1) { if (currentRowSelected < dataGridView.Rows.Count) { dataGridView.Rows[currentRowSelected].Selected = true; } else { currentRowSelected = 0; } } dataGridView.Rows[currentRowSelected].Cells[Rf.Name <ChiTietHdnModel>(c => c.MaGiayDep)].Value = (value == null) ? "-1" : value.MaGiayDep; if (value != null) { var m = dataGridView.Rows[currentRowSelected].Cells; for (int i = 0; i < currentListDataTable.Count; i++) { if (currentListDataTable.ElementAt(i).IDModel == m[Rf.Name <ChiTietHdnModel>(c => c.IDModel)].Value.ToString()) { currentListDataTable.ElementAt(i).SanPham = value.ToEntity(); } } } } } }