Beispiel #1
0
        public virtual bool Check(System.Data.DataTable dt)
        {
            bool succ         = true;
            var  dt_source    = ODM.GetDataTable(TableName, 1);
            var  col_external = from DataColumn dc in dt.Columns select dc.ColumnName;
            var  col_source   = from DataColumn dc in dt_source.Columns select dc.ColumnName;

            foreach (var str in col_source)
            {
                if (!col_external.Contains(str))
                {
                    _Message = string.Format("The neccessary field {0} is missing", str);
                    succ     = false;
                    break;
                }
            }
            if (!succ)
            {
                return(false);
            }
            else
            {
                return(succ);
            }
        }
 private void cmbObsVars_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ODM != null)
     {
         var pck  = Package as IDataPackage;
         var site = cmbObsSite.SelectedItem as Site;
         var varb = cmbObsVars.SelectedItem as Variable;
         var ts   = ODM.GetTimeSeries(new QueryCriteria()
         {
             Start        = pck.StartOfLoading,
             End          = pck.EndOfLoading,
             SiteID       = site.ID,
             VariableID   = varb.ID,
             VariableName = varb.Name
         });
         if (ts != null)
         {
             var    derieved_ts = TimeSeriesAnalyzer.Derieve(ts, pck.NumericalDataType, pck.TimeUnits);
             string sereis      = string.Format("{1} at {0}", site.Name, varb.Name);
             if (btnCompareMode.Checked)
             {
                 var sim_site = cmbSimSite.SelectedItem as Site;
                 if (sim_site != null && sim_site.TimeSeries != null)
                 {
                     TimeSeriesAnalyzer.Compensate(derieved_ts, sim_site.TimeSeries);
                     winChart_timeseries.Plot <double>(derieved_ts.DateTimes, derieved_ts[0, ":", "0"], sereis);
                 }
             }
             else
             {
                 winChart_timeseries.Plot <double>(derieved_ts.DateTimes, derieved_ts[0, ":", "0"], sereis);
             }
         }
     }
 }
 public override void CustomExport(DataTable source)
 {
     if (source != null)
     {
         var sites   = GetSites(source);
         var setting = _ExportSetting as SiteExportSetting;
         foreach (var site  in sites)
         {
             var series = new ObservationSeries()
             {
                 SiteID     = site.ID,
                 VariableID = setting.VariableID
             };
             var ts = ODM.GetTimeSereis(series);
             if (ts != null)
             {
                 var filename = Path.Combine(setting.Directory, site.Name + ".csv");
                 var var_odm  = ODM.GetVariable(setting.VariableID);
                 ts.Name = var_odm.Name;
                 CSVFileStream csv = new CSVFileStream(filename);
                 csv.Save(ts);
             }
         }
     }
 }
Beispiel #4
0
        public override bool Check(DataTable dt)
        {
            bool succ         = true;
            var  dt_source    = ODM.GetDataTable(TableName, 1);
            var  col_external = from DataColumn dc in dt.Columns select dc.ColumnName;
            var  col_source   = (from DataColumn dc in dt_source.Columns select dc.ColumnName).ToList();

            col_source.Remove("ValueID");

            foreach (var str in col_source)
            {
                if (!col_external.Contains(str))
                {
                    _Message = string.Format("The neccessary field {0} is missing", str);
                    succ     = false;
                    break;
                }
            }
            if (!succ)
            {
                return(false);
            }
            else
            {
                return(succ);
            }
        }
Beispiel #5
0
        private void ODMDatabaseListLoad()
        {
            odmList.Items.Clear();
            List <string>       odmDBList = new List <string>();
            TimeSeriesResources tmObj     = new TimeSeriesResources();

            odmDBList = tmObj.GetODMList();
            foreach (string s in odmDBList)
            {
                odmList.Items.Add(s);
            }
            if (odmList.Items.Count > 0)
            {
                odmList.SelectedValue = odmList.Items[odmList.Items.Count - 1].ToString();
            }

            siteCodeDropDownList.Items.Clear();
            variableCodeDropDownList.Items.Clear();

            ODM       odmInfo = new ODM();
            DataTable dt      = new DataTable();

            if (odmList.Items.Count > 0)
            {
                dt = odmInfo.GetODMInfo(odmList.Items[odmList.Items.Count - 1].ToString());
            }
            foreach (DataRow row in dt.Rows)
            {
                Title.Text       = row["title"].ToString();
                serverName.Text  = row["serveraddress"].ToString();
                Topic.Text       = row["topiccategory"].ToString();
                abstractODM.Text = row["abstract"].ToString();
                citation.Text    = row["citation"].ToString();
            }
            TimeSeriesResources tmResObj = new TimeSeriesResources();

            if (odmList.Items.Count > 0)
            {
                timeSeriesTable = tmResObj.GetTimeSeriesResources(odmList.Items[odmList.Items.Count - 1].ToString());
            }
            odmInfoGridView.DataSource = timeSeriesTable;
            odmInfoGridView.DataBind();
            ViewState["mydata"] = timeSeriesTable;
            //recordCount.Text = timeSeriesTable.Rows.Count.ToString() + " records";

            List <string> siteCodeListObj     = new List <string>();
            List <string> variableCodeListObj = new List <string>();

            foreach (DataRow row in timeSeriesTable.Rows)
            {
                siteCodeListObj.Add(row["sitecode"].ToString());
                variableCodeListObj.Add(row["variablecode"].ToString());
            }

            siteCodeDropDownList.DataSource = siteCodeListObj.Distinct().ToList();
            siteCodeDropDownList.DataBind();
            variableCodeDropDownList.DataSource = variableCodeListObj.Distinct().ToList();
            variableCodeDropDownList.DataBind();
        }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RWSSubjects"/> class.
        /// </summary>
        /// <param name="xmlString">The XML string.</param>
        public RWSSubjects(string xmlString)
        {
            ODM odm = RWSHelpers.Serializers.XmlDeserializeFromString <ODM>(xmlString);

            foreach (var clinData in odm.ClinicalData)
            {
                SubjectListItems.Add(new RWSSubjectListItem(clinData));
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RWSStudies"/> class.
        /// </summary>
        /// <param name="xmlString">The XML string.</param>
        public RWSStudies(string xmlString)
        {
            ODM odm = RWSHelpers.Serializers.XmlDeserializeFromString <ODM>(xmlString);

            foreach (var study in odm.Study)
            {
                StudyListItems.Add(new RWSStudyListItem(study));
            }
        }
Beispiel #8
0
 private void cmbSite_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbSite.SelectedItem != null && ODM != null)
     {
         var site  = cmbSite.SelectedItem as Site;
         var varbs = ODM.GetVariables(site.ID);
         cmbObsVars.DataSource = varbs;
     }
 }
Beispiel #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     resourceInfoDisplayGrid.Width = 6000;
     if (!IsPostBack)
     {
         string    odmName = Request.QueryString["odmname"];
         ODM       odmObj  = new ODM();
         DataTable dt      = new DataTable();
         dt = odmObj.GetUploadODMInfo(odmName);
         resourceInfoDisplayGrid.DataSource = dt;
         resourceInfoDisplayGrid.DataBind();
     }
 }
Beispiel #10
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (automatedDOICheckBox.Checked)
     {
         ODM odmObj = new ODM();
         odmObj.LoadODM(odmList.SelectedValue.ToString());
         odmList.Items.Clear();
         loadODMList();
     }
     else
     {
         Response.Redirect("customdoi.aspx?odmname=" + odmList.SelectedValue.ToString());
     }
 }
Beispiel #11
0
        private void BindSites()
        {
            var projectService = MyAppManager.Instance.CompositionContainer.GetExportedValue <IProjectService>();

            ODM = projectService.Project.ODMSource;
            if (ODM != null)
            {
                var sites = ODM.GetSites(Settings.Default.GagingStationSQL);
                if (sites != null)
                {
                    cmbSite.DataSource = sites;
                }
            }
        }
        private void BindSites()
        {
            var projectService = MyAppManager.Instance.CompositionContainer.GetExportedValue <IProjectService>();

            ODM = projectService.Project.ODMSource;
            if (ODM != null)
            {
                var sites = ODM.GetSites(SQLSelection);
                if (sites != null)
                {
                    cmbObsSite.DataSource = sites;
                }
            }
        }
Beispiel #13
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        //Debug.Log(collision.gameObject.ToString());
        Attached       = true;
        self.simulated = false;

        if (Shooter != null)
        {
            ODM script = Shooter.GetComponent <ODM>();
            if (script != null)
            {
                script.OnAttached(gameObject);
            }
        }
    }
        private void btnTest_Click(object sender, EventArgs e)
        {
            var sql = tbSQL.Text;

            if (sql != "" && ODM != null)
            {
                var dt = ODM.Execute(sql);
                if (dt != null)
                {
                    this.bindingSource1.DataSource = dt;
                    this.dataGridView1.DataSource  = this.bindingSource1;
                    this.btnOK.Enabled             = true;
                    SQLScript = tbSQL.Text;
                }
            }
        }
Beispiel #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RWSStudyMetadataVersions"/> class.
        /// </summary>
        /// <param name="xmlString">The XML string.</param>
        public RWSStudyMetadataVersions(string xmlString)
        {
            ODM odm = RWSHelpers.Serializers.XmlDeserializeFromString <ODM>(xmlString);

            if (odm.Study.Count == 0)
            {
                return;
            }

            Study = new RWSStudyListItem(odm.Study.First());

            foreach (var version in odm.Study.First().MetaDataVersion)
            {
                MetaDataVersions.Add(new RWSMetaDataVersion(version));
            }
        }
Beispiel #16
0
        protected void odmList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ODM       odmInfo = new ODM();
            DataTable dt      = new DataTable();
            string    s       = odmList.SelectedItem.ToString();

            dt = odmInfo.GetODMInfo(odmList.SelectedValue.ToString());
            foreach (DataRow row in dt.Rows)
            {
                Title.Text        = row["title"].ToString();
                serverName.Text   = row["serveraddress"].ToString();
                Topic.Text        = row["topiccategory"].ToString();
                abstractODM.Text  = row["abstract"].ToString();
                citation.Text     = row["citation"].ToString();
                waterOneWSDL.Text = row["wateroneflowwsdl"].ToString();
            }
        }
        public override void Finish()
        {
            SMW.ODM odmUtils = new ODM();
            //Utilities utils = new Utilities();
            string outputPath;

            if (_outDir != null)
            {
                outputPath = _outDir + "/GreenAmpt_output.csv";
            }
            else
            {
                outputPath = "../GreenAmpt_output.csv";
            }

            //------ Create ODM csv -----

            if (_Vals.Count > 0)
            {
                //Set Datetimes
                odmUtils.DateTimes = _DateTimes;
                //Set Values
                odmUtils.Values = _Vals;
                //Set Variable
                odmUtils.VariableName = "Streamflow";
                //Set Corresponding Variable Code
                odmUtils.VariableCode = "3";
                //Set Site Name
                string siteName = this.GetModelID().ToString();
                odmUtils.SiteName = siteName;
                //Select a Unique Site ID
                odmUtils.SiteCode = "40";
                //Set CSV Path
                odmUtils.CSVPath = System.Environment.CurrentDirectory;
                //Write CSV file
                odmUtils.CreateODMcsv();
                Console.WriteLine("ODM .csv has been written");
                //Write BAT file
                odmUtils.CreateBat();
                Console.WriteLine("ODM .bat has been written");
                //Load CSV into ODM by executing the BAT file
                odmUtils.LoadIntoODM();
                Console.WriteLine("Data has been loaded");
            }
        }
Beispiel #18
0
        private void loadODMList()
        {
            odmList.Items.Clear();
            TimeSeriesResources tmRes         = new TimeSeriesResources();
            List <string>       loadedODMList = tmRes.GetODMList();
            ODM           odmObj   = new ODM();
            List <string> loadList = odmObj.GetODMList();

            foreach (string s in loadedODMList)
            {
                loadList.Remove(s);
            }

            foreach (string s in loadList)
            {
                odmList.Items.Add(s);
            }
        }
Beispiel #19
0
        private void ODMInfoload(string odmName)
        {
            odmList.SelectedValue = odmName;
            ODM       odmInfo = new ODM();
            DataTable dt      = new DataTable();
            string    s       = odmList.SelectedItem.ToString();

            dt = odmInfo.GetODMInfo(odmName);
            foreach (DataRow row in dt.Rows)
            {
                Title.Text        = row["title"].ToString();
                serverName.Text   = row["serveraddress"].ToString();
                Topic.Text        = row["topiccategory"].ToString();
                abstractODM.Text  = row["abstract"].ToString();
                citation.Text     = row["citation"].ToString();
                waterOneWSDL.Text = row["wateroneflowwsdl"].ToString();
            }
        }
 private void cmbObsSite_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ODM != null)
     {
         var site  = cmbObsSite.SelectedItem as Site;
         var varbs = ODM.GetVariables(site.ID);
         var pck   = Package as IDataPackage;
         if (varbs != null)
         {
             var selected_var = from vv in varbs where vv.ID == pck.ODMVariableID select vv;
             if (selected_var != null)
             {
                 cmbObsVars.DataSource = selected_var.ToArray();
             }
             else
             {
                 cmbObsVars.DataSource = null;
             }
         }
     }
 }
Beispiel #21
0
        protected void odmList_SelectedIndexChanged(object sender, EventArgs e)
        {
            siteCodeDropDownList.Items.Clear();
            variableCodeDropDownList.Items.Clear();

            ODM       odmInfo = new ODM();
            DataTable dt      = new DataTable();

            dt = odmInfo.GetODMInfo(odmList.SelectedValue.ToString());
            foreach (DataRow row in dt.Rows)
            {
                Title.Text       = row["title"].ToString();
                serverName.Text  = row["serveraddress"].ToString();
                Topic.Text       = row["topiccategory"].ToString();
                abstractODM.Text = row["abstract"].ToString();
                citation.Text    = row["citation"].ToString();
            }
            TimeSeriesResources tmResObj = new TimeSeriesResources();

            timeSeriesTable            = tmResObj.GetTimeSeriesResources(odmList.SelectedValue.ToString());
            odmInfoGridView.DataSource = timeSeriesTable;
            odmInfoGridView.DataBind();
            ViewState["mydata"] = timeSeriesTable;
            //recordCount.Text = timeSeriesTable.Rows.Count.ToString() + " records";

            List <string> siteCodeListObj     = new List <string>();
            List <string> variableCodeListObj = new List <string>();

            foreach (DataRow row in timeSeriesTable.Rows)
            {
                siteCodeListObj.Add(row["sitecode"].ToString());
                variableCodeListObj.Add(row["variablecode"].ToString());
            }

            siteCodeDropDownList.DataSource = siteCodeListObj.Distinct().ToList();
            siteCodeDropDownList.DataBind();
            variableCodeDropDownList.DataSource = variableCodeListObj.Distinct().ToList();
            variableCodeDropDownList.DataBind();
        }
Beispiel #22
0
 private void cmbObsVars_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ODM != null)
     {
         var site = cmbSite.SelectedItem as Site;
         var varb = cmbObsVars.SelectedItem as Variable;
         var ts   = ODM.GetTimeSeries(new QueryCriteria()
         {
             Start        = _SFROutputPackage.StartOfLoading,
             End          = _SFROutputPackage.EndOfLoading,
             SiteID       = site.ID,
             VariableID   = varb.ID,
             VariableName = varb.Name
         });
         if (ts != null)
         {
             var    derieved_ts = TimeSeriesAnalyzer.Derieve(ts, _SFROutputPackage.NumericalDataType, _SFROutputPackage.TimeUnits);
             string sereis      = string.Format("{1} at {0}", site.Name, varb.Name);
             winChart_timeseries.Plot <double>(derieved_ts.DateTimes, derieved_ts[0, ":", "0"], sereis);
         }
     }
 }
Beispiel #23
0
        /*
         * Function    : gatherSpreadsheet()
         * Description : Gets data from excel spreadsheet and store it into the dictionaries accordingly.
         * Params      : (ref Dictionary<string, List<rowInfo>>) weeklyRowDict
         *				 (ref Dictionary<string, List<rowInfo>>) dailyRowDict
         *				 (ref Dictionary<string, List<rowInfo>>) wigigRowDict
         *				 (string) dateString
         * Return      :
         */

        public void GatherSpreadsheet(ref Dictionary <string, List <rowInfo> > weeklyRowDict, ref Dictionary <string, List <rowInfo> > dailyRowDict, ref Dictionary <string, List <rowInfo> > wigigRowDict, string dateString)
        {
            p.logger("[DataRetrieval.cs] Gathering data from spreadsheets");
            string[] cx       = Directory.GetFiles(ConfigurationManager.AppSettings["reportPath"], dateString + "_CX*");
            string[] wz       = Directory.GetFiles(ConfigurationManager.AppSettings["reportPath"], dateString + "_WZ*");
            string[] cx_wigig = Directory.GetFiles(ConfigurationManager.AppSettings["reportPath"], dateString + "_WIGIG_CX*");
            string[] fs       = Directory.GetFiles(ConfigurationManager.AppSettings["reportPath"], dateString + "_FS*");
            string[] odmList  = { "CX", "WZ", "FS" };

            foreach (string ODM in odmList)
            {
                var application = new Microsoft.Office.Interop.Excel.Application();
                application.Visible = false;
                p.logger("[DataRetrieval.cs] Gathering data from " + ODM);
                // Open up the Excel sheet for the current ODM
                Workbooks workbooks = application.Workbooks;
                Workbook  workbook  = null;

                if (ODM.Equals("CX") && cx.Length > 0)
                {
                    workbook = workbooks.Open(cx[0], ReadOnly: false);
                }
                else if (ODM.Equals("WZ") && wz.Length > 0)
                {
                    workbook = workbooks.Open(wz[0], ReadOnly: false);
                }
                else if (ODM.Equals("FS") && fs.Length > 0)
                {
                    workbook = workbooks.Open(fs[0], ReadOnly: false);
                }

                Process pid = GetProcess(application);

                if (workbook == null)
                {
                    continue;
                }
                var worksheets = workbook.Worksheets;
                // Iterate over the products' worksheets to insert data
                for (int i = 1; i <= worksheets.Count; i++)
                {
                    Worksheet worksheet       = (Worksheet)workbook.Worksheets[i];
                    var       rowCountTemp    = worksheet.UsedRange;
                    var       rowCountTemp2   = rowCountTemp.Rows;
                    int       rowCount        = rowCountTemp2.Count - 1;
                    bool      insertDailyData = false;
                    int       titleCount      = 0;

                    if (rowCountTemp != null)
                    {
                        Marshal.ReleaseComObject(rowCountTemp);
                    }

                    if (rowCountTemp2 != null)
                    {
                        Marshal.ReleaseComObject(rowCountTemp2);
                    }

                    // Start at the 2nd position because the first position contains the column titles.
                    // Iterate over all of the used rows to get data and save data to dictionaries.
                    for (int j = 2; j < (rowCount + 2); j++)
                    {
                        int     k         = 0;
                        var     rangeTemp = worksheet.UsedRange;
                        Range   range1    = rangeTemp.Rows[j];
                        rowInfo row       = new rowInfo();

                        if (rangeTemp != null)
                        {
                            Marshal.ReleaseComObject(rangeTemp);
                        }

                        foreach (Range r in range1.Cells)
                        {
                            string value = r.Text;

                            if ((string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value)) && (titleCount < 6))
                            {
                                insertDailyData = true;

                                if (value.Equals("Work Year") ||
                                    value.Equals("Work Week") ||
                                    value.Equals("Work Day") ||
                                    value.Equals("Failed Boards") ||
                                    value.Equals("Total Boards") ||
                                    value.Equals("Failure Rate (%)"))
                                {
                                    titleCount++;
                                }
                            }

                            if (!insertDailyData)
                            {
                                switch (k)
                                {
                                case 0:
                                    row.WorkYear = value;
                                    break;

                                case 1:
                                    row.WorkWeek = value;
                                    break;

                                case 2:
                                    int temp;
                                    Int32.TryParse(value, out temp);
                                    row.FailedBoards = temp;
                                    break;

                                case 3:
                                    int temp2;
                                    Int32.TryParse(value, out temp2);
                                    row.TotalBoards = temp2;
                                    break;

                                case 4:
                                    row.FailureRate = value;
                                    break;

                                case 5:
                                    row.Goal = value;
                                    break;
                                }
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(value) ||
                                    string.IsNullOrWhiteSpace(value) ||
                                    value.Equals("Work Year") ||
                                    value.Equals("Work Week") ||
                                    value.Equals("Work Day") ||
                                    value.Equals("Failed Boards") ||
                                    value.Equals("Total Boards") ||
                                    value.Equals("Failure Rate (%)"))
                                {
                                    continue;
                                }
                                else
                                {
                                    switch (k)
                                    {
                                    case 0:
                                        row.WorkYear = value;
                                        break;

                                    case 1:
                                        row.WorkWeek = value;
                                        break;

                                    case 2:
                                        row.WorkDay = value;
                                        break;

                                    case 3:
                                        int temp;
                                        Int32.TryParse(value, out temp);
                                        row.FailedBoards = temp;
                                        break;

                                    case 4:
                                        int temp2;
                                        Int32.TryParse(value, out temp2);
                                        row.TotalBoards = temp2;
                                        break;

                                    case 5:
                                        row.FailureRate = value;
                                        break;
                                    }
                                }
                            }

                            k++;

                            if (r != null)
                            {
                                Marshal.ReleaseComObject(r);
                            }
                        }

                        row.ODM = ODM;

                        if (string.IsNullOrEmpty(row.WorkYear) ||
                            string.IsNullOrEmpty(row.WorkWeek) ||
                            string.IsNullOrWhiteSpace(row.WorkYear) ||
                            string.IsNullOrWhiteSpace(row.WorkWeek))
                        {
                            continue;
                        }
                        if (!insertDailyData)
                        {
                            weeklyRowDict[worksheet.Name].Add(row);
                        }
                        else
                        {
                            dailyRowDict[worksheet.Name].Add(row);
                        }

                        if (range1 != null)
                        {
                            Marshal.ReleaseComObject(range1);
                        }
                    }

                    if (worksheet != null)
                    {
                        Marshal.ReleaseComObject(worksheet);
                    }
                }

                // Clean up the COM objects to remove "EXCEL.EXE" process
                if (worksheets != null)
                {
                    Marshal.ReleaseComObject(worksheets);
                }

                if (workbooks != null)
                {
                    Marshal.ReleaseComObject(workbooks);
                }

                if (workbook != null)
                {
                    workbook.Close(Type.Missing, Type.Missing, Type.Missing);
                    Marshal.ReleaseComObject(workbook);
                }

                if (application != null)
                {
                    application.Quit();
                    Marshal.ReleaseComObject(application);
                }

                pid.Kill();
                p.logger("[DataRetrieval.cs] Finished gathering data for " + ODM);
            }

            if (cx_wigig.Length <= 0)
            {
                return;
            }
            // Gather CX WIGIG data from spreadsheet
            var app = new Microsoft.Office.Interop.Excel.Application();

            app.Visible = false;
            Workbooks wbs      = app.Workbooks;
            Workbook  wb       = wbs.Open(cx_wigig[0], ReadOnly: false);
            Process   pidWigig = GetProcess(app);

            p.logger("[DataRetrieval.cs] Gathering data for WIGIG");
            var ws = wb.Worksheets;

            for (int i = 1; i <= ws.Count; i++)
            {
                Worksheet worksheet     = (Worksheet)wb.Worksheets[i];
                var       rowCountTemp  = worksheet.UsedRange;
                var       rowCountTemp2 = rowCountTemp.Rows;
                int       rowCount      = rowCountTemp2.Count - 1;

                if (rowCountTemp != null)
                {
                    Marshal.ReleaseComObject(rowCountTemp);
                }

                if (rowCountTemp2 != null)
                {
                    Marshal.ReleaseComObject(rowCountTemp2);
                }

                for (int j = 2; j < (rowCount + 2); j++)
                {
                    int     k         = 0;
                    var     rangeTemp = worksheet.UsedRange;
                    Range   range1    = rangeTemp.Rows[j];
                    rowInfo row       = new rowInfo();

                    if (rangeTemp != null)
                    {
                        Marshal.ReleaseComObject(rangeTemp);
                    }

                    foreach (Range r in range1.Cells)
                    {
                        string value = r.Text;

                        switch (k)
                        {
                        case 0:
                            row.WorkYear = value;
                            break;

                        case 1:
                            row.WorkWeek = value;
                            break;

                        case 2:
                            row.WorkDay = value;
                            break;

                        case 3:
                            int temp;
                            Int32.TryParse(value, out temp);
                            row.FailedBoards = temp;
                            break;

                        case 4:
                            int temp2;
                            Int32.TryParse(value, out temp2);
                            row.TotalBoards = temp2;
                            break;

                        case 5:
                            row.FailureRate = value;
                            break;
                        }

                        k++;

                        if (r != null)
                        {
                            Marshal.ReleaseComObject(r);
                        }
                    }

                    row.ODM = "CX";

                    if (string.IsNullOrEmpty(row.WorkYear) ||
                        string.IsNullOrEmpty(row.WorkWeek) ||
                        string.IsNullOrWhiteSpace(row.WorkYear) ||
                        string.IsNullOrWhiteSpace(row.WorkWeek))
                    {
                        continue;
                    }
                    else
                    {
                        wigigRowDict[worksheet.Name].Add(row);
                    }

                    if (range1 != null)
                    {
                        Marshal.ReleaseComObject(range1);
                    }
                }

                if (worksheet != null)
                {
                    Marshal.ReleaseComObject(worksheet);
                }
            }

            if (ws != null)
            {
                Marshal.ReleaseComObject(ws);
            }

            if (wbs != null)
            {
                Marshal.ReleaseComObject(wbs);
            }

            if (wb != null)
            {
                wb.Close(Type.Missing, Type.Missing, Type.Missing);
                Marshal.ReleaseComObject(wb);
            }

            if (app != null)
            {
                app.Quit();
                Marshal.ReleaseComObject(app);
            }

            pidWigig.Kill();
            p.logger("[DataRetrieval.cs] Finished gathering data for WIGIG");
        }