public ActionResult DeleteConfirmed(int id) { Q5 q5 = db.Q5s.Find(id); db.Q5s.Remove(q5); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Name")] Q5 q5) { if (ModelState.IsValid) { db.Entry(q5).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(q5)); }
public ActionResult Create([Bind(Include = "ID,Name")] Q5 q5) { if (ModelState.IsValid) { db.Q5s.Add(q5); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(q5)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Q5 q5 = db.Q5s.Find(id); if (q5 == null) { return(HttpNotFound()); } return(View(q5)); }
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 void btnSubmit_Click(object sender, EventArgs e) { string visit = "V2"; string user = Convert.ToString(Session["User"]) + "@web"; string appdt = txtnxtdt.Text + " " + txtnxttm.Text; string q9 = Q9.SelectedItem != null ? Q9.SelectedItem.Value : string.Empty; string q11 = Q11.SelectedItem != null ? Q11.SelectedItem.Value : string.Empty; string q14 = Q14.SelectedItem != null ? Q14.SelectedItem.Value : string.Empty; string q15 = Q15.SelectedItem != null ? Q15.SelectedItem.Value : string.Empty; DateTime DOV = DateTime.ParseExact(txtq2dt.Text, "dd-MM-yyyy", CultureInfo.InvariantCulture); DateTime today = DateTime.ParseExact(RangeValidator2.MaximumValue, "dd-MM-yyyy", CultureInfo.InvariantCulture); if (txtq2dt.Text == "" || (DOV > today)) { showalert("Enter correct Date of Visit!"); txtq2dt.Focus(); } else if (Q4.SelectedItem == null) { showalert("Select Any option"); Q4.Focus(); } else if (Q5.SelectedItem == null) { showalert("Select Any option"); Q5.Focus(); } else if (Q5.SelectedIndex == 1 && Q6.SelectedIndex == 0) { showalert("Cannot Select Yes if the child has never been hospitalized"); Q6.Focus(); } else if (Q6.SelectedItem == null) { showalert("Select Any option"); Q6.Focus(); } else if (Q7.SelectedItem == null) { showalert("Select Any option"); Q7.Focus(); } else if (Q8.SelectedItem == null) { showalert("Select Any option"); Q8.Focus(); } else if ((Q8.SelectedIndex == 0 || Q8.SelectedIndex == 1) && Q9.SelectedItem == null) { showalert("Select Any option"); Q9.Focus(); } else if (Q9.SelectedIndex == 2 && txtq9x.Text == "") { showalert("Please Specify other"); txtq9x.Focus(); } else if (Q10.SelectedItem == null) { showalert("Select Any option"); Q10.Focus(); } else if (Q10.SelectedIndex == 0 && Q11.SelectedItem == null) { showalert("Select Any option"); Q11.Focus(); } else if (Q10.SelectedIndex == 0 && txtq12dt.Text == "") { showalert("Enter Date of Blood Collection!"); txtq12dt.Focus(); } else if (Q10.SelectedIndex == 0 && txtq13t.Text == "") { showalert("Enter Time of collection!"); txtq13t.Focus(); } else if (Q10.SelectedIndex == 0 && Q14.SelectedItem == null) { showalert("Select Any option"); Q14.Focus(); } else if (Q10.SelectedIndex == 0 && Q15.SelectedItem == null) { showalert("Select Any option"); Q15.Focus(); } else if (Q10.SelectedIndex == 0 && (txtq16.Text == "" || txtq16.Text.Length < 9)) { showalert("Enter correct sample number!"); txtq16.Focus(); } else if (txtnxtdt.Text == "") { showalert("Enter Next Appointement date"); txtnxtdt.Focus(); } else if (txtnxttm.Text == "") { showalert("Enter Appointement Time"); txtnxttm.Focus(); } else { try { MySqlConnection con = new MySqlConnection(constr2); con.Open(); MySqlCommand cmd = new MySqlCommand("insert into formsv2(studyid,dssid, childname, formtype, csv01, csv02, hb01, hb02, hb03,hb04, hb05, hb06, hb0688x, bl01, bl02, bl03, bl04, bl05, bl06, bl07, nextapp, user, formdate)" + "values ('" + txtStudyID.Text.ToUpper() + "','" + txtDSSID.Text.ToUpper() + "','" + childname + "','" + visit + "','" + txtq1dt.Text + "','" + txtq2dt.Text + "','" + Q4.SelectedItem.Value + "', " + "'" + Q5.SelectedItem.Value + "','" + Q6.SelectedItem.Value + "','" + Q7.SelectedItem.Value + "','" + Q8.SelectedItem.Value + "','" + q9 + "','" + txtq9x.Text + "','" + Q10.SelectedItem.Value + "', " + "'" + q11 + "','" + txtq12dt.Text + "','" + txtq13t.Text + "','" + q14 + "','" + q15 + "','" + txtq16.Text + "', '" + appdt + "','" + user + "','" + DateTime.Now.ToString("dd-MM-yyyy hh:mm tt") + "' )", con); // "'" + Q11.SelectedItem.Value + "','" + txtq12dt.Text + "','" + txtq13t.Text + "','" + Q14.SelectedItem.Value + "','" + Q15.SelectedItem.Value + "','" + txtq16.Text.ToUpper() + "'", con); //MySqlCommand cmd = new MySqlCommand("insert into formsv2(studyid,dssid, formtype, csv01, csv02, hb01, hb02, hb03,hb04, hb05, hb06, hb0688x, bl01, bl02, bl03, bl04, bl05, bl06, bl07, nextapp, user, formdate)" + // "values ('" + txtStudyID.Text.ToUpper() + "','" + txtDSSID.Text.ToUpper() + "','" + visit + "','" + txtq1dt.Text + "','" + txtq2dt.Text + "','" + Q4.SelectedItem.Value + "', " + // "'" + Q5.SelectedItem.Value + "','" + Q6.SelectedItem.Value + "','" + Q7.SelectedItem.Value + "','" + Q8.SelectedItem.Value + "','" + q9 + "','" + txtq9x.Text.ToUpper() + "','" + Q10.SelectedItem.Value + "', " + // "'" + q11 + "','" + txtq12dt.Text + "','" + txtq13t.Text + "','" + q14 + "','" + q15 + "','" + txtq16.Text + "', '" + appdt + "','" + user + "','" + DateTime.Now.ToString("dd/MM/yyyy hh:mm tt") + "')", con); cmd.ExecuteNonQuery(); ScriptManager.RegisterStartupScript(this, this.GetType(), "alerts", "javascript:alert('Submitted Successfully!');window.location.href='visit2.aspx';", true); con.Close(); } catch (Exception ex) { showalert(ex.Message); } } }
public void Test() { string result = new Q5().LongestPalindrome("babad"); Assert.AreEqual("bab", result); }