protected void Page_Load(object sender, EventArgs e) { dataaccess da = new dataaccess(); datasethas dshClass = new datasethas(); int pid, cid; bool cancel = new tools().SessionCheck(Session); if (cancel) { Response.Redirect("Default.aspx"); } pid = int.Parse(Session[constants.SESSION_PID].ToString()); cid = int.Parse(Session[constants.SESSION_MODE_EDIT_CID].ToString()); dshClass = da.GetClassByPidAndCid(pid, cid); this.labelClassId.Text = cid.ToString(); this.labelClassnumber.Text = dshClass._class[0].classnumber; this.SqlDataSourceRepeaterAlerts.SelectParameters.Clear(); //remove all without selection this.SqlDataSourceRepeaterAlerts.SelectParameters.Add("pid", Session[constants.SESSION_PID].ToString()); this.SqlDataSourceRepeaterAlerts.SelectParameters.Add("cid", Session[constants.SESSION_MODE_EDIT_CID].ToString()); this.RepeaterAlerts.DataBind(); }
private void SendAlert() { dataaccess da = new dataaccess(); datasethas hasData = da.GetAlert(int.Parse(this._aid)); this.SendMail(da.GetStudentMail(int.Parse(this._sid)), hasData.alert[0].subject, hasData.alert[0].message); }
protected void Page_Load(object sender, EventArgs e) { dataaccess da = new dataaccess(); bool cancel = new tools().SessionCheck(Session); if (cancel) { Response.Redirect("Default.aspx"); } this.SqlDataSourceRepeaterClasses.SelectParameters.Add("id", Session[constants.SESSION_PID].ToString()); _dataSetClasses = da.GetAllClasses(int.Parse(Session[constants.SESSION_PID].ToString())); switch (Session[constants.SESSION_MODE].ToString()) { case constants.SESSION_MODE_EDIT_CLASS: this.FormViewClass.ChangeMode(FormViewMode.Edit); _currentClassId = Session[constants.SESSION_MODE_EDIT_CID].ToString(); this.SqlDataSourceClass.UpdateParameters.Add("cid", _currentClassId); break; case constants.SESSION_MODE_VIEW: this.FormViewClass.ChangeMode(FormViewMode.ReadOnly); _currentClassId = Session[constants.SESSION_MODE_VIEW_ID].ToString(); break; default: case constants.SESSION_MODE_ADD: this.FormViewClass.ChangeMode(FormViewMode.Insert); break; } this.SqlDataSourceClass.SelectParameters.Add("cid", _currentClassId); }
protected void formViewStudents_ItemInserted(object sender, FormViewInsertedEventArgs e) { dataaccess da = new dataaccess(); int newSid = da.GetMaxStudentId(); int cid = int.Parse(Session[constants.SESSION_MODE_EDIT_CID].ToString()); da.InsertClassHasStudents(cid, newSid); Response.Redirect("students.aspx"); }
protected void formViewClass_ItemInserted(object sender, FormViewInsertedEventArgs e) { dataaccess da = new dataaccess(); int newCid = da.GetMaxClassId(); int pid = int.Parse(Session[constants.SESSION_PID].ToString()); da.InsertProfessorHasClasses(pid, newCid); Response.Redirect("home.aspx"); }
protected void Page_Load(object sender, EventArgs e) { bool cancel = new tools().SessionCheck(Session); if (cancel) { Response.Redirect("Default.aspx"); } int aid = int.Parse(Session[constants.SESSION_MODE_SEND_AID].ToString()); dataaccess da = new dataaccess(); _hasData = da.GetAlertClassAndStudentsByAlertId(aid); labelClassId.Text = _hasData._class[0].id.ToString(); labelClassnumber.Text = _hasData._class[0].classnumber.ToString(); this.RepeaterStudents.DataSource = _hasData.student; this.RepeaterStudents.DataBind(); this.imageButtonSend.ToolTip = "Start Sending Alerts"; if (Session[constants.SESSION_MODE].ToString() == constants.SESSION_MODE_SENDING) { tools t = new tools(); alertprogress ap = (alertprogress)Session[constants.SESSION_MODE_SENDING_PROGRESS]; this.imageButtonSend.ImageUrl = "~/img/sending.gif"; this.imageButtonSend.ToolTip = "Sending Alerts~ (Please Wait)"; this.SetRepeaterStatuses(ap); //Verify script isn't already registered if (!ClientScript.IsClientScriptBlockRegistered("waitScript")) { string js = "\n<script type=\"text/javascript\" language=\"Javascript\" id=\"waitScript\">\n"; js += "wait(2000);"; js += "\n\n </script>"; ClientScript.RegisterClientScriptBlock(this.GetType(), "waitScript", js); } t.Alerting(Session, ap); } if (Session[constants.SESSION_MODE].ToString() == constants.SESSION_MODE_SENDING_FINISHED) { alertprogress ap = (alertprogress)Session[constants.SESSION_MODE_SENDING_PROGRESS]; this.imageButtonSend.ImageUrl = "~/img/ok.png"; this.imageButtonSend.ToolTip = "Finished Sending! Click to return to class~ ^^"; this.SetRepeaterStatuses(ap); da.UpdateAlertStatus(aid); } }
protected void Page_Load(object sender, EventArgs e) { dataaccess da = new dataaccess(); bool cancel = new tools().SessionCheck(Session); if (cancel) { Response.Redirect("Default.aspx"); } this.SqlDataSourceRepeaterClasses.SelectParameters.Add("id", Session[constants.SESSION_PID].ToString()); _dataSetClasses = da.GetAllClasses(int.Parse(Session[constants.SESSION_PID].ToString())); }
protected void Page_Load(object sender, EventArgs e) { dataaccess da = new dataaccess(); datasethas dshClass = new datasethas(); int pid, cid; bool cancel = new tools().SessionCheck(Session); if (cancel) { Response.Redirect("Default.aspx"); } pid = int.Parse(Session[constants.SESSION_PID].ToString()); cid = int.Parse(Session[constants.SESSION_MODE_EDIT_CID].ToString()); dshClass = da.GetClassByPidAndCid(pid, cid); this.labelClassId.Text = cid.ToString(); this.labelClassnumber.Text = dshClass._class[0].classnumber; switch (Session[constants.SESSION_MODE].ToString()) { case constants.SESSION_MODE_ADD: this.FormViewAlert.ChangeMode(FormViewMode.Insert); break; case constants.SESSION_MODE_EDIT_ALERT: //removing existing parameters because of postback this.SqlDataSourceFormViewAlert.SelectParameters.Clear(); foreach (Parameter p in this.SqlDataSourceFormViewAlert.UpdateParameters) { if (p.Name == "cid" || p.Name == "pid" || p.Name == "aid") { this.SqlDataSourceFormViewAlert.UpdateParameters.Remove(p); } } this.SqlDataSourceFormViewAlert.SelectParameters.Add("cid", Session[constants.SESSION_MODE_EDIT_CID].ToString()); this.SqlDataSourceFormViewAlert.SelectParameters.Add("pid", Session[constants.SESSION_PID].ToString()); this.SqlDataSourceFormViewAlert.SelectParameters.Add("aid", Session[constants.SESSION_MODE_EDIT_AID].ToString()); this.SqlDataSourceFormViewAlert.UpdateParameters.Add("cid", Session[constants.SESSION_MODE_EDIT_CID].ToString()); this.SqlDataSourceFormViewAlert.UpdateParameters.Add("pid", Session[constants.SESSION_PID].ToString()); this.SqlDataSourceFormViewAlert.UpdateParameters.Add("aid", Session[constants.SESSION_MODE_EDIT_AID].ToString()); this.FormViewAlert.ChangeMode(FormViewMode.Edit); break; } }
protected void ButtonLogin_Click(object sender, EventArgs e) { dataaccess da = new dataaccess(); datasetlogin dsh = new datasetlogin(); if (this.IsPostBack && this.TextBoxId.Text != "" && this.TextBoxPw.Text != "") { dsh = da.GetProfessorsByLogin(this.TextBoxId.Text, this.TextBoxPw.Text); if (dsh.professor.Rows.Count == 1) { if (dsh.professor[0].login.Trim() == this.TextBoxId.Text && dsh.professor[0].pw.Trim() == this.TextBoxPw.Text) { //set session and redirect Session.Add(constants.SESSION_MODE, constants.SESSION_MODE_DEFAULT); Session.Add(constants.SESSION_PID, dsh.professor[0].id.ToString()); Response.Redirect("home.aspx"); } } } }
protected void Page_Load(object sender, EventArgs e) { dataaccess da = new dataaccess(); datasethas dshClass = new datasethas(); int pid, cid; bool cancel = new tools().SessionCheck(Session); if (cancel) { Response.Redirect("Default.aspx"); } pid = int.Parse(Session[constants.SESSION_PID].ToString()); cid = int.Parse(Session[constants.SESSION_MODE_EDIT_CID].ToString()); dshClass = da.GetClassByPidAndCid(pid, cid); _dataSetStudents = da.GetStudentsByPidAndCid(pid, cid); this.labelClassId.Text = cid.ToString(); this.labelClassnumber.Text = dshClass._class[0].classnumber; switch (Session[constants.SESSION_MODE].ToString()) { case constants.SESSION_MODE_ADD: this.FormViewStudents.Visible = true; this.FormViewStudents.ChangeMode(FormViewMode.Insert); break; case constants.SESSION_MODE_EDIT_STUDENT: this.FormViewStudents.Visible = true; //removing existing parameters because of postback for (int i = 0; i < this.SqlDataSourceFormViewStudents.SelectParameters.Count; i++) { if (this.SqlDataSourceFormViewStudents.SelectParameters[i].Name == "sid") { this.SqlDataSourceFormViewStudents.SelectParameters.Remove(this.SqlDataSourceFormViewStudents.SelectParameters[i]); } } for (int i = 0; i < this.SqlDataSourceFormViewStudents.UpdateParameters.Count; i++) { if (this.SqlDataSourceFormViewStudents.UpdateParameters[i].Name == "sid") { this.SqlDataSourceFormViewStudents.UpdateParameters.Remove(this.SqlDataSourceFormViewStudents.SelectParameters[i]); } } this.SqlDataSourceFormViewStudents.SelectParameters.Add("sid", Session[constants.SESSION_MODE_EDIT_SID].ToString()); this.SqlDataSourceFormViewStudents.UpdateParameters.Add("sid", Session[constants.SESSION_MODE_EDIT_SID].ToString()); this.FormViewStudents.ChangeMode(FormViewMode.Edit); break; default: this.FormViewStudents.Visible = false; break; } this.SqlDataSourceRepeaterStudents.SelectParameters.Clear(); //remove all without selection this.SqlDataSourceRepeaterStudents.SelectParameters.Add("pid", Session[constants.SESSION_PID].ToString()); this.SqlDataSourceRepeaterStudents.SelectParameters.Add("cid", Session[constants.SESSION_MODE_EDIT_CID].ToString()); this.RepeaterStudents.DataBind(); }