protected void Button1_Click(object sender, EventArgs e) { try { Session["stype"] = ddlStudytypes.SelectedItem.Text; if (RadioButton1.Checked) { Response.Redirect("SAAddClients.aspx"); } else if (RadioButton2.Checked) { Response.Redirect("SA" + ddlStudytypes.SelectedItem.Text + ".aspx"); } else if (RadioButton3.Checked) { int scode = int.Parse(Session["scode"] + ""); Study study = se1.Studies.Find(scode); se1.Studies.Remove(study); lblmsg.Text = "study deleted"; se1.SaveChanges(); Response.Redirect("SADashboard.aspx"); } } catch (Exception exp) { lblmsg.Text = "sorry for inconvenience :" + exp.ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { Random r = new Random(); String msg = ""; for (int i = 1; i <= int.Parse(tbNumstudents.Text); i++) { SCUser u = new SCUser(); u.SCode = int.Parse(studyvalue); String rnduid = ""; String rndpwd = ""; for (int j = 1; j <= 5; j++) { rnduid += (char)(65 + r.Next(26)); rndpwd += (char)(65 + r.Next(26)); } u.SCEmailid = rnduid; u.SCPassword = rndpwd; msg += rnduid + " , " + rndpwd; msg += "\r\n"; se1.SCUsers.Add(u); } se1.SaveChanges(); TextBox1.Text = msg; }
protected void Button1_Click(object sender, EventArgs e) { try { SCAnswer scans = new SCAnswer(); scans.SCEmailid = Session["username"] + ""; scans.Scode = Convert.ToInt32(Session["scode"]); scans.studytype = "CTHQ"; scans.SurveyDate = DateTime.Now; se1.SCAnswers.Add(scans); se1.SaveChanges(); SCAnswerDetail scad = new SCAnswerDetail(); scad.sno = scans.sno; //scad.a1 = rb1yes.Checked ? rb1yes.Text : rb1no.Text; //scad.a2 = rb2yes.Checked ? rb2yes.Text : rb2no.Text; //scad.a3 = TextBox32.Text; //scad.a4 = rb4.SelectedItem.Text; //scad.a5 = rb5.SelectedItem.Text; //scad.a6 = rb6y.Checked ? rb6y.Text : rb6n.Text; //scad.a7 = TextBox73.Text; scad.a1 = rb1yes.Checked ? "1" : "0"; scad.a2 = rb2yes.Checked ? "1" : "0"; scad.a3 = rb3yes.Checked ? "1" : "0"; scad.a4 = rb4yes.Checked ? "1" : "0"; scad.a5 = RadioButtonList5.SelectedItem.Value; scad.a6 = CheckBoxList6.SelectedItem.Value; scad.a7 = rb7.SelectedItem.Text; se1.SCAnswerDetails.Add(scad); se1.SaveChanges(); Response.Redirect("SCDashboard.aspx"); } catch (Exception exp) { lblmsg.Text = "sorry for inconvenience :" + exp.ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { SCAnswer scans = new SCAnswer(); scans.SCEmailid = Session["username"] + ""; scans.Scode = Convert.ToInt32(Session["scode"]); scans.studytype = "CTUQ"; scans.SurveyDate = DateTime.Now; se1.SCAnswers.Add(scans); se1.SaveChanges(); SCAnswerDetail scad = new SCAnswerDetail(); scad.sno = scans.sno; //scad.a1 = rb1yes.Checked ? rb1yes.Text : rb1no.Text; //scad.a2 = rb2yes.Checked ? rb2yes.Text : rb2no.Text; //scad.a3 = TextBox32.Text; //scad.a4 = rb4.SelectedItem.Text; //scad.a5 = rb5.SelectedItem.Text; //scad.a6 = rb6y.Checked ? rb6y.Text : rb6n.Text; //scad.a7 = TextBox73.Text; scad.a1 = rb1yes.Checked ? "1" : "0"; scad.a2 = rb2yes.Checked ? "1" : "0"; scad.a3 = rb3yes.Checked ? "1" : "0"; scad.a4 = rb4.SelectedItem.Value; scad.a5 = rb5.SelectedItem.Value; scad.a6 = rb6y.Checked ? "1" : "0"; scad.a7 = rb7y.Checked ? "1" : "0"; scad.a8 = rb8y.Checked ? "1" : "0"; scad.a9 = TextBox93.Text; se1.SCAnswerDetails.Add(scad); se1.SaveChanges(); Response.Redirect("SCDashboard.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { //SurveyWeb.App_Code.Study s = new SurveyWeb.App_Code.Study(); Study s = new Study(); s.StudyName = tbStudyname.Text; s.NumStudents = int.Parse(tbNumstudents.Text); s.SchoolName = tbClientschoolname.Text; s.saemailid = Session["username"] + ""; se1.Studies.Add(s); se1.SaveChanges(); Session["studypurpose"] = "view"; lblmsg.Text = "study saved "; //Response.Redirect("SAViewStudy.aspx"); //Response.Redirect("SAEditStudy.aspx"); hdnstudy.Value = s.SCode + ""; }
protected void Button1_Click(object sender, EventArgs e) { try { StudyQuestion sq = null; if (ViewState["mode"] + "" == "save") { sq = new StudyQuestion(); } else { sq = se1.StudyQuestions.Find(Convert.ToInt32(Session["scode"])); } sq.q1 = TextBox1.Text; sq.q2 = TextBox2.Text; sq.q3 = TextBox31.Text; sq.q4 = TextBox4.Text; sq.q5 = TextBox5.Text; sq.q6 = TextBox61.Text; //sq.q7 = ""; sq.q8 = TextBox81.Text + "$" + TextBox82.Text; sq.q9 = TextBox91.Text + "$" + TextBox92.Text; sq.Scode = Convert.ToInt32(Session["scode"]); sq.StudyType = Session["stype"] + ""; if (ViewState["mode"] + "" == "save") { se1.StudyQuestions.Add(sq); } else { } se1.SaveChanges(); Response.Redirect("SADashboard.aspx?msg=success"); } catch (Exception exp) { Response.Write("error:" + exp.ToString()); } }
protected void Button1_Click(object sender, EventArgs e) { try { if (TextBox2.Text != TextBox3.Text) { lblmsg.Text = "pwds dont match"; return; } SAUser u = new SAUser(); u.SAEmailid = TextBox1.Text; u.SAPassword = TextBox2.Text; se1.SAUsers.Add(u); se1.SaveChanges(); Response.Redirect("sadashboard.aspx"); } catch (Exception exp) { lblmsg.Text = "sorry for inconvenience :" + exp.ToString(); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { // Convert the row index stored in the CommandArgument // property to an Integer. int index = e.RowIndex; // Retrieve the row that contains the button clicked // by the user from the Rows collection. GridViewRow row = GridView1.Rows[index]; se1.SAUsers.Remove(se1.SAUsers.Find(row.Cells[1].Text)); se1.SaveChanges(); Response.Redirect("SSDashboard.aspx"); Response.Write(row.Cells[1].Text); } catch (Exception exp) { Response.Write(exp.ToString()); } }