示例#1
0
        static private int SortSHSchoolData_SHClassRecord(SHSchool.Data.SHClassRecord class1, SHSchool.Data.SHClassRecord class2)
        {
            string ClassYear1 = class1.GradeYear.HasValue ? class1.GradeYear.Value.ToString().PadLeft(10, '0') : string.Empty.PadLeft(10, '9');
            string ClassYear2 = class2.GradeYear.HasValue ? class2.GradeYear.Value.ToString().PadLeft(10, '0') : string.Empty.PadLeft(10, '9');

            string DisplayOrder1 = "";

            if (string.IsNullOrEmpty(class1.DisplayOrder))
            {
                DisplayOrder1 = class1.DisplayOrder.PadLeft(10, '9');
            }
            else
            {
                DisplayOrder1 = class1.DisplayOrder.PadLeft(10, '0');
            }
            string DisplayOrder2 = "";

            if (string.IsNullOrEmpty(class2.DisplayOrder))
            {
                DisplayOrder2 = class2.DisplayOrder.PadLeft(10, '9');
            }
            else
            {
                DisplayOrder2 = class2.DisplayOrder.PadLeft(10, '0');
            }

            string ClassName1 = class1.Name.PadLeft(10, '0');
            string ClassName2 = class2.Name.PadLeft(10, '0');

            string Compareto1 = ClassYear1 + DisplayOrder1 + ClassName1;
            string Compareto2 = ClassYear2 + DisplayOrder2 + ClassName2;

            return(Compareto1.CompareTo(Compareto2));
        }
示例#2
0
        public StudentSortObj_SHSchoolData(SHSchool.Data.SHClassRecord classRecord, SHSchool.Data.SHStudentRecord student)
        {
            string ClassYear     = ""; //年級
            string ClassIndex    = ""; //班級序號
            string ClassName     = ""; //班級名稱
            string StudentSeatNo = ""; //學生座號
            string StudentName   = ""; //學生姓名

            _StudentRecord = student;

            #region ClassIndex & ClassName
            if (classRecord != null) //如果有班級
            {
                _ClassRecord = classRecord;
                ClassYear    = Year(_ClassRecord);
                ClassIndex   = Index(_ClassRecord);
                ClassName    = _ClassRecord.Name.PadLeft(10, '0');
            }
            else //如果沒有班級 or 年級
            {
                ClassYear  = ClassYear.PadLeft(10, '9');
                ClassIndex = ClassIndex.PadLeft(10, '9');
                ClassName  = ClassName.PadLeft(10, '9');
            }
            #endregion

            StudentName = _StudentRecord.Name.PadLeft(10, '0');

            StudentSeatNo = _StudentRecord.SeatNo.HasValue ?
                            _StudentRecord.SeatNo.Value.ToString().PadLeft(10, '0') :
                            StudentSeatNo.PadLeft(10, '9');

            _SortString = ClassYear + ClassIndex + ClassName + StudentSeatNo + StudentName;
        }
示例#3
0
        public string Index(SHSchool.Data.SHClassRecord _class)
        {
            string classIndex = "";

            if (string.IsNullOrEmpty(_class.DisplayOrder))
            {
                classIndex = _class.DisplayOrder.PadLeft(10, '9');
            }
            else
            {
                classIndex = _class.DisplayOrder.PadLeft(10, '0');
            }

            return(classIndex);
        }
示例#4
0
        public string Year(SHSchool.Data.SHClassRecord _class)
        {
            string classYear = "";

            if (_class.GradeYear.HasValue)
            {
                classYear = _class.GradeYear.Value.ToString().PadLeft(10, '0');
            }
            else
            {
                classYear = classYear.PadLeft(10, '9');
            }

            return(classYear);
        }