Ejemplo n.º 1
0
        //this function is used to determine if the student id exists
        private Boolean IsExistStudentIdStudentInformation(CommonExchange.SysAccess userInfo, String studentId, String studentSysId)
        {
            Boolean isExist = false;

            using (RemoteClient.RemCntStudentManager remClient = new RemoteClient.RemCntStudentManager())
            {
                isExist = remClient.IsExistsStudentIdStudentInformation(userInfo, studentId, studentSysId);
            }

            return(isExist);
        } //-------------------------------
Ejemplo n.º 2
0
        }//---------------------

        //this function will get student information by person system id
        public CommonExchange.Student SelectBySysIDPersonStudentInformation(CommonExchange.SysAccess userInfo, String personSysId, String startUp)
        {
            CommonExchange.Student studentInfo = new CommonExchange.Student();

            using (RemoteClient.RemCntStudentManager remClient = new RemoteClient.RemCntStudentManager())
            {
                studentInfo = remClient.SelectBySysIDPersonStudentInformation(userInfo, personSysId);
            }

            studentInfo.PersonInfo.FilePath = this.GetPersonImagePath(userInfo, studentInfo.PersonInfo.PersonSysId,
                                                                      studentInfo.PersonInfo.PersonImagesFolder(startUp));

            return(studentInfo);
        }//------------------
Ejemplo n.º 3
0
        }//------------------------------

        //this function gets the selected student
        public DataTable GetSearchedStudentInformation(CommonExchange.SysAccess userInfo,
                                                       String queryString, String dateStart, String dateEnd, String yearLevelId, String courseId)
        {
            DataTable newTable = new DataTable("StudentSearchByStudentNameIdCardNumberTable");

            newTable.Columns.Add("student_id", System.Type.GetType("System.String"));
            newTable.Columns.Add("card_number", System.Type.GetType("System.String"));
            newTable.Columns.Add("student_name", System.Type.GetType("System.String"));
            newTable.Columns.Add("course_title", System.Type.GetType("System.String"));
            newTable.Columns.Add("year_level_description", System.Type.GetType("System.String"));
            newTable.Columns.Add("department_name", System.Type.GetType("System.String"));

            using (RemoteClient.RemCntStudentManager remClient = new RemoteClient.RemCntStudentManager())
            {
                _studentTable = remClient.SelectStudentInformation(userInfo, queryString, dateStart, dateEnd, courseId, yearLevelId);
            }

            foreach (DataRow studentRow in _studentTable.Rows)
            {
                DataRow newRow = newTable.NewRow();

                newRow["student_id"]   = RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "student_id", "");
                newRow["card_number"]  = RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "card_number", "");
                newRow["student_name"] = RemoteClient.ProcStatic.GetCompleteNameMiddleInitial(studentRow, "last_name", "first_name", "middle_name");
                newRow["course_title"] = RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "course_title", "") + " - " +
                                         RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "course_acronym", "");
                newRow["year_level_description"] = RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "year_level_description", "");
                newRow["department_name"]        = RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "department_name", "") + " - " +
                                                   RemoteServerLib.ProcStatic.DataRowConvert(studentRow, "department_acronym", "");

                newTable.Rows.Add(newRow);
            }

            newTable.AcceptChanges();

            return(newTable);
        }//-----------------------------
Ejemplo n.º 4
0
        } //------------------------

        //this procedure exports the student data to the sql server
        private void ExportStudentDataToSqlServer()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                Int32 deniedCount  = 0;
                Int32 successCount = 0;
                Int32 rowCount     = 0;

                pgbImport.Step    = 1;
                pgbImport.Maximum = this.dgvList.Rows.Count;

                foreach (DataRow studRow in _studentTable.Rows)
                {
                    this.SetDataGridViewBehavior(rowCount);

                    String studentId   = RemoteServerLib.ProcStatic.DataRowConvert(studRow, "ACCESSION", "");
                    String cardNumber  = RemoteServerLib.ProcStatic.DataRowConvert(studRow, "KEYWORDS", "");
                    String studentName = RemoteServerLib.ProcStatic.DataRowConvert(studRow, "TITLE0", "");

                    if (!this.IsExistStudentIdStudentInformation(_userInfo, studentId, "") &&
                        !this.IsExistCardNumberStudentInformation(_userInfo, cardNumber, "") &&
                        !String.Equals("(blank)", studentName) &&
                        !String.IsNullOrEmpty(RemoteClient.ProcStatic.TrimStartEndString(cardNumber)) &&
                        !String.IsNullOrEmpty(RemoteClient.ProcStatic.TrimStartEndString(studentId)))
                    {
                        String remarks = RemoteServerLib.ProcStatic.DataRowConvert(studRow, "REMARKS", "");

                        CommonExchange.Student studentInfo = new CommonExchange.Student();

                        studentInfo.ObjectState            = DataRowState.Added;
                        studentInfo.PersonInfo.ObjectState = DataRowState.Added;

                        StudentName    studName   = this.GetStudentNameDetails(studentName);
                        RemarksDetails remarkInfo = this.GetRemarksDetails(remarks);

                        studentInfo.StudentId            = RemoteClient.ProcStatic.TrimStartEndString(studentId);
                        studentInfo.PersonInfo.LastName  = studName.LastName;
                        studentInfo.PersonInfo.FirstName = studName.FirstName;
                        studentInfo.CardNumber           = cardNumber;
                        studentInfo.Scholarship          = studName.Scholoarship;
                        studentInfo.CourseInfo.CourseId  = this.GetCourseId(remarkInfo.CourseName);
                        studentInfo.PersonInfo.OtherPersonInformation = remarkInfo.OtherInformation;
                        studentInfo.PersonInfo.BirthDate = String.Empty;

                        if (!String.IsNullOrEmpty(_imagePath) && this.chkImage.Checked)
                        {
                            StudentImage imageInfo = this.GetStudentImageDetails(studentId);

                            if (!String.IsNullOrEmpty(imageInfo.ImagePath))
                            {
                                studentInfo.PersonInfo.FilePath      = imageInfo.ImagePath;
                                studentInfo.PersonInfo.FileData      = RemoteClient.ProcStatic.GetFileArrayBytes(imageInfo.ImagePath);
                                studentInfo.PersonInfo.FileExtension = imageInfo.ImageExtension;
                                studentInfo.PersonInfo.FileName      = Path.GetFileName(imageInfo.ImagePath);

                                this.txtDirectory.Text = imageInfo.ImagePath;
                            }
                        }

                        using (RemoteClient.RemCntStudentManager remClient = new RemoteClient.RemCntStudentManager())
                        {
                            remClient.InsertStudentInformation(_userInfo, ref studentInfo);
                        }

                        using (RemoteClient.RemCntIdMakerManager remClient = new RemoteClient.RemCntIdMakerManager())
                        {
                            remClient.UpdateForIdMakerStudentInformation(_userInfo, studentInfo);
                        }

                        successCount++;
                    }
                    else
                    {
                        deniedCount++;
                    }

                    pgbImport.PerformStep();

                    rowCount++;

                    Application.DoEvents();
                    this.Refresh();
                }

                MessageBox.Show("Student data has been successfully exported to the SQL Server" + "\n\nSuccess: " + successCount.ToString() + " Record(s)" +
                                "\nDenied: " + deniedCount.ToString() + " Record(s)", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                pgbImport.Value = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in exporting: " + ex.Message, "Error");
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        } //--------------------------------------