Exemple #1
0
 public List<Curriculum> GetAllCurriculums()
 {
     List<Curriculum> curList = new List<Curriculum>();
     foreach (CurriculumBDO curr in clogic.GetAllCurriculums())
     {
         Curriculum c = new Curriculum();
         TranslateCurriculumBDOToCurriculum(curr, c);
         curList.Add(c);
     }
     return curList;
 }
        private void gvCurriculum_SelectionChanged(object sender, EventArgs e)
        {
            int selectedIndex = gvCurriculum.CurrentRow.Index;


            if (selectedIndex >= 0)
            {
                string cID = gvCurriculum.Rows[selectedIndex].Cells["CurriculumCode"].Value.ToString();
                List<Curriculum> item = new List<Curriculum>();
                item = currList.FindAll(x => x.CurriculumCode.ToString() == cID);

                currSelected = new Curriculum();
                currSelected = (Curriculum)item[0];
            }
        }
Exemple #3
0
 public bool CreateCurriculum(ref Curriculum curriculum, ref string message)
 {
     CurriculumBDO cbdo = new CurriculumBDO();
     TranslateCurriculumToCurriculumBDO(curriculum, cbdo);
     return clogic.CreateCurriculum(ref cbdo, ref message);
 }
Exemple #4
0
        private void TranslateCurriculumBDOToCurriculum(CurriculumBDO curriculum, Curriculum cbdo)
        {
            cbdo.CurrentCurr = curriculum.CurrentCurr;
            cbdo.CurriculumCode = curriculum.CurriculumCode;
            cbdo.Description = curriculum.Description;
            cbdo.CurriculumSubjects = ToCurriculumSubjectList(curriculum.CurriculumSubjects);

        }
Exemple #5
0
        private void TranslateCurriculumToCurriculumBDO(Curriculum curriculum, CurriculumBDO cbdo)
        {
            cbdo.CurrentCurr = curriculum.CurrentCurr;
            cbdo.CurriculumCode = curriculum.CurriculumCode;
            cbdo.Description = curriculum.Description;
            cbdo.CurriculumSubjects = ToCurriculumSubjectBDOList(curriculum.CurriculumSubjects.ToList<CurriculumSubject>());

        }
Exemple #6
0
 public bool UpdateCurriculum(ref Curriculum curriculum, ref string message)
 {
     CurriculumBDO cb = new CurriculumBDO();
     TranslateCurriculumToCurriculumBDO(curriculum, cb);
     return clogic.UpdateCurriculum(ref cb, ref message);
 }
        private void Save()
        {
            
            string message = String.Empty;
            Curriculum c = new Curriculum();

            ICurriculumService curriculumService = new CurriculumService();

            var curri = curriculumService.GetAllCurriculums();

            curr = new List<Curriculum>(curri);

            if (chkCurrent.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                c.CurrentCurr = true;
            }

            c.CurriculumCode = txtCurrCode.Text;
            c.CurriculumSubjects = currSub1;
            c.Description = txtDescription.Text;

            String cCode = txtCurrCode.Text.Trim();
            if (Op.Equals("new"))
            {
                foreach (Curriculum cu in curr)
                {
                    String currcode = cu.CurriculumCode;
                    if (cCode.Equals(currcode))
                    {
                        MessageBox.Show("Curriculum already exist!");
                        break;
                    }
                    else
                    {


                        if (Op.Equals("new"))
                        {
                            ret = cs.CreateCurriculum(ref c, ref message);
                            c.CurriculumSubjects = null;
                            Log("C", "Curriculums", c);
                            if (ret)
                            {
                                foreach (CurriculumSubject cs in currSub1)
                                    Log("C", "CurriculumSubjects", cs);

                                MessageBox.Show(this, message, "Add Successful");
                                Op = "edit";
                                //Comment this part. The current pocess is not working. 
                                //New process is to add the curriculum then update.
                                //this.txtCurrCode.Enabled = false;
                                //this.Size = new Size(851, 503);
                                //radGroupBox2.Visible = true;
                                this.Close();

                            }
                            else
                                MessageBox.Show(this, message, "Add Failed");
                        }
                    }
                }


               
            }

            else if (Op.Equals("edit"))
            {
                ret = cs.UpdateCurriculum(ref c, ref message);
                c.CurriculumSubjects = null;
                Log("U", "Curriculums", c);
                if (ret)
                {
                    foreach (CurriculumSubject cs in currSub1)
                        Log("C", "CurriculumSubjects", cs);
                    MessageBox.Show(this, message, "Update Successful");
                    this.Close();
                }
                else
                    MessageBox.Show(this, message, "Update Failed");
            }
                  
        }