public Adding_Subject(UserInfObject _userInfObject)
        {
            InitializeComponent();
            PW    = adding_panel.Height;
            Hided = false;
            //adding_panel.Visible = false;
            adding_panel.Visible = false;
            this._userInfObject  = _userInfObject;
            presenter            = new AddSubjectPresenter(this, _userInfObject);
            edit_panel.Hide();


            if (_userInfObject != null)
            {
                DataTable dt = presenter.loadSubjects();

                foreach (DataRow dr in dt.Rows)
                {
                    //bug
                    string subjectCode = dr["study_name"].ToString();
                    string description = dr["study_decription"].ToString();
                    subject_list_view.Items.Add(subjectCode, 1);
                    Subject.Add(new Subjects
                    {
                        Subject_Code        = subjectCode,
                        Subject_Description = description
                    });
                    SubjectCode_txt.Text        = "";
                    SubjectDescription_txt.Text = "";
                    adding_panel.Visible        = false;
                }
            }
        }
Exemple #2
0
        public void loadSubjects()
        {
            subject_list_view.Clear();
            subject_list_view.FocusedItem = null;
            subject_list_view.Items.Add("Add Subject", 0);
            add_subjectAdd_btn.Region    = Region.FromHrgn(CreateRoundRectRgn(0, 0, add_subjectAdd_btn.Width, add_subjectAdd_btn.Height, 30, 30));
            cancel_subjectAdd_btn.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, cancel_subjectAdd_btn.Width, cancel_subjectAdd_btn.Height, 30, 30));

            DataTable dt = presenter.loadSubjects();

            Subject.Clear();

            foreach (DataRow dr in dt.Rows)
            {
                string name  = dr["study_name"].ToString();
                string descr = dr["study_decription"].ToString();
                addToListStack(name, descr);
            }
        }
        private void add_btn_Click(object sender, EventArgs e)
        {
            if (add_Subject_limiter.MaxValue > Subject.Count)
            {
                if (SubjectCode_txt.Text == "")
                {
                    MessageBox.Show("Subject Code must have value!!");
                }
                else
                {
                    subject_list_view.FocusedItem = null;
                    presenter.AddSubject();
                    DataTable dt = presenter.loadSubjects();

                    foreach (DataRow dr in dt.Rows)
                    {
                        //bug
                        string subjectCode = dr["study_name"].ToString();
                        string description = dr["study_decription"].ToString();
                        subject_list_view.Items.Add(subjectCode, 1);
                        Subject.Add(new Subjects
                        {
                            Subject_Code        = subjectCode,
                            Subject_Description = description
                        });
                        SubjectCode_txt.Text        = "";
                        SubjectDescription_txt.Text = "";
                        adding_panel.Visible        = false;
                    }
                }
                add_Subject_limiter.Value = Subject.Count();
            }
            else
            {
                MessageBox.Show("Subject is at limit");
            }
        }