private void btnCreateGetProcedure_Click(object sender, RoutedEventArgs e) { try { if (ddlTables.SelectedValue != null && ddlTables.SelectedValue.ToString().Equals("ALL")) { if (MessageBox.Show("Do you want to Create Get Procedure for All tables?", _strMessageBoxCaption, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { foreach (DataRow row in _dtTables.Rows) { _strTableName = row["TABLE_NAME"].ToString(); DataTable dt = GetColumnsDesc(); StringBuilder sb = _iDbBuilder.BuildGetProcedure(_strTableName, dt); string filePath = _strFileSavedDirectory + "usp" + _strTableName + "Get.sql"; if (!string.IsNullOrEmpty(sb.ToString())) { Util.Utility.WriteToDisk(filePath, sb.ToString()); } else { MessageBox.Show("OOPs!! There's nothing to create...", _strMessageBoxCaption, MessageBoxButton.OK); } } } } else if (ddlTables.SelectedValue != null && !string.IsNullOrEmpty(ddlTables.SelectedValue.ToString())) { _strTableName = ddlTables.SelectedValue.ToString(); DataTable dt = GetColumnsDesc(); StringBuilder sb = _iDbBuilder.BuildGetProcedure(_strTableName, dt); string filePath = _strFileSavedDirectory + "usp" + _strTableName + "Get.sql"; if (!string.IsNullOrEmpty(sb.ToString())) { Util.Utility.WriteToDisk(filePath, sb.ToString()); } else { MessageBox.Show("OOPs!! There's nothing to create...", _strMessageBoxCaption, MessageBoxButton.OK); } //Ext StringBuilder sb2 = _iDbBuilder.BuildGetProcedureSingle(_strTableName, dt); string filePath2 = _strFileSavedDirectory + "usp" + _strTableName + "SingleGet.sql"; if (!string.IsNullOrEmpty(sb2.ToString())) { Util.Utility.WriteToDisk(filePath2, sb2.ToString()); } //else { MessageBox.Show("OOPs!! There's nothing to create...", _strMessageBoxCaption, MessageBoxButton.OK); } //Ext StringBuilder sb3 = _iDbBuilder.BuildGetProcedureParameterized(_strTableName, dt); string filePath3 = _strFileSavedDirectory + "usp" + _strTableName + "ParameterizedGet.sql"; if (!string.IsNullOrEmpty(sb3.ToString())) { Util.Utility.WriteToDisk(filePath3, sb3.ToString()); } //else { MessageBox.Show("OOPs!! There's nothing to create...", _strMessageBoxCaption, MessageBoxButton.OK); } } } catch (Exception ex) { MessageBox.Show(ex.Message, _strMessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Error); } }