Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

201 Zeilen
4.3 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 string Account;
  45. public string Password;
  46. public string Token;
  47. public Roles UserRole;
  48. public UserInfo(string account, string password)
  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 string InfoDescribe;//信息描述
  74. }
  75. /*
  76. #region 学生题目信息一览
  77. #endregion
  78. #region 学生单题详细信息
  79. public class HistoryInfo
  80. {
  81. DateTime Time;
  82. string Describe;
  83. }
  84. public class DetailInfo
  85. {
  86. public short CourseId;
  87. public short JobId;
  88. List<HistoryInfo> Describes;
  89. }
  90. #endregion
  91. */
  92. //[Serializable]
  93. //public class ServerSend
  94. //{
  95. // public short permission { get; set; }
  96. // public DataSet ds { get; set; }
  97. //}
  98. }
  99. namespace StuMgmClient
  100. {
  101. //class Data
  102. //{
  103. // //状态值字符串转字典
  104. // public Dictionary<int, int> StateParsing(DataTable table)
  105. // {
  106. // Dictionary<int, int> myDictionary = new Dictionary<int, int>();
  107. // ClientMysql cm = new ClientMysql();
  108. // DataSet ds = cm.SelectState();
  109. // DataRow dr = ds.Tables["user_info"].Rows[0];
  110. // string state = dr["course_status"].ToString();
  111. // int num = 0;
  112. // int oldTem = 0;
  113. // //切割字符串
  114. // string[] sArray = state.Split(new char[2] { ':', ';' });
  115. // foreach (string i in sArray)
  116. // {
  117. // if (i.Equals("")) { break; }
  118. // int tem = Convert.ToInt32(i);
  119. // num++;
  120. // if (num % 2 != 0)
  121. // {
  122. // myDictionary.Add(tem, 0);
  123. // oldTem = tem;
  124. // }
  125. // else
  126. // {
  127. // myDictionary[oldTem] = tem;
  128. // }
  129. // }
  130. // return myDictionary;
  131. // }
  132. // //字典转字符串
  133. // public string DicParsing(Dictionary<int, int> dic)
  134. // {
  135. // string stateText = "";
  136. // foreach (var item in dic)
  137. // {
  138. // stateText = stateText + item.Key + ":" + item.Value + ";";
  139. // }
  140. // return stateText;
  141. // }
  142. // //查询所有子节点
  143. // public void GetAllNodes(string id, DataTable table, ref Dictionary<int, int> nodesDic)
  144. // {
  145. // //把父节点的数据筛选出来
  146. // DataRow[] rows = table.Select("pid =" + id);//取根
  147. // if (rows.Length <= 0)
  148. // {
  149. // nodesDic.Add(Convert.ToInt32(id), 0);
  150. // return;
  151. // }
  152. // foreach (DataRow dr in rows)
  153. // {
  154. // GetAllNodes(dr["id"].ToString(), table, ref nodesDic);
  155. // }
  156. // }
  157. // //获取所有子节点Dictionary
  158. // public Dictionary<int, int> GetNodesDic(DataTable table)
  159. // {
  160. // Dictionary<int, int> nodesDic = new Dictionary<int, int>();
  161. // GetAllNodes("0", table, ref nodesDic);
  162. // return nodesDic;
  163. // }
  164. //}
  165. }