protected bool SaveData(out int rowID) { StringBuilder columnList = new StringBuilder(); SQLParamList sqlParams = new SQLParamList(); radQ1_Slots.PrepareQuestionForDB(columnList, sqlParams); radQ1_Tables.PrepareQuestionForDB(columnList, sqlParams); radQ1_Poker.PrepareQuestionForDB(columnList, sqlParams); radQ1_Food.PrepareQuestionForDB(columnList, sqlParams); radQ1_Entertainment.PrepareQuestionForDB(columnList, sqlParams); radQ1_Hotel.PrepareQuestionForDB(columnList, sqlParams); radQ1_LiveRacing.PrepareQuestionForDB(columnList, sqlParams); radQ1_Racebook.PrepareQuestionForDB(columnList, sqlParams); radQ1_Bingo.PrepareQuestionForDB(columnList, sqlParams); radQ1_Lottery.PrepareQuestionForDB(columnList, sqlParams); radQ1_None.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Slots.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Tables.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Poker.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Food.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Entertainment.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Hotel.PrepareQuestionForDB(columnList, sqlParams); chkQ2_LiveRacing.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Racebook.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Bingo.PrepareQuestionForDB(columnList, sqlParams); chkQ2_Lottery.PrepareQuestionForDB(columnList, sqlParams); Q7A.PrepareQuestionForDB(columnList, sqlParams); Q7B.PrepareQuestionForDB(columnList, sqlParams); Q7C.PrepareQuestionForDB(columnList, sqlParams); Q7D.PrepareQuestionForDB(columnList, sqlParams); Q7E.PrepareQuestionForDB(columnList, sqlParams); Q7F.PrepareQuestionForDB(columnList, sqlParams); Q8.PrepareQuestionForDB(columnList, sqlParams); Q36Male.PrepareQuestionForDB(columnList, sqlParams); Q36Female.PrepareQuestionForDB(columnList, sqlParams); Q37_1.PrepareQuestionForDB(columnList, sqlParams); Q37_2.PrepareQuestionForDB(columnList, sqlParams); Q37_3.PrepareQuestionForDB(columnList, sqlParams); Q37_4.PrepareQuestionForDB(columnList, sqlParams); Q37_5.PrepareQuestionForDB(columnList, sqlParams); Q37_6.PrepareQuestionForDB(columnList, sqlParams); if (SurveyType == GSEISurveyType.GA) { radLocation_Lakewood.PrepareQuestionForDB(columnList, sqlParams); radLocation_Tukwila.PrepareQuestionForDB(columnList, sqlParams); radLocation_Everett.PrepareQuestionForDB(columnList, sqlParams); radLocation_DeMoines.PrepareQuestionForDB(columnList, sqlParams); } columnList.Append(",[SurveyType],[PropertyID],[DateEntered],[PIN],[BenchmarkYear]"); sqlParams.Add("@SurveyType", (int)GEISurveyType.Email) .Add("@PropertyID", (int)Master.PropertyShortCode) .Add("@DateEntered", DateTime.Now) .Add("@PIN", Master.EmailPIN) .Add("@BenchmarkYear", 2017); if (Master.EmailPINRow != null) { columnList.Append(",[EmailBatch]"); sqlParams.Add("@EmailBatch", Master.EmailPINRow["BatchID"]); } columnList.Remove(0, 1); SQLDatabase sql = new SQLDatabase(); sql.CommandTimeout = 120; rowID = sql.QueryAndReturnIdentity(String.Format("INSERT INTO [tblSurveyGEI] ({0}) VALUES ({1});", columnList, columnList.ToString().Replace("[", "@").Replace("]", String.Empty)), sqlParams); if (!sql.HasError && rowID != -1) { sql.NonQuery("UPDATE [tblSurveyGEI_EmailPINs] SET [SurveyCompleted] = 1 WHERE PIN = @PIN", new SqlParameter("@PIN", Master.EmailPIN)); if (sql.HasError) { //TODO: Do we want to do something here? } return(true); } else { return(false); } }
protected bool SaveData() { StringBuilder columnList = new StringBuilder(); SQLParamList sqlParams = new SQLParamList(); if (QueryPropertyShortCode == GCCPropertyShortCode.GCC || (QueryPropertyShortCode == GCCPropertyShortCode.GAG && QueryGAGLocation == GLocation.None)) { //User had to select location string propSel = fbkProperty.SelectedValue; if (propSel.Length > 3) { //GAG if (propSel.Substring(0, 2).Equals("13")) { columnList.AppendFormat(",[{0}]", fbkProperty.DBColumn); sqlParams.Add("@" + fbkProperty.DBColumn, 13); } } else { fbkProperty.PrepareQuestionForDB(columnList, sqlParams); } } ddlDepartment.PrepareQuestionForDB(columnList, sqlParams); Q1.PrepareQuestionForDB(columnList, sqlParams); Q2.PrepareQuestionForDB(columnList, sqlParams); Q3.PrepareQuestionForDB(columnList, sqlParams); Q4.PrepareQuestionForDB(columnList, sqlParams); Q5.PrepareQuestionForDB(columnList, sqlParams); Q6.PrepareQuestionForDB(columnList, sqlParams); Q7.PrepareQuestionForDB(columnList, sqlParams); Q8.PrepareQuestionForDB(columnList, sqlParams); Q9.PrepareQuestionForDB(columnList, sqlParams); Q10.PrepareQuestionForDB(columnList, sqlParams); Q11.PrepareQuestionForDB(columnList, sqlParams); Q12.PrepareQuestionForDB(columnList, sqlParams); Q13.PrepareQuestionForDB(columnList, sqlParams); Q14.PrepareQuestionForDB(columnList, sqlParams); Q15.PrepareQuestionForDB(columnList, sqlParams); Q16.PrepareQuestionForDB(columnList, sqlParams); Q17.PrepareQuestionForDB(columnList, sqlParams); Q18.PrepareQuestionForDB(columnList, sqlParams); Q19.PrepareQuestionForDB(columnList, sqlParams); Q20.PrepareQuestionForDB(columnList, sqlParams); Q21.PrepareQuestionForDB(columnList, sqlParams); Q22.PrepareQuestionForDB(columnList, sqlParams); Q23.PrepareQuestionForDB(columnList, sqlParams); Q24.PrepareQuestionForDB(columnList, sqlParams); Q25.PrepareQuestionForDB(columnList, sqlParams); Q26.PrepareQuestionForDB(columnList, sqlParams); Q27.PrepareQuestionForDB(columnList, sqlParams); Q28.PrepareQuestionForDB(columnList, sqlParams); Q29A.PrepareQuestionForDB(columnList, sqlParams); Q29B.PrepareQuestionForDB(columnList, sqlParams); Q29C.PrepareQuestionForDB(columnList, sqlParams); Q30.PrepareQuestionForDB(columnList, sqlParams); radQ31_Hourly.PrepareQuestionForDB(columnList, sqlParams); radQ31_Salary.PrepareQuestionForDB(columnList, sqlParams); radQ32_1.PrepareQuestionForDB(columnList, sqlParams); radQ32_2.PrepareQuestionForDB(columnList, sqlParams); radQ32_3.PrepareQuestionForDB(columnList, sqlParams); radQ32_4.PrepareQuestionForDB(columnList, sqlParams); radQ32_5.PrepareQuestionForDB(columnList, sqlParams); Q33.PrepareQuestionForDB(columnList, sqlParams); chkQ34_1.PrepareQuestionForDB(columnList, sqlParams); chkQ34_2.PrepareQuestionForDB(columnList, sqlParams); chkQ34_3.PrepareQuestionForDB(columnList, sqlParams); chkQ34_4.PrepareQuestionForDB(columnList, sqlParams); chkQ34_5.PrepareQuestionForDB(columnList, sqlParams); chkQ34_6.PrepareQuestionForDB(columnList, sqlParams); chkQ34_7.PrepareQuestionForDB(columnList, sqlParams); chkQ34_8.PrepareQuestionForDB(columnList, sqlParams); chkQ34_9.PrepareQuestionForDB(columnList, sqlParams); chkQ34_10.PrepareQuestionForDB(columnList, sqlParams); chkQ34_11.PrepareQuestionForDB(columnList, sqlParams); chkQ34_12.PrepareQuestionForDB(columnList, sqlParams); if (radFFContinue.Checked) { CSR_Q1.PrepareQuestionForDB(columnList, sqlParams); CSR_Q2.PrepareQuestionForDB(columnList, sqlParams); CSR_Q3.PrepareQuestionForDB(columnList, sqlParams); CSR_Q4.PrepareQuestionForDB(columnList, sqlParams); CSR_Q5_1.PrepareQuestionForDB(columnList, sqlParams); CSR_Q5_2.PrepareQuestionForDB(columnList, sqlParams); CSR_Q5_3.PrepareQuestionForDB(columnList, sqlParams); CSR_Q5_4.PrepareQuestionForDB(columnList, sqlParams); CSR_Q6.PrepareQuestionForDB(columnList, sqlParams); CSR_Q7.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_1.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_2.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_3.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_4.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_5.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_6.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_7.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_8.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_9.PrepareQuestionForDB(columnList, sqlParams); CSR_Q8_OtherExplanation.PrepareQuestionForDB(columnList, sqlParams); CSR_Q9A.PrepareQuestionForDB(columnList, sqlParams); CSR_Q9B.PrepareQuestionForDB(columnList, sqlParams); CSR_Q9C.PrepareQuestionForDB(columnList, sqlParams); CSR_Q9D.PrepareQuestionForDB(columnList, sqlParams); CSR_Q9E.PrepareQuestionForDB(columnList, sqlParams); CSR_Q9F.PrepareQuestionForDB(columnList, sqlParams); CSR_Q9G.PrepareQuestionForDB(columnList, sqlParams); CSR_Q9H.PrepareQuestionForDB(columnList, sqlParams); CSR_Q10A.PrepareQuestionForDB(columnList, sqlParams); CSR_Q10B.PrepareQuestionForDB(columnList, sqlParams); CSR_Q10C.PrepareQuestionForDB(columnList, sqlParams); CSR_Q10D.PrepareQuestionForDB(columnList, sqlParams); CSR_Q10E.PrepareQuestionForDB(columnList, sqlParams); radCSR_Q11_1.PrepareQuestionForDB(columnList, sqlParams); radCSR_Q11_2.PrepareQuestionForDB(columnList, sqlParams); radCSR_Q11_3.PrepareQuestionForDB(columnList, sqlParams); radCSR_Q11_4.PrepareQuestionForDB(columnList, sqlParams); CSR_Q12.PrepareQuestionForDB(columnList, sqlParams); CSR_Q13.PrepareQuestionForDB(columnList, sqlParams); } columnList.Append(",[PropertyID],[DateEntered],[SurveyType]"); sqlParams.Add("@PropertyID", Master.PropertyID) .Add("@DateEntered", DateTime.Now) .Add("@SurveyType", IsKioskSurvey ? "K" : "D"); if (GAGLocation != GLocation.None) { columnList.Append(",[GAGLocation]"); sqlParams.Add("@GAGLocation", GAGLocation.ToString()); } columnList.Remove(0, 1); SQLDatabase sql = new SQLDatabase(); sql.CommandTimeout = 120; int rowID = sql.QueryAndReturnIdentity(String.Format("INSERT INTO [tblSurveySnapshot2017] ({0}) VALUES ({1});", columnList, columnList.ToString().Replace("[", "@").Replace("]", String.Empty)), sqlParams); if (!sql.HasError && rowID != -1) { Dictionary <string, int> wordCounts = SurveyTools.GetWordCount(Q33.Text, CSR_Q8_OtherExplanation.Text, CSR_Q13.Text); SurveyTools.SaveWordCounts(SharedClasses.SurveyType.Employee, rowID, wordCounts); return(true); } else { return(false); } }
protected bool SaveData(out int rowID) { StringBuilder columnList = new StringBuilder(); SQLParamList sqlParams = new SQLParamList(); Q1.PrepareQuestionForDB(columnList, sqlParams); if (Session["CurrentUI"].ToString() == "fr-CA") { Q2_F.PrepareQuestionForDB(columnList, sqlParams); } else { Q2.PrepareQuestionForDB(columnList, sqlParams); } Q3.PrepareQuestionForDB(columnList, sqlParams); Q4.PrepareQuestionForDB(columnList, sqlParams); Q5Name.PrepareQuestionForDB(columnList, sqlParams); Q5Title.PrepareQuestionForDB(columnList, sqlParams); Q5Telephone.PrepareQuestionForDB(columnList, sqlParams); Q5Email.PrepareQuestionForDB(columnList, sqlParams); Q6Street.PrepareQuestionForDB(columnList, sqlParams); Q6City.PrepareQuestionForDB(columnList, sqlParams); Q6Province.PrepareQuestionForDB(columnList, sqlParams); Q6PostalCode.PrepareQuestionForDB(columnList, sqlParams); Q7.PrepareQuestionForDB(columnList, sqlParams); Q8.PrepareQuestionForDB(columnList, sqlParams); Q9A.PrepareQuestionForDB(columnList, sqlParams); Q9B.PrepareQuestionForDB(columnList, sqlParams); Q9C.PrepareQuestionForDB(columnList, sqlParams); Q9C_Explanation.PrepareQuestionForDB(columnList, sqlParams); Q10.PrepareQuestionForDB(columnList, sqlParams); Q11A_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11A_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11B_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11B_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11C_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11C_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); //Q11D_PastSupport.PrepareQuestionForDB( columnList, sqlParams ); //Q11D_CurrentRequest.PrepareQuestionForDB( columnList, sqlParams ); Q11E_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11E_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11F_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11F_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11G_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11G_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11H_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11H_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11I_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11I_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11J_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11J_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11K_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11K_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11L_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11L_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11M_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11M_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); //2017-11-14 Adding 3 new ontario locations Q11N_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11N_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11O_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11O_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11P_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11P_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11Q_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11Q_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11R_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11R_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11S_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11S_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11T_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11T_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11U_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11U_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11V_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11V_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11W_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11W_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11X_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11X_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11Y_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11Y_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q11Z_PastSupport.PrepareQuestionForDB(columnList, sqlParams); Q11Z_CurrentRequest.PrepareQuestionForDB(columnList, sqlParams); Q12.PrepareQuestionForDB(columnList, sqlParams); Q13.PrepareQuestionForDB(columnList, sqlParams); Q14.PrepareQuestionForDB(columnList, sqlParams); columnList.Append(",[PropertyID],[DateEntered]"); sqlParams.Add("@PropertyID", Master.PropertyID) .Add("@DateEntered", DateTime.Now); columnList.Remove(0, 1); SQLDatabase sql = new SQLDatabase(); sql.CommandTimeout = 120; rowID = sql.QueryAndReturnIdentity(String.Format("INSERT INTO [tblSurveyDonation] ({0}) VALUES ({1});", columnList, columnList.ToString().Replace("[", "@").Replace("]", String.Empty)), sqlParams); return(!sql.HasError && rowID != -1); }