/// <summary> /// Function to execute query from RichTextBox to company path /// </summary> /// <param name="txt"></param> /// <returns></returns> public bool ExecuteQueries(RichTextBox txt) { decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId; bool iscontinue = true; try { if (cbUpdation.SelectedItems.Count == 0) { MessageBox.Show("Select DB to execute", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); cbUpdation.Focus(); } else { foreach (System.Data.DataRowView p in cbUpdation.CheckedItems) { PublicVariables._decCurrentCompanyId = Convert.ToDecimal(p[0].ToString()); PathForExecuter = p[2].ToString(); CompanySP SpcompanyForExecuter = new CompanySP(); if (File.Exists(PathForExecuter + "\\DBOpenMiracle.mdf")) { string error = SpcompanyForExecuter.StoredProcedureInserter(txtNarration.Text.Trim()); if (error.Trim() != string.Empty) { if (MessageBox.Show(PathForExecuter + " :\n" + error + "\n Continue?", "OpenMiracle", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { iscontinue = true; } else { iscontinue = false; } if (failed == string.Empty) { failed = PathForExecuter; } else { failed = failed + " , " + PathForExecuter; } } else { if (success == "") { success = PathForExecuter; } else { success = success + " , " + PathForExecuter; } } } else { if (MessageBox.Show("DB does not exist in " + PathForExecuter + "\n Continue?", "OpenMiracle", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { iscontinue = true; } else { iscontinue = false; } if (failed == string.Empty) { failed = PathForExecuter; } else { failed = failed + " , " + PathForExecuter; } } if (!iscontinue) { break; } } } PublicVariables._decCurrentCompanyId = decCompanyIdForTemp; } catch (Exception ex) { MessageBox.Show("SPIns:2" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(iscontinue); }
/// <summary> /// Function to execute query from RichTextBox to company path /// </summary> /// <param name="txt"></param> /// <returns></returns> public bool ExecuteQueries(RichTextBox txt) { decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId; bool iscontinue = true; try { if (cbUpdation.SelectedItems.Count == 0) { MessageBox.Show("Select DB to execute", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); cbUpdation.Focus(); } else { foreach (System.Data.DataRowView p in cbUpdation.CheckedItems) { PublicVariables._decCurrentCompanyId = Convert.ToDecimal(p[0].ToString()); PathForExecuter = p[2].ToString(); CompanySP SpcompanyForExecuter = new CompanySP(); if (File.Exists(PathForExecuter + "\\DBOpenMiracle.mdf")) { string error = SpcompanyForExecuter.StoredProcedureInserter(txtNarration.Text.Trim()); if (error.Trim() != string.Empty) { if (MessageBox.Show(PathForExecuter + " :\n" + error + "\n Continue?", "OpenMiracle", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { iscontinue = true; } else { iscontinue = false; } if (failed == string.Empty) failed = PathForExecuter; else failed = failed + " , " + PathForExecuter; } else { if (success == "") success = PathForExecuter; else success = success + " , " + PathForExecuter; } } else { if (MessageBox.Show("DB does not exist in " + PathForExecuter + "\n Continue?", "OpenMiracle", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { iscontinue = true; } else { iscontinue = false; } if (failed == string.Empty) failed = PathForExecuter; else failed = failed + " , " + PathForExecuter; } if (!iscontinue) break; } } PublicVariables._decCurrentCompanyId = decCompanyIdForTemp; } catch (Exception ex) { MessageBox.Show("SPIns:2" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return iscontinue; }