private void btnRemoveFromList_Click(object sender, EventArgs e) { if (lst_InventoryItems.SelectedItems.Count == 0 || List_InventoryItem_UnitMeasurment == null) { return; } InventoryItem_cu selectedInventoryItem = (InventoryItem_cu)lst_InventoryItems.SelectedItem; if (selectedInventoryItem == null) { return; } if (List_SelectedInventoryItemToBedAdded.Exists( item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(selectedInventoryItem.ID)))) { List_SelectedInventoryItemToBedAdded.Remove(selectedInventoryItem); } CommonViewsActions.FillListBoxControl(lst_InventoryItems, List_SelectedInventoryItemToBedAdded); lst_InventoryItems.Refresh(); InventoryItem_UnitMeasurment_cu inventoryItemUnitMeasurment = List_InventoryItem_UnitMeasurment.Find( item => Convert.ToInt32(item.InventoryItem_CU_ID).Equals(Convert.ToInt32(selectedInventoryItem.ID))); if (inventoryItemUnitMeasurment == null) { return; } List_InventoryItem_UnitMeasurment.Remove(inventoryItemUnitMeasurment); }
private void btnAddList_Click(object sender, EventArgs e) { if (lkeUnitMeasurments.EditValue == null) { XtraMessageBox.Show("يجـب إختيــار البـرنـامج", "تنبيــــــــــه", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } if (SelectedInventoryItemFromGrid == null) { XtraMessageBox.Show("يجب إختيــار مجمـوعــة المستخـدميـــن", "تنبيــــــــــه", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } if (List_SelectedInventoryItemToBedAdded == null) { List_SelectedInventoryItemToBedAdded = new List <InventoryItem_cu>(); } if (List_SelectedInventoryItemToBedAdded.Count > 0) { if (List_SelectedInventoryItemToBedAdded.Exists( item => Convert.ToInt32(item.ID).Equals(Convert.ToInt32(SelectedInventoryItemFromGrid.ID)))) { XtraMessageBox.Show("تمــت إضافتـــه مـن قبـــل", "تنبيــــــــــه", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } } List_SelectedInventoryItemToBedAdded.Add(SelectedInventoryItemFromGrid); CommonViewsActions.FillListBoxControl(lst_InventoryItems, List_SelectedInventoryItemToBedAdded); lst_InventoryItems.Refresh(); InventoryItem_UnitMeasurment_cu inventoryItemUnitMeasurment = new InventoryItem_UnitMeasurment_cu(); inventoryItemUnitMeasurment.InventoryItem_CU_ID = SelectedInventoryItemFromGrid.ID; inventoryItemUnitMeasurment.UnitMeasurment_CU_ID = Convert.ToInt32(lkeUnitMeasurments.EditValue); if (List_InventoryItem_UnitMeasurment == null) { List_InventoryItem_UnitMeasurment = new List <InventoryItem_UnitMeasurment_cu>(); } List_InventoryItem_UnitMeasurment.Add(inventoryItemUnitMeasurment); }