Ejemplo n.º 1
0
 public void TranslateTraitToTraitBDO(Trait trait, TraitBDO tbdo)
 {
     tbdo.Description = trait.Description;
     tbdo.CurrTrait = trait.CurrTrait;
     tbdo.TraitsID = trait.TraitsID;
     tbdo.Category = trait.Category;
 }
Ejemplo n.º 2
0
 public List<Trait> ToTraitList(List<TraitBDO> tbList)
 {
     List<Trait> tList = new List<Trait>();
     foreach (TraitBDO tbdo in tbList)
     {
         Trait t = new Trait();
         TranslateTraitBDOToTrait(tbdo, t);
         tList.Add(t);
     }
     return tList;
 }
Ejemplo n.º 3
0
 public void TranslateTraitBDOToTrait(TraitBDO tbdo, Trait t)
 {
     t.Description = tbdo.Description;
     t.CurrTrait = tbdo.CurrTrait;
     t.TraitsID = tbdo.TraitsID;
     t.Category = tbdo.Category;
     switch (tbdo.Category)
     {
         case 1:
             t.Cat = "Pre-School";
             break;
         case 2:
             t.Cat = "Elementary";
             break;
         case 3:
             t.Cat = "Secondary";
             break;
     }
 }
Ejemplo n.º 4
0
        private void Save() {
            IRegistrationService regService = new RegistrationService();
            ITraitService traitService = new TraitService();
            Boolean ret = false;
            string message = String.Empty;
            Trait trait = new Trait()
            {
                Description = txtDescription.Text.ToString(),
                CurrTrait = chkCurrent.Checked,
                Category = Int32.Parse(cmbCategory.SelectedValue.ToString())
            };
            if (ExistingTraits.Exists(t => t.Category == trait.Category && t.Description == trait.Description && t.CurrTrait==trait.CurrTrait))
            {
                MessageBox.Show(this, "Trait for that Category already Exists", "Trait Exists");
            }
            else
            {
                if (Op.Equals("edit"))
                {
                    trait.TraitsID = SelectedTrait.TraitsID;
                    ret = traitService.UpdateTrait(ref trait, ref message);
                }
                else
                {
                    ret = traitService.CreateTrait(ref trait, ref message);
                    if (ret && trait.CurrTrait)
                    {
                        List<Trait> updatedTraits = new List<Trait>(traitService.GetAllTraits());
                        Trait savedTrait = new Trait();
                        savedTrait = updatedTraits.Find(t => t.Category == trait.Category && t.Description == trait.Description && t.CurrTrait == trait.CurrTrait);
                        ret = regService.UpdateStudentCharacters(savedTrait);
                    }
                }

                if (ret)
                    MessageBox.Show(this, "Saved Successfully");
                
            }

            this.Close();
        }
Ejemplo n.º 5
0
 public bool UpdateTrait(ref Trait trait, ref string message)
 {
     TraitBDO tbdo = new TraitBDO();
     TranslateTraitToTraitBDO(trait, tbdo);
     return tlogic.UpdateTrait(ref tbdo, ref message);
 }
Ejemplo n.º 6
0
        private void gvTraits_SelectionChanged(object sender, EventArgs e)
        {
            int selectedIndex = gvTraits.CurrentRow.Index;


            if (selectedIndex >= 0)
            {
                string bID = gvTraits.Rows[selectedIndex].Cells["TraitsID"].Value.ToString();
                List<Trait> trait = new List<Trait>();
                trait = traitList.FindAll(x => x.TraitsID.ToString() == bID);

                traitSelected = new Trait();
                traitSelected = (Trait)trait[0];
            }
        }
Ejemplo n.º 7
0
        public Boolean UpdateStudentCharacters(Trait tbdo)
        {
            SchoolYear sy = new SchoolYear();
            sy = GetCurrentSY();

            IGradeLevelService gradeLevelService = new GradeLevelService();
            List<GradeLevel> gradeLevelList = new List<GradeLevel>(gradeLevelService.GetAllGradeLevels());
            List<GradeLevel> gradeLevelCategory = new List<GradeLevel>();
            gradeLevelCategory = gradeLevelList.FindAll(x => x.Category == tbdo.Category);

            Boolean ret = false;

            List<string> studentIDs = new List<string>();
            foreach (GradeLevel gl in gradeLevelCategory)
            {
                studentIDs.AddRange(GetEnrolledStudentsforNewTraits(gl.GradeLev, sy.SY));
            }

            foreach (string studentID in studentIDs)
            {
                StudentEnrollment se = new StudentEnrollment();
                se = GetEnrolledStudent(studentID, sy.SY);
                StudentTrait st = new StudentTrait
                {
                    StudentSY = se.StudentSY,
                    TraitsID = tbdo.TraitsID,
                    StudentEnrTraitCode = se.StudentSY + tbdo.TraitsID,
                    GradeSectionCode = (int)se.GradeSectionCode,
                    LockFirst = false,
                    LockSecond = false,
                    LockFourth = false,
                    LockThird = false
                };
                string message = string.Empty;
                StudentTraitBDO stb = new StudentTraitBDO();
                NewTraitsTranslateStuTraitsToStuTraitsBDO(st, stb);
                ret = stl.AddStudentCharacters(stb, ref message);
            }
            return ret;

        }