示例#1
0
    public static int CreateNewDownloadVersion(SqlConnection oConnData, int downloadPK, int overwrite)
    {
        int new_ddversPK;

        if (overwrite == 0)
        {
            //LOG THE NEW DOWNLOAD VERSION
            new_ddversPK = DownloadData.NewDownload_vers_INSERT(oConnData, downloadPK);
        }
        else
        {
            new_ddversPK = downloadPK;
        }

        //int new_ddversPK = 0;

        if (new_ddversPK > 0)
        {
            //The vers should always be 1 for new downloads
            SqlCommand cmdVers = new SqlCommand("select vers from datDownload_vers   where ddversPK =" + new_ddversPK.ToString(), oConnData);
            int        vers    = (int)cmdVers.ExecuteScalar();


            SqlCommand cmdFiletype = new SqlCommand("select filetype from datDownload   where downloadPK =" + downloadPK.ToString(), oConnData);
            string     filetype    = (string)cmdFiletype.ExecuteScalar();


            //string[] measnames = mlist_names.Split('|');

            //RETRIEVE THE DATA
            //  Note that the datDownload_vers_measinfo & _subjinfo tables are
            //  populated based on what is retrieved below.
            DataTable[] myDT = DownloadData.DownloadDataArray2(oConnData, Convert.ToInt16(new_ddversPK));

            string filename = "zipdata_" + downloadPK.ToString() + "_v" + vers.ToString();


            //string info_msg = "";
            //string data_msg = "";

            if (filetype == "Excel XML")
            {
                CreateExcel(myDT, filename);
            }

            else if (filetype == "TAB zip")
            {
                CreateTABzip(myDT, filename);
            }
        }
        else
        {
            // new_ddversPK = -999;
        }

        return(new_ddversPK);
    }
示例#2
0
    public static int CreateNewDownload(SqlConnection oConnData, string downloadName, string filetype, int studyID, int inclREL, string mlist, string tplist, string grplist, string sslist)
    {
        //!!!!!!!!!!!!!!!!!!!!!!!!
        //LOG THE NEW DOWNLOAD

        int new_downloadPK = DownloadData.NewDownload_INSERT(oConnData, downloadName, filetype, studyID, inclREL, mlist, tplist, grplist, sslist);
        int new_ddversPK   = DownloadData.NewDownload_vers_INSERT(oConnData, new_downloadPK);

        //The vers should always be 1 for new downloads
        SqlCommand cmdVers = new SqlCommand("select vers from datDownload_vers   where ddversPK =" + new_ddversPK.ToString(), oConnData);
        int        vers    = (int)cmdVers.ExecuteScalar();


///        string[] measnames = mlist_names.Split('|');

        //RETRIEVE THE DATA
        DataTable[] myDT = DownloadData.DownloadDataArray2(oConnData, Convert.ToInt16(new_ddversPK));

        string filename = "zipdata_" + new_downloadPK.ToString() + "_v" + vers.ToString();

        //string info_msg = "";
        //string data_msg = "";

        if (filetype == "Excel XML")
        {
            CreateExcel(myDT, filename);
        }

        else if (filetype == "TAB zip")
        {
            CreateTABzip(myDT, filename);
        }
        // Handle other file types here...

        ///!!!!!!!!!!!!!!!!!!!!!!!!!!
        return(new_ddversPK);
    }