private void ViewStudents_Tab_GotFocus(object sender, RoutedEventArgs e)
 {
     var fdset = new financeapplicationDataSet();
     var fsdadapter = new financeapplicationDataSetTableAdapters.students_detailsTableAdapter();
     fsdadapter.Fill(fdset.students_details);
     ViewStudentsGrid.DataContext = fsdadapter.GetData();
 }
Exemple #2
0
        internal void Modify()
        {
            try
            {
                var adm = Convert.ToInt32(AdmNo);
                var fdataset = new financeapplicationDataSet();
                var fdatasetadapter = new financeapplicationDataSetTableAdapters.students_detailsTableAdapter();
                fdatasetadapter.Fill(fdataset.students_details);
                var sqlwhere = "admission_no=" + adm;
                var newDataTable = fdataset.students_details.Select(sqlwhere).CopyToDataTable();
                var row = newDataTable.Rows[0];
                try
                {
                    MessageBox.Show((Convert.ToInt32(row[0].ToString())).ToString());
                    //fdatasetadapter.Update(Convert.ToInt32(admNo), firstName, lastName, dofBirth, gender, admDate, parentName, parentContact);
                    MessageBox.Show("The Student " + row[0].ToString() + " has been added to the database");
                    var stv = new StudentView();
                    stv.PageClear();
                }
                catch (Exception e2)
                {
                    MessageBox.Show("An error has occured. Error Message: " + e2.Message.ToString());
                }

            }
            catch (Exception e1)
            {
                MessageBox.Show("Error occured while trying to write to the database. Please try again. Error Message: " + e1.Message.ToString());
            }
        }
Exemple #3
0
        public void New()
        {
            try
            {
                var adm=Convert.ToInt32(AdmNo);
                var fdataset = new financeapplicationDataSet();
                var sdetailsAdapter = new financeapplicationDataSetTableAdapters.students_detailsTableAdapter();
                var pdetailsAdapter = new financeapplicationDataSetTableAdapters.payment_detailsTableAdapter();

                try
                {
                    sdetailsAdapter.Insert(Convert.ToInt32(_admNo), _firstName, _lastName, _dofBirth, _gender, _admDate, _parentName, _parentContact);

                    //loop to initialize payment details of the new student from form 1-4 to 0 in db
                    for (var count1 = 1; count1 < 5; count1++)
                    {
                        for (var count2 = 1; count2 < 4; count2++)
                        {
                            pdetailsAdapter.Insert(Convert.ToInt32(_admNo), 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, 0, 0, count1, count2, 0);
                        }
                    }

                    MessageBox.Show("The Student " + _firstName + " has been added to the database");
                    var stv = new StudentView();
                    stv.PageClear();
                }
                catch (Exception e2)
                {
                    MessageBox.Show("An error has occured. Error Message: " + e2.Message.ToString());
                }

            }
            catch(Exception e1)
            {
                MessageBox.Show("Error occured while trying to write to the database. Please try again. Error Message: "+ e1.Message.ToString());
            }
        }
Exemple #4
0
        public Dictionary<string, string> RetrieveDetails(string admissionNo)
        {
            var adm = admissionNo;
            var fdset = new financeapplicationDataSet();
            var fadapter = new financeapplicationDataSetTableAdapters.students_detailsTableAdapter();
            fadapter.Fill(fdset.students_details);

            var stdictionary=new Dictionary<string, string>();
            var columncount=fdset.students_details.Columns.Count;
            var count = 0;
            var sqlwhere = "admission_no=" + adm;
            try
            {
                var newDataTable = fdset.students_details.Select(sqlwhere).CopyToDataTable();
                var row = newDataTable.Rows[0];

                while (count < columncount)
                {
                    stdictionary[newDataTable.Columns[count].ToString()] = Convert.ToString(row[newDataTable.Columns[count]]);
                    count++;
                }
            }
            catch
            {

            }

            return stdictionary;
        }