Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        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();
        }