private void btnDelete_Click(object sender, EventArgs e) { try { DataTable dt = ((DataTable)grdOppList.DataSource); DataRow[] drRow = dt.Select("Select=1"); if (drRow.Length == 0) { Telerik.WinControls.RadMessageBox.Show(this, "Select at least one Opportunity.", "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); return; } else { DialogResult ds = Telerik.WinControls.RadMessageBox.Show(this, "Do you wish to delete selected Opportunity(s)?, you will lost all the info of the Opportunity(s)", "Confirmation", MessageBoxButtons.YesNo, RadMessageIcon.Info, MessageBoxDefaultButton.Button1); if (ds != DialogResult.Yes) { return; } ArrayList recForDelete = new ArrayList(); string strId = ""; for (int i = 0; i < drRow.Length; i++) { strId = drRow[i]["OPPORTUNITY_ID"].ToString(); if (ClsObj.fnCheckOPPHasInRanking("'" + drRow[i]["OPP_NAME"].ToString() + "'", Common.iProjectID)) { Telerik.WinControls.RadMessageBox.Show(this, "This opportunity is selected in Ranking, you can not delete this Opportunity", "Confirmation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1); break; } recForDelete.Add(strId + ";" + drRow[i]["OPP_NAME"].ToString()); //recForDelete.Add(new ValueItemPair(strId, drRow[i]["OPP_NAME"].ToString())); } if (recForDelete.Count > 0) { if (!ClsObj.fnDeleteOpportunity(recForDelete)) { return; } } fnLoadOpportunity(); } } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } }
private void btnOppInactive_Click(object sender, EventArgs e) { try { clsOpportunities clsObj = new clsOpportunities(); DataTable dt = ((DataTable)grdOppList.DataSource); DataRow[] drRow = dt.Select("Flag='Y'"); if (drRow.Length == 0) { Telerik.WinControls.RadMessageBox.Show(this, "Active/Inactive at least one Opportunity.", "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); return; } else { DialogResult ds = Telerik.WinControls.RadMessageBox.Show(this, "Do you wish to Active/Inactive selected Campaign(s)?", "Confirmation", MessageBoxButtons.YesNo, RadMessageIcon.Info, MessageBoxDefaultButton.Button1); if (ds != DialogResult.Yes) { return; } ArrayList recForInactive = new ArrayList(); string strId = ""; for (int i = 0; i < drRow.Length; i++) { strId = drRow[i]["OPP_NAME"].ToString(); if (ClsObj.fnCheckOPPHasInRanking(strId, Common.iProjectID)) { Telerik.WinControls.RadMessageBox.Show(this, "This opportunity is selected in Ranking, you can not Inactive this Opportunity", "Confirmation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1); break; } if ((bool)drRow[i]["Active"]) { strId += ";1"; } else { strId += ";0"; } recForInactive.Add(strId); } if (recForInactive.Count > 0) { for (int i = 0; i < recForInactive.Count; i++) { if (!clsObj.fnActiveOpportunities(recForInactive[i].ToString())) { return; } } } fnLoadOpportunity(); } } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } }