예제 #1
0
        public bool AnyMissngTables(ref OperationResult op)
        {
            if (!HastunesSongTable || !HasItunesPlaylistTable || !HasItunesPlaylistSongTable)
            {
                op.AddInformation("Missing Table)s:\n");

                if (!HastunesSongTable)
                {
                    op.AddInformation("Missing tbItunesSong table.\n");
                }

                if (!HasItunesPlaylistTable)
                {
                    op.AddInformation("Missing tbMp3Info table.\n");
                }

                if (!HasItunesPlaylistSongTable)
                {
                    op.AddInformation("Missing tbItunesPlaylistSong table.\n");
                }
                return(true);
            }
            return(false);
        }
예제 #2
0
        public bool AnyMissngTables(ref OperationResult op)
        {
            if (!HasFileInfoTable || !HasMp3InfoTable || !HasArtistTable)
            {
                op.AddInformation("Missing Table)s:\n");

                if (!HasFileInfoTable)
                {
                    op.AddInformation("Missing tbFileInfo table.\n");
                }

                if (!HasMp3InfoTable)
                {
                    op.AddInformation("Missing tbMp3Info table.\n");
                }

                if (!HasArtistTable)
                {
                    op.AddInformation("Missing tbArtist table.\n");
                }
                return(true);
            }
            return(false);
        }
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            Op.AddInformation("Files copied successfully.");

            //try
            //{
            //    System.Diagnostics.Process.Start("explorer.exe", ucGetToPath.FileName);
            //}
            //catch (Exception ex)
            //{

            //    Op.AddException(ex);
            //}

            ucResultDisplay1.DisplayText = Op.GetAllInfos("\n");
        }
예제 #4
0
        private void btnExecuteSql_Click(object sender, EventArgs e)
        {
            OperationResult op = new OperationResult();

            lblResults.Text  = "Results (0)";
            rtbMessages.Text = "";

            dgvSqlResults.DataSource = null;
            try
            {
                MP3DBManager mdbmgr = new MP3DBManager();
                mdbmgr.SetDataStore(ddtbMp3DbFile.ItemText, ref op);

                Dictionary <string, string> parms = new Dictionary <string, string>();

                string sql = rtbSql.Text;
                parms.Add("Sql", sql);

                DataTable dt    = mdbmgr.RunSqlScript(ref parms, DAL.SqlScriptEnum.DynamicSQL, ref op);
                int       count = 0;

                if (dt != null && dt.Rows.Count > 0)
                {
                    count = dt.Rows.Count;
                    dgvSqlResults.DataSource = dt;
                    lblResults.Text          = $"Results ({count})";
                }

                if (op.Success)
                {
                    op.AddInformation("SQL Excution Successfull");
                    rtbMessages.Text = op.GetAllInfos("\n");
                }
                else
                {
                    rtbMessages.Text = op.GetAllErrorsAndExceptions("\n");
                }
            }
            catch (Exception ex)
            {
                op.AddException(ex);
                rtbMessages.Text = op.GetAllErrorsAndExceptions("\n");
            }
        }
예제 #5
0
        private void btnExecuteSql_Click(object sender, EventArgs e)
        {
            OperationResult op = new OperationResult();

            lblResults.Text  = "Results (0)";
            rtbMessages.Text = "";

            dgvSqlResults.DataSource = null;
            try
            {
                string sql = rtbSql.Text;

                DataTable dt = _mp3Repository.RunSql(sql, ref op);
                if (!op.Success)
                {
                    rtbMessages.Text = op.GetAllErrorsAndExceptions("\n");
                    return;
                }

                int count = 0;

                if (dt != null && dt.Rows.Count > 0)
                {
                    count = dt.Rows.Count;
                    dgvSqlResults.DataSource = dt;
                    lblResults.Text          = $"Results ({count})";
                }

                if (op.Success)
                {
                    op.AddInformation("SQL Excution Successfull");
                    rtbMessages.Text = op.GetAllInfos("\n");
                }
                else
                {
                    rtbMessages.Text = op.GetAllErrorsAndExceptions("\n");
                }
            }
            catch (Exception ex)
            {
                op.AddException(ex);
                rtbMessages.Text = op.GetAllErrorsAndExceptions("\n");
            }
        }
예제 #6
0
        public void CreateM3U(ref OperationResult op)
        {
            if (!IsSet)
            {
                op.AddError("M3U object not set.  You must call the \"SetM3U(string fileNameAndPath, " +
                            "ref OperationResult op)\" successfully before you can create an M3U file");
                return;
            }

            if (this.M3USongList.Count < 1)
            {
                op.AddError("There are no songs in the M3U list.  You must call the \"SetM3USongs(List<string> list, bool" +
                            "addOrReplace, ref OperationResult op)\" successfully before you can create an M3U file");
                return;
            }

            List <string> mList = new List <string>();

            //mList.Add("#EXTM3U - Created by Barry Hill's M3U Editor");
            //mList.Add("#EXTINF - ");

            mList.AddRange(this.M3USongList);

            string fname = this.M3UFileNameAndPath;

            if (!fname.EndsWith(".m3u", StringComparison.CurrentCultureIgnoreCase))
            {
                fname = fname + ".m3u";
            }

            BCHFileIO.WriteFullFile(fname, mList, ref op);

            if (!op.Success)
            {
                return;
            }

            op.AddInformation("M3U file created successfully.");
        }
예제 #7
0
        private List <string> GetTableData(string sql, string tableName, string delimiter, ref OperationResult op)
        {
            List <string> data = new List <string>();

            try
            {
                MP3DBManager mdbmgr = new MP3DBManager();
                mdbmgr.SetDataStore(ddtbMp3DbFile.ItemText, ref op);

                Dictionary <string, string> parms = new Dictionary <string, string>();

                parms.Add("Sql", sql);

                DataTable dt     = mdbmgr.RunSqlScript(ref parms, DAL.SqlScriptEnum.DynamicSQL, ref op);
                string    colVal = "";

                if (dt != null && dt.Rows.Count > 0)
                {
                    DataTable dtn = mdbmgr.GetDbTables(ref op);

                    DataTable dtColomns = mdbmgr.GetDbTableColumns(tableName, ref op);

                    StringBuilder rowData   = new StringBuilder();
                    string        rowString = "";
                    int           colCount  = dt.Columns.Count;

                    string val;
                    string cols = "";
                    int    c    = 0;


                    foreach (DataRow row in dtColomns.Rows)
                    {
                        val   = row["ColumnName"] != null && row["ColumnName"].ToString().Trim().Length > 0 ? row["ColumnName"].ToString().Trim() : string.Empty;
                        cols += val + (c < colCount - 1 ? delimiter : "");
                        c++;
                    }

                    data.Add(cols);


                    foreach (DataRow row in dt.Rows)
                    {
                        rowData = new StringBuilder();
                        for (int i = 0; i < colCount; i++)
                        {
                            //if(tableName == )
                            colVal = row[i].ToString();
                            colVal = string.IsNullOrWhiteSpace(colVal) ? "<null>>" : colVal;
                            rowData.Append(colVal + (i < colCount - 1 ? delimiter: ""));
                        }

                        rowString = rowData.ToString();
                        data.Add(rowString);
                    }
                }

                if (op.Success)
                {
                    op.AddInformation("SQL Excution Successfull");
                }
            }
            catch (Exception ex)
            {
                op.AddException(ex);
            }
            return(data);
        }