public void TranslateCurrSub(Subject s, CurriculumSubject cs) { LearningAreaService las = new LearningAreaService(); LearningArea la = new LearningArea(); SubjectService ss = new SubjectService(); Subject subj = new Subject(); subj = ss.GetSubject(s.SubjectCode); cs.Subj = s; cs.SubjectCode = s.SubjectCode; la = las.GetLearningArea(s.LearningAreaCode); cs.Academic = la.Academic; cs.RatePerUnit = la.RatePerUnit; cs.Units = la.Units; cs.SubjectDescription = subj.Description; cs.GradeLevel = subj.GradeLevel; cs.LearningAreaCode = subj.LearningAreaCode; }
private void TranslateLearningAreaToLearningAreaBDO(LearningArea la, LearningAreaBDO labdo) { SubjectService ss = new SubjectService(); labdo.Academic = la.Academic; labdo.Description = la.Description; labdo.LearningAreaCode = la.LearningAreaCode; labdo.RatePerUnit = la.RatePerUnit; labdo.Units = la.Units; labdo.Subjects = ss.ToSubjectBDOList(la.Subjects); }
private void TranslateCurriculumSubjectBDOToCurriculumSubject(CurriculumSubjectBDO cs, CurriculumSubject csbdo) { Subject sbdo = new Subject(); SubjectService ss = new SubjectService(); LearningAreaService las = new LearningAreaService(); LearningArea la = new LearningArea(); csbdo.CurriculumSubjectsID = cs.CurriculumSubjectsID; csbdo.CurriculumCode = cs.CurriculumCode; csbdo.CurrSubCode = cs.CurrSubCode; csbdo.Deactivated = cs.Deactivated; ss.TranslateSubjectBDOToSubject(cs.Sub, sbdo); csbdo.Subj = sbdo; csbdo.SubjectCode = cs.SubjectCode; la = las.GetLearningArea(sbdo.LearningAreaCode); csbdo.Academic = la.Academic; csbdo.RatePerUnit = la.RatePerUnit; csbdo.Units = la.Units; csbdo.SubjectDescription = sbdo.Description; csbdo.GradeLevel = sbdo.GradeLevel; csbdo.LearningAreaCode = sbdo.LearningAreaCode; }
private void Save() { ILearningAreaService laService = new LearningAreaService(); Boolean ret = false; string message = String.Empty; bool chec = checkAcademic.Checked; LearningArea learningArea = new LearningArea() { LearningAreaCode = txtLearningAreaCode.Text.ToString(), Description = txtDescription.Text.ToString(), Units = Double.Parse(txtUnits.Text.ToString()), Subjects = subjects, RatePerUnit = Double.Parse(txtRate.Text.ToString()), RatePerSubject = Double.Parse(txtRatePerSubject.Text.ToString()), Academic = chec }; if (Op.Equals("edit")) { ret = laService.UpdateLearningArea(ref learningArea, ref message); Log("U", "LearningArea", learningArea); foreach (Subject s in subjects) { Log("U", "Subject", s); } if (ret) MessageBox.Show("Saved Successfully"); else MessageBox.Show("Error Saving"); if (Op.Equals("edit")) Close(); } else { String la = txtLearningAreaCode.Text.ToString(); if (la.Equals(String.Empty)) { MessageBox.Show("Provide Learning Area Code"); } else { ret = laService.CreateLearningArea(ref learningArea, ref message); Log("C", "LearningAreas", learningArea); if (ret) MessageBox.Show("Saved Successfully"); else MessageBox.Show("Error Saving"); if (Op.Equals("new")) { Op = "edit"; txtLearningAreaCode.Enabled = false; this.Size = new Size(812, 571); gvSubjects.Enabled = true; } } } }
private void txtLearningAreaCode_Leave(object sender, EventArgs e) { LearningArea la = new LearningArea(); string msg = string.Empty; ILearningAreaService laService = new LearningAreaService(); la = laService.GetLearningArea(txtLearningAreaCode.Text); if (la.LearningAreaCode != null) { MessageBox.Show("Learning Area already exist!"); txtLearningAreaCode.Text = string.Empty; txtLearningAreaCode.Focus(); return; } }
private void gvLearningArea_SelectionChanged(object sender, EventArgs e) { int selectedIndex = gvLearningArea.CurrentRow.Index; if (selectedIndex >= 0) { string laCode = gvLearningArea.Rows[selectedIndex].Cells["LearningAreaCode"].Value.ToString(); List<LearningArea> item = new List<LearningArea>(); item = learningAreaList.FindAll(x => x.LearningAreaCode.ToString() == laCode); learningAreaSelected = new LearningArea(); learningAreaSelected = (LearningArea)item[0]; } }