public void m_ProductDelete(int vrProductCode, string vrProductName) { DialogResult vrResult; StockTrackingDataContext = new L_StockTrackingERPDataContext(); vrResult = MessageBox.Show(vrProductName + " ürününü silmek istiyor musunuz ?", "Silme", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (vrResult == DialogResult.Yes) { var Product_CountControl = from albProductCount in StockTrackingDataContext.p_ProductStockCountControl(vrProductCode) select albProductCount.Column1; foreach (var productCount in Product_CountControl) { //MessageBox.Show(productCount.ToString()); if (productCount.ToString() == "") { StockTrackingDataContext.p_ProductDel(vrProductCode); MessageBox.Show("Ürün Silindi", "Silme", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Ürünün Depolarda Stoğu Vardır Silemezsiniz", "Silme", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("Ürün Silme İşlemi İptal Edilmiştir", "Silme", MessageBoxButtons.OK, MessageBoxIcon.Information); } }