Exemplo n.º 1
0
        /// <summary>
        /// Method called by the SPFGrid to add/update/delete an SPF
        /// </summary>
        /// <param name="editedSPF">The SPF to be added/updated/deleted</param>
        public void EditSPF(SPF editedSPF, Pupil pupil, string extraparam)
        {
            string oper = Request.Params.Get("oper");
            string pupilID = Session["pupilID"].ToString();
            if (IsAuthorized())
            {
                //var spfModel = GenerateGrids().SpfGrid;

                if (oper == "edit")
                {
                    SPF spfToUpdate = VaKEGradeRepository.Instance.GetSPF(editedSPF.ID);

                    spfToUpdate.SubjectID = editedSPF.SubjectID;

                    spfToUpdate.Level = editedSPF.Level;

                    VaKEGradeRepository.Instance.Update();
                }
                if (oper == "add")
                {
                     VaKEGradeRepository.Instance.AssignSPF(Convert.ToInt32(pupilID), Convert.ToInt32(editedSPF.SubjectID), editedSPF.Level);
                }
                if (oper == "del")
                {
                    VaKEGradeRepository.Instance.DeleteSPF(editedSPF.ID);
                }
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the SPFs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSPFs(SPF sPF)
 {
     base.AddObject("SPFs", sPF);
 }
 /// <summary>
 /// Create a new SPF object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="pupilID">Initial value of the PupilID property.</param>
 /// <param name="subjectID">Initial value of the SubjectID property.</param>
 /// <param name="level">Initial value of the Level property.</param>
 public static SPF CreateSPF(global::System.Int32 id, global::System.Int32 pupilID, global::System.Int32 subjectID, global::System.Int32 level)
 {
     SPF sPF = new SPF();
     sPF.ID = id;
     sPF.PupilID = pupilID;
     sPF.SubjectID = subjectID;
     sPF.Level = level;
     return sPF;
 }