//3.5.0.0 & 3.6.0.0 //TODO: Change back to Private and reduce the CONDID to one joined column public int DbRecsGetCondTabPreValues(string strCondIdMasterCondId, string strCondId_PotFireStandId, string strCurRxFilePath) { int intRet = 0; string strSqlCond = @"SELECT * FROM COND WHERE BIOSUM_COND_ID = '{0}'"; string strSqlFvsPotFire = @"SELECT * FROM FVS_POTFIRE WHERE STANDID = '{0}'"; //TODO: Missing not_calc_yn, & what happens if the row count dn match - the row Cond ID must be less? string[] strSqlCondFilter = new string[12] { "pre_Tot_Flame_Mod", "pre_Tot_Flame_Sev", "pre_Fire_Type_Severe", "pre_Fire_Type_Mod", "pre_Torch_Index", "pre_Crown_Index", "pre_Canopy_Ht", "pre_Canopy_Density", "pre_Mortality_BA_Severe", "pre_Mortality_BA_Mod", "pre_Mortality_VOL_Severe", "pre_Mortality_VOL_Mod" }; string[] strSqlFvsPfFilter = new string[12] { "Flame_Len_Mod", "Flame_Len_Severe", "Fire_Type_Severe", "Fire_Type_Mod", "Torch_Index", "Crown_Index", "Canopy_Ht", "Canopy_Density", "Mortality_BA_Severe", "Mortality_BA_Mod", "Mortality_VOL_Severe", "Mortality_VOL_Mod" }; DataTable dtCond = new DataTable("COND"); DataTable dtFvsPF = new DataTable("FVS_PF"); try { ado_optimizer_tables adoCore = new ado_optimizer_tables(); adoCore.m_OleDbConnection = new System.Data.OleDb.OleDbConnection(string.Format(this.strDbConx, this.strPathMasterDbFile)); adoCore.m_OleDbConnection.Open(); adoCore.m_daCond = new System.Data.OleDb.OleDbDataAdapter(string.Format(strSqlCond, strCondIdMasterCondId), adoCore.m_OleDbConnection.ConnectionString); adoCore.m_daCond.Fill(dtCond); ado_optimizer_tables adoFvs = new ado_optimizer_tables(); adoFvs.m_OleDbConnection = new System.Data.OleDb.OleDbConnection(string.Format(this.strDbConx, strCurRxFilePath)); adoFvs.m_OleDbConnection.Open(); adoFvs.m_daCond = new System.Data.OleDb.OleDbDataAdapter(string.Format(strSqlFvsPotFire, strCondId_PotFireStandId), adoFvs.m_OleDbConnection.ConnectionString); OLE.OleDbCommandBuilder oleCmdB = new System.Data.OleDb.OleDbCommandBuilder(adoFvs.m_daCond); adoFvs.m_daCond.Fill(dtFvsPF); if (dtCond.Rows.Count <= dtFvsPF.Rows.Count) { for (short i = 0; i < dtCond.Rows.Count; i++) { dtCond.Rows[i].BeginEdit(); for (short x = 0; x < strSqlCondFilter.Length; x++) { dtCond.Rows[i][strSqlCondFilter[x]] = dtFvsPF.Rows[i][strSqlFvsPfFilter[x]]; intRet++; } dtCond.Rows[i].EndEdit(); } adoFvs.m_daCond.Update(dtCond); dtCond.AcceptChanges(); } } catch (Exception e) { intRet = 0; throw e; } return(intRet); }
//get the Cond, Fvs_tree and ffe tables from master, passing IN: ((frmMain)this.ParentForm.ParentForm).frmProject.uc_project1.m_strProjectDirectory; private DataRow[] DbRecsDataForFVS(string strProjDir) { DataTable dtFFE = new DataTable("FFE"); DataTable dtCond = new DataTable("COND"); ado_optimizer_tables adoCore = new ado_optimizer_tables(); adoCore.m_OleDbConnection.ConnectionString = string.Format(this.strDbConx, strProjDir); adoCore.m_OleDbConnection.Open(); adoCore.m_daFFE = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM FFE", adoCore.m_OleDbConnection.ConnectionString); adoCore.m_daCond = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM COND", adoCore.m_OleDbConnection.ConnectionString); adoCore.m_daFFE.Fill(dtFFE); adoCore.m_daCond.Fill(dtCond); this.WorkDataSet.Tables.Add(dtFFE); this.WorkDataSet.Tables.Add(dtCond); return(this.WorkDataSet.Tables["FFE"].Select("", "")); }