Пример #1
0
        public bool UpdateLearningArea(ref LearningArea learningArea, ref string message)
        {
            LearningAreaBDO labdo = new LearningAreaBDO();

            TranslateLearningAreaToLearningAreaBDO(learningArea, labdo);
            return(laLogic.UpdateLearningArea(ref labdo, ref message));
        }
Пример #2
0
        private void Save()
        {
            LearningAreaServiceClient laService = new LearningAreaServiceClient();
            Boolean ret = false;
            string message = String.Empty;
            LearningArea learningArea = new LearningArea()
            {
                LearningAreaCode = txtLearningAreaCode.Text.ToString(),
                Description = txtDescription.Text.ToString(),
                Units = Double.Parse(txtUnits.Text.ToString()),
                Subjects = subjects.ToArray(),
                RatePerUnit = Double.Parse(txtRate.Text.ToString()),
                Academic = checkAcademic.Checked
            };
            if (Op.Equals("edit"))
                ret = laService.UpdateLearningArea(ref learningArea, ref message);
            else
                ret = laService.CreateLearningArea(ref learningArea, ref message);

            if (ret)
                MessageBox.Show("Saved Successfully");
            else
                MessageBox.Show("Error Saving");

            Close();

        }
Пример #3
0
        private void Save()
        {
            LearningAreaServiceClient laService = new LearningAreaServiceClient();
            Boolean      ret          = false;
            string       message      = String.Empty;
            LearningArea learningArea = new LearningArea()
            {
                LearningAreaCode = txtLearningAreaCode.Text.ToString(),
                Description      = txtDescription.Text.ToString(),
                Units            = Double.Parse(txtUnits.Text.ToString()),
                Subjects         = subjects.ToArray(),
                RatePerUnit      = Double.Parse(txtRate.Text.ToString()),
                Academic         = checkAcademic.Checked
            };

            if (Op.Equals("edit"))
            {
                ret = laService.UpdateLearningArea(ref learningArea, ref message);
            }
            else
            {
                ret = laService.CreateLearningArea(ref learningArea, ref message);
            }

            if (ret)
            {
                MessageBox.Show("Saved Successfully");
            }
            else
            {
                MessageBox.Show("Error Saving");
            }

            Close();
        }
Пример #4
0
 public void TranslateLearningAreaToLearningAreaBDO(LearningArea la, LearningAreaBDO lBdo)
 {
     lBdo.Academic         = la.Academic;
     lBdo.Description      = la.Description;
     lBdo.LearningAreaCode = la.LearningAreaCode;
     lBdo.RatePerUnit      = la.RatePerUnit;
     lBdo.Units            = la.Units;
     lBdo.RatePerSubject   = la.RatePerSubject;
     lBdo.Subjects         = ToSubjectBDOList(la.Subjects);
 }
Пример #5
0
        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);
        }
Пример #6
0
        public LearningArea GetLearningArea(string learningAreaCode)
        {
            LearningArea    la    = new LearningArea();
            LearningAreaBDO laBDO = laLogic.GetLearningArea(learningAreaCode);

            if (laBDO != null)
            {
                TranslateLearningAreaBDOToLearningArea(laLogic.GetLearningArea(learningAreaCode), la);
            }

            return(la);
        }
Пример #7
0
        public List <LearningArea> GetAllLearningAreas()
        {
            List <LearningArea> lList = new List <LearningArea>();

            foreach (LearningAreaBDO labdo in laLogic.GetAllLearningAreas())
            {
                LearningArea la = new LearningArea();
                TranslateLearningAreaBDOToLearningArea(labdo, la);
                lList.Add(la);
            }
            return(lList);
        }
Пример #8
0
        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;
            }
        }
Пример #9
0
        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];
            }
        }
Пример #10
0
        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;
        }
Пример #11
0
        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;
        }
Пример #12
0
        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;
                    }
                }
            }
        }
Пример #13
0
        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];
            }
        }
Пример #14
0
        private void txtLearningAreaCode_Leave(object sender, EventArgs e)
        {
            LearningArea la = new LearningArea();
            string msg = string.Empty;
            LearningAreaServiceClient laService = new LearningAreaServiceClient();

            la = laService.GetLearningArea(txtLearningAreaCode.Text);
            if (la.LearningAreaCode != null)
            {
                MessageBox.Show("Learning Area already exist!");
                txtLearningAreaCode.Text = string.Empty;
                txtLearningAreaCode.Focus();
                return;
            }
        }
Пример #15
0
        private void Save()
        {
            LearningAreaServiceClient laService = new LearningAreaServiceClient();
            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.ToArray(),
                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(704, 568);
                        gvSubjects.Enabled = true;
                    }
                }
            }
        }