Ejemplo n.º 1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            //Get value from UI
            string   name      = textBoxName.Text.Trim();
            string   rollno    = textBoxRollNo.Text.Trim();
            string   grade     = comboBoxGrade.SelectedItem.ToString();
            DateTime enrolDate = dateTimePickerEnrolDate.Value;
            bool     isActive  = checkBoxIsActive.Checked;

            //Save to database
            Student s = new Student();

            s.Name      = name;
            s.RollNo    = Convert.ToInt32(rollno);
            s.Grade     = grade;
            s.EnrolDate = enrolDate;
            s.Active    = isActive;

            StudentApp app     = new StudentApp();
            bool       success = app.CreateStudent(s);

            //Show the result
            if (success == true)
            {
                MessageBox.Show("Save succesful");
            }
            else
            {
                MessageBox.Show("Save failed");
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create(StudentModel student)
        {
            StudentApp app = new StudentApp();

            //save to database
            Student s = new Student();

            s.Name      = student.Name;
            s.RollNo    = student.RollNo;
            s.EnrolDate = student.EnrolDate;
            s.Grade     = student.Grade;
            s.Active    = student.Active;

            bool success = app.CreateStudent(s);

            //show result
            if (success == true)
            {
                return(RedirectToAction("Success"));
            }
            else
            {
                return(RedirectToAction("Fail"));
            }
        }
Ejemplo n.º 3
0
        /* The StartApplication method is triggered when the Start button on the
         * UI is pressed. The method creates a new Application object and passes
         * that on to the constructor of the Step1 page. After the Step1 object
         * is created it is pushed to the navigation stack and the UI will switch
         * to the Step1 page.
         */
        void StartApplication()
        {
            StudentApp Application = new StudentApp();

            Apply.Step1 newPage = new Apply.Step1(Application);
            Navigation.PushAsync(newPage);
        }
Ejemplo n.º 4
0
        private void FormAttendance_Load(object sender, EventArgs e)
        {
            //show students list to combo-box
            StudentApp studentApp = new StudentApp();
            DataTable  dtStudents = studentApp.GetAllStudents();

            comboBoxStudent.DataSource    = dtStudents;
            comboBoxStudent.DisplayMember = "Name";
            comboBoxStudent.ValueMember   = "Id";
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            // create a single object for the database app
            StudentApp app = new StudentApp();

            // read in data from the input file
            app.ReadDataFromInputFile();

            // operate the database - carry out the user's CRUD (create, read, update, delete) operations
            app.RunDatabaseApp();
        }