您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

202 行
4.4 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. namespace StuMgmClient
  5. {
  6. enum ErrCode
  7. {
  8. Success,
  9. FailSerial,
  10. FailDeserial,
  11. FailConnect,
  12. FailSend,
  13. FailReceive,
  14. ErrData,
  15. }
  16. public enum FuncCode
  17. {
  18. VerifLogin = 1,
  19. GetCourseInfo,
  20. GetUserCourseInfo,
  21. }
  22. public enum Roles
  23. {
  24. NotFound = -1,
  25. Error = -2,
  26. Admin = 1,
  27. Teacher = 2,
  28. Student = 3,
  29. }
  30. [Serializable]
  31. public class ClientRequest
  32. {
  33. public FuncCode Func;
  34. public object Object;
  35. public ClientRequest(FuncCode func, object obj)
  36. {
  37. Func = func;
  38. Object = obj;
  39. }
  40. }
  41. [Serializable]
  42. public class UserInfo
  43. {
  44. public short Account; // Changed
  45. public string Password;
  46. public Int16 Token;
  47. public Roles UserRole;
  48. public UserInfo(short account, string password) // Changed
  49. {
  50. Account = account;
  51. Password = password;
  52. }
  53. }
  54. public class CourseInfo
  55. {
  56. public short Id;
  57. public short Pid;
  58. public int Time;
  59. public string Name;
  60. public string Content;
  61. }
  62. [Serializable]
  63. public enum CourseStatusEnum
  64. {
  65. lll,
  66. ...//
  67. }
  68. [Serializable]
  69. public class UserCourseInfo
  70. {
  71. public short JobId;//工号
  72. public string Name;//姓名
  73. ..public DateTime Entry;
  74. public string InfoDescribe;//信息描述
  75. }
  76. /*
  77. #region 学生题目信息一览
  78. #endregion
  79. #region 学生单题详细信息
  80. public class HistoryInfo
  81. {
  82. DateTime Time;
  83. string Describe;
  84. }
  85. public class DetailInfo
  86. {
  87. public short CourseId;
  88. public short JobId;
  89. List<HistoryInfo> Describes;
  90. }
  91. #endregion
  92. */
  93. //[Serializable]
  94. //public class ServerSend
  95. //{
  96. // public short permission { get; set; }
  97. // public DataSet ds { get; set; }
  98. //}
  99. }
  100. namespace StuMgmClient
  101. {
  102. //class Data
  103. //{
  104. // //状态值字符串转字典
  105. // public Dictionary<int, int> StateParsing(DataTable table)
  106. // {
  107. // Dictionary<int, int> myDictionary = new Dictionary<int, int>();
  108. // ClientMysql cm = new ClientMysql();
  109. // DataSet ds = cm.SelectState();
  110. // DataRow dr = ds.Tables["user_info"].Rows[0];
  111. // string state = dr["course_status"].ToString();
  112. // int num = 0;
  113. // int oldTem = 0;
  114. // //切割字符串
  115. // string[] sArray = state.Split(new char[2] { ':', ';' });
  116. // foreach (string i in sArray)
  117. // {
  118. // if (i.Equals("")) { break; }
  119. // int tem = Convert.ToInt32(i);
  120. // num++;
  121. // if (num % 2 != 0)
  122. // {
  123. // myDictionary.Add(tem, 0);
  124. // oldTem = tem;
  125. // }
  126. // else
  127. // {
  128. // myDictionary[oldTem] = tem;
  129. // }
  130. // }
  131. // return myDictionary;
  132. // }
  133. // //字典转字符串
  134. // public string DicParsing(Dictionary<int, int> dic)
  135. // {
  136. // string stateText = "";
  137. // foreach (var item in dic)
  138. // {
  139. // stateText = stateText + item.Key + ":" + item.Value + ";";
  140. // }
  141. // return stateText;
  142. // }
  143. // //查询所有子节点
  144. // public void GetAllNodes(string id, DataTable table, ref Dictionary<int, int> nodesDic)
  145. // {
  146. // //把父节点的数据筛选出来
  147. // DataRow[] rows = table.Select("pid =" + id);//取根
  148. // if (rows.Length <= 0)
  149. // {
  150. // nodesDic.Add(Convert.ToInt32(id), 0);
  151. // return;
  152. // }
  153. // foreach (DataRow dr in rows)
  154. // {
  155. // GetAllNodes(dr["id"].ToString(), table, ref nodesDic);
  156. // }
  157. // }
  158. // //获取所有子节点Dictionary
  159. // public Dictionary<int, int> GetNodesDic(DataTable table)
  160. // {
  161. // Dictionary<int, int> nodesDic = new Dictionary<int, int>();
  162. // GetAllNodes("0", table, ref nodesDic);
  163. // return nodesDic;
  164. // }
  165. //}
  166. }