Example #1
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="dataPoxy"></param>
 /// <param name="syncName"></param>
 public SyncClearData(IDataSync dataPoxy, string syncName)
     : base(dataPoxy, syncName)
 {
     this.schoolsEntity = new SFITSchoolsEntity();
     this.classEntity = new SFITClassEntity();
     this.studentsEntity = new SFITStudentsEntity();
 }
        /// <summary>
        /// 构造函数。
        /// </summary>
        public TeaClientServiceProvider()
        {
            this.centerAccessEntity = new SFITCenterAccessEntity();
            this.teaClassEntity = new SFITTeaClassEntity();

            this.teachersEntity = new SFITeachersEntity();
            this.schoolsEntity = new SFITSchoolsEntity();
            this.gradeEntity = new SFITGradeEntity();
            this.evaluateEntity = new SFITEvaluateEntity();
            this.classEntity = new SFITClassEntity();
            this.studentsEntity = new SFITStudentsEntity();
            this.catalogEntity = new SFITCatalogEntity();

            this.schoolSetCatalogEntity = new SFITSchoolSetCatalogEntity();
            this.studentWorksEntity = new SFITStudentWorksEntity();

            this.localUserInfo = new GetLocalUserInfo();
        }
Example #3
0
 /// <summary> 
 /// 
 /// </summary>
 public OrgFactory()
 {
     this.schoolsEntity = new SFITSchoolsEntity();
     this.teacherEntity = new SFITeachersEntity();
     this.studentsEntity = new SFITStudentsEntity();
 }
Example #4
0
        protected override void DataSync(StringBuilder logBuilder, StringBuilder insertBuilder, StringBuilder updateBuilder, StringBuilder hiddenBuilder, int insertCount, int updateCount, int hiddenCount)
        {
            this.classEntity.DbEntityDataChangeLogEvent += new DbEntityDataChangeLogHandler(delegate(string head, string content)
            {
                this.AppendLog(logBuilder, string.Format("head:{0},content:{1}", head, content));
            });
            List<SFITSchools> schools = new SFITSchoolsEntity().LoadAllowSyncData();
            IDataSync dataSync = this.DataPoxy;
            if (schools != null && schools.Count > 0 && dataSync != null)
            {
                Maps.Converts gradeValueConverts = ModuleConfiguration.ModuleConfig.GradeValueConverts;
                if (gradeValueConverts == null || gradeValueConverts.Count == 0)
                {
                    this.AppendLog(logBuilder, "加载年级值转换配置时失败,同步失败!");
                    return;
                }
                foreach (SFITSchools sch in schools)
                {
                    SyncClasses classes = dataSync.SyncAllClasses(sch.SchoolName);
                    if (classes != null && classes.Count > 0)
                    {
                        foreach (SyncClass c in classes)
                        {
                            SFITClass data = new SFITClass();
                            data.ClassID = this.classEntity.GetClassIDByCode(c.Code);
                            if (data.ClassID.IsValid && this.classEntity.LoadRecord(ref data))
                            {
                                if (data.SyncStatus == 0x00)
                                {
                                    continue;
                                }
                            }

                            data.ClassCode = c.Code;
                            data.ClassName = c.Name;
                            data.SchoolID = sch.SchoolID;
                            data.LastSyncTime = DateTime.Now;
                            data.SyncStatus = 0x02;

                            try
                            {
                                data.JoinYear = int.Parse(c.JoinYear);
                            }
                            catch (Exception e)
                            {
                                this.AppendLog(logBuilder, "班级[" + c.ToString() + "]入学年级[" + c.JoinYear + "]转换为int型时异常[" + e.Message + "],本条记录同步失败!");
                                continue;
                            }

                            string strGrade = gradeValueConverts[c.Grade];
                            if (string.IsNullOrEmpty(strGrade))
                            {
                                this.AppendLog(logBuilder, "班级[" + c.ToString() + "]当前年级[" + c.Grade + "]没有设置转化,本条记录同步失败!");
                                continue;
                            }

                            try
                            {
                                data.GradeValue = int.Parse(strGrade);
                            }
                            catch (Exception e)
                            {
                                this.AppendLog(logBuilder, "班级[" + c.ToString() + "]当前年级[" + c.Grade + "=>("+strGrade+")--转换为int型失败]异常["+e.Message+"],本条记录同步失败!");
                                continue;
                            }

                            data.LearnLevel = (int)c.LearnLevel;
                            data.OrderNO = this.SetOrderNo(data.ClassCode);

                            if (!data.ClassID.IsValid)
                            {
                                data.ClassID = GUIDEx.New;
                                this.AppendLog(insertBuilder, string.Format("(班级ID:{0})[代码:{1}][名称:{2}][入学年份:{3}][学习阶段:{4}];", data.ClassID, data.ClassCode, data.ClassName, data.JoinYear, data.LearnLevel));
                                insertCount++;
                            }
                            else
                            {
                                this.AppendLog(updateBuilder, string.Format("(班级ID:{0})[代码:{1}][名称:{2}][入学年份:{3}][学习阶段:{4}];", data.ClassID, data.ClassCode, data.ClassName, data.JoinYear, data.LearnLevel));
                                updateCount++;
                            }
                            this.classEntity.UpdateRecord(data);
                        }
                    }
                }
            }
        }
Example #5
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="dataPoxy"></param>
 /// <param name="syncName"></param>
 public SyncUnitData(IDataSync dataPoxy, string syncName)
     : base(dataPoxy, syncName)
 {
     this.entity = new SFITSchoolsEntity();
 }
Example #6
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="dataPoxy"></param>
 /// <param name="syncName"></param>
 public SyncTeaData(IDataSync dataPoxy, string syncName)
     : base(dataPoxy, syncName)
 {
     this.schoolsEntity = new SFITSchoolsEntity();
     this.teachersEntity = new SFITeachersEntity();
 }
        protected override void DataSync(StringBuilder logBuilder, StringBuilder insertBuilder, StringBuilder updateBuilder, StringBuilder hiddenBuilder, int insertCount, int updateCount, int hiddenCount)
        {
            this.studentsEntity.DbEntityDataChangeLogEvent += new DbEntityDataChangeLogHandler(delegate(string head, string content)
            {
                this.AppendLog(logBuilder, string.Format("head:{0},content:{1}", head, content));
            });
            this.classStudentEntity.DbEntityDataChangeLogEvent += new DbEntityDataChangeLogHandler(delegate(string head, string content)
            {
                this.AppendLog(logBuilder, string.Format("head:{0},content:{1}", head, content));
            });
            List<SFITSchools> schools = new SFITSchoolsEntity().LoadAllowSyncData();
            IDataSync dataSync = this.DataPoxy;
            int count = 0;
            if (schools != null && dataSync != null && (count = schools.Count) > 0)
            {
                SFITClassEntity classEntity = new SFITClassEntity();
                for (int i = 0; i < count; i++)
                {
                    List<SFITClass> listClass = classEntity.LoadAllowSyncData(schools[i].SchoolID);
                    if (listClass != null && listClass.Count > 0)
                    {
                        foreach (SFITClass c in listClass)
                        {
                            List<GUIDEx> list = new List<GUIDEx>();
                            SyncStudents students = dataSync.SyncAllStudents(schools[i].SchoolName, string.Format("{0}", c.JoinYear), c.ClassName);
                            if (students != null && students.Count > 0)
                            {
                                for (int k = 0; k < students.Count; k++)
                                {
                                    #region 更新数据。
                                    SFITStudents data = new SFITStudents();
                                    data.StudentID = this.studentsEntity.GetStudentIDByCode(students[k].Code);
                                    if (data.StudentID.IsValid)
                                    {
                                        this.studentsEntity.LoadRecord(ref data);
                                    }
                                    data.StudentCode = students[k].Code;
                                    data.StudentName = students[k].Name;
                                    data.IDNumber = students[k].IDCard;
                                    data.JoinYear = int.Parse(students[k].JoinYear);
                                    data.Gender = this.TransGender(students[k].Gender);
                                    data.LastSyncTime = DateTime.Now;
                                    data.SyncStatus = 0x02;

                                    if (!data.StudentID.IsValid)
                                    {
                                        data.StudentID = GUIDEx.New;
                                        this.AppendLog(insertBuilder, string.Format("(学生ID:{0})[学号:{1}][名称:{2}][性别:{3}][入学年份:{4}][身份证号:{5}];",
                                            data.StudentID, data.StudentCode, data.StudentName, data.Gender, data.JoinYear, data.IDNumber));
                                        insertCount++;
                                    }
                                    else
                                    {
                                        this.AppendLog(updateBuilder, string.Format("(学生ID:{0})[学号:{1}][名称:{2}][性别:{3}][入学年份:{4}][身份证号:{5}];",
                                            data.StudentID, data.StudentCode, data.StudentName, data.Gender, data.JoinYear, data.IDNumber));
                                        updateCount++;
                                    }

                                    if (this.studentsEntity.UpdateRecord(data))
                                    {
                                        //添加到集合。
                                        list.Add(data.StudentID);
                                        //建立学生班级关系。
                                        this.classStudentEntity.Delete(data.StudentID);
                                        if (!this.classStudentEntity.ExistsData(c.ClassID, data.StudentID))
                                        {
                                            SFITClassStudents csdata = new SFITClassStudents();
                                            csdata.ClassID = c.ClassID;
                                            csdata.StudentID = data.StudentID;
                                            csdata.LastSyncTime = DateTime.Now;

                                            this.AppendLog(insertBuilder, string.Format("班级学生关系:[班级ID:{0}][班级代码:{1}][班级名称:{2}] -> [学生ID:{3}][学号:{4}][姓名:{5}]",
                                                                        c.ClassID, c.ClassCode, c.ClassName, data.StudentID, data.StudentCode, data.StudentName));
                                            this.classStudentEntity.UpdateRecord(csdata);
                                        }
                                        //设置学生角色。
                                        this.SetStudentAccessRole(data);
                                    }
                                    #endregion
                                }
                            }
                            //未同步的学生将设置为停止同步。
                            this.studentsEntity.StopSync(c.ClassID, list, ref hiddenBuilder, ref hiddenCount);
                        }
                    }
                }
            }
        }