public static int GetRprtCase(string proj) { int caseVal = 0; CBProject p = new CBProject(); p.Load(proj); if (proj.Substring(0, 2) == "8.") { caseVal = 1; } else if (proj.Substring(0, 3) == "P.8") { caseVal = 1; } else { caseVal = 0; } if (p.UseAllGroups() == true) { caseVal = 0; } return(caseVal); }
private void LoadCurrentGroups() { RevSol.RSConnection cnn; SqlDataReader dr; SqlCommand cmd; SqlParameter prm; DataRow d; int grpNum; CBProject proj = new CBProject(); proj.Load(msCurrProj); if (CheckForPipeline(msCurrProj) == true) { grpNum = 1; } else { grpNum = 0; } if (proj.UseAllGroups() == true) { grpNum = 0; } CreateNewForecastDS(); cnn = new RevSol.RSConnection("CR"); cmd = new SqlCommand("spAcctGroup_ListAll2", cnn.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; prm = cmd.Parameters.Add("@SpecialGroup", SqlDbType.Int); prm.Value = grpNum; dr = cmd.ExecuteReader(); while (dr.Read()) { d = mdsForecast.Tables["Forecast"].NewRow(); d["AcctGroup"] = dr["AcctNumber"]; d["FTCHrs"] = 0; d["FTCRate"] = 0; mdsForecast.Tables["ForeCast"].Rows.Add(d); } dr.Close(); cnn.CloseConnection(); LoadExpenseGroups(); }
private void bttUpdate_Click(object sender, EventArgs e) { RevSol.RSConnection cnn; SqlCommand cmd; SqlParameter prm; int forecastID; int specGrp = 0; CBProject proj = new CBProject(); proj.Load(msCurrProj); cnn = new RevSol.RSConnection("CR"); cmd = new SqlCommand("spForecastUpdate_Insert", cnn.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; prm = cmd.Parameters.Add("@ForecastID", SqlDbType.Int); prm.Direction = ParameterDirection.Output; prm = cmd.Parameters.Add("@Project", SqlDbType.VarChar, 50); prm.Value = msCurrProj; cmd.ExecuteNonQuery(); forecastID = Convert.ToInt32(cmd.Parameters["@ForecastID"].Value); specGrp = 0; if (proj.UseAllGroups() == true) { specGrp = 0; } string acct; decimal hrs, amnt; foreach (DataRow dr in mdsForecast.Tables["Forecast"].Rows) { acct = dr["AcctGroup"].ToString(); hrs = Convert.ToDecimal(dr["FTCHrs"]); amnt = Convert.ToDecimal(dr["FTCRate"]); cmd = new SqlCommand("spForecastToComplete_Insert2_Vision", cnn.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; prm = cmd.Parameters.Add("@ForecastID", SqlDbType.Int); prm.Value = forecastID; prm = cmd.Parameters.Add("@AccountGroup", SqlDbType.VarChar, 50); prm.Value = acct.Replace("E", ""); prm = cmd.Parameters.Add("@ForecastHrs", SqlDbType.Money); prm.Value = hrs; prm = cmd.Parameters.Add("@ForecastRate", SqlDbType.Money); prm.Value = amnt; prm = cmd.Parameters.Add("@SpecialGroup", SqlDbType.Int); prm.Value = specGrp; cmd.ExecuteNonQuery(); } cnn.CloseConnection(); LoadCurrentGroups(); bttUpdate.Enabled = false; bttSetForecast.Enabled = false; LoadReportForProject(FCRMain.GetRprtCase(msCurrProj)); }