コード例 #1
0
        //#endregion

        #region Events
        private void btnCreateSequence_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ddlTables.SelectedValue != null && ddlTables.SelectedValue.ToString().Equals("ALL"))
                {
                    if (MessageBox.Show("Do you want to Create Sequence for All tables?", _strMessageBoxCaption, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        foreach (DataRow row in _dtTables.Rows)
                        {
                            _strTableName = row["TABLE_NAME"].ToString();
                            StringBuilder sb       = _iDbBuilder.BuildSequence(_strTableName);
                            string        filePath = _strFileSavedDirectory + "SEQUENCE_Script.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();
                    StringBuilder sb       = _iDbBuilder.BuildSequence(_strTableName);
                    string        filePath = _strFileSavedDirectory + "SEQUENCE_" + _strTableName + "_Script.sql";

                    if (!string.IsNullOrEmpty(sb.ToString()))
                    {
                        Util.Utility.WriteToDisk(filePath, sb.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);
            }
        }