コード例 #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="unitName"></param>
 /// <returns></returns>
 public SyncTeachers SyncAllTeachers(string unitName)
 {
     SyncTeachers collection = new SyncTeachers();
     DataTable dtSource = this.poxy.GetTeacher(unitName);
     if (dtSource != null && dtSource.Rows.Count > 0)
     {
         foreach (DataRow row in dtSource.Rows)
         {
             SyncTeacher data = new SyncTeacher();
             data.TeaCode = Convert.ToString(row["ACCOUNT"]);
             data.TeaName = Convert.ToString(row["XM"]);
             data.School.UnitCode = Convert.ToString(row["DWDM"]);
             data.School.UnitName = Convert.ToString(row["DWMC"]);
             try
             {
                 data.Sex = Convert.ToString(row["XB"]);
             }
             catch (Exception) { }
             try
             {
                 data.Titles = Convert.ToString(row["ZC"]);
             }
             catch (Exception) { }
             try
             {
                 data.Phone = Convert.ToString(row["DH"]);
             }
             catch (Exception) { }
             try
             {
                 data.Birthday = Convert.ToString(row["CSRQ"]);
             }
             catch (Exception) { }
             try
             {
                 data.JobCategory = Convert.ToString(row["ZWLB"]);
             }
             catch (Exception) { }
             collection.Add(data);
         }
     }
     return collection;
 }
コード例 #2
0
 /// <summary>
 /// 同步所有的教师数据。
 /// </summary>
 /// <param name="unitName"></param>
 /// <returns></returns>
 public SyncTeachers SyncAllTeachers(string unitName)
 {
     string err = null;
     DataTable dtSource = this.poxy.SyncAllTeachers(unitName, out err);
     if (!string.IsNullOrEmpty(err))
     {
         throw new Exception("同步学校[" + unitName + "]下教师数据发生异常:" + err);
     }
     SyncTeachers teachers = new SyncTeachers();
     if (dtSource != null && dtSource.Rows.Count > 0)
     {
         foreach (DataRow row in dtSource.Rows)
         {
             SyncTeacher st = new SyncTeacher();
             st.TeaName = string.Format("{0}", row["TeaName"]);
             st.TeaCode = string.Format("{0}", row["TeaCode"]);
             teachers.Add(st);
         }
     }
     return teachers;
 }