private void DamageButton_Click(object sender, EventArgs e) { // ******* getting StockOutTye form Enum foreach (var stockOut in stockOutAddList) { stockOut.StockOutType = Convert.ToInt32(StockOut.StockOutTypeEnum.Damage); } // ******* getting StockOutTye form Enum int listCount = stockOutAddList.Count; if (listCount != 0) { bool msg = true; foreach (StockOut st in stockOutAddList) // StockOutList Looping here { bool isAdded = _stockOutManager.DamageAdd(st); if (isAdded) { if (msg) { MessageBox.Show("Successfully Executed for Damage"); msg = false; } } else { if (msg) { MessageBox.Show("Sorry! Executed failed"); msg = false; } } } // End loop of List here stockOutAddList.Clear(); stockOutdisplayList.Clear(); itemStockOutDataGridView.DataSource = null; } else { MessageBox.Show("Add atleast One Item."); // If List is empty then show message } }