Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

205 рядки
4.4 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. namespace StuMgmClient
  5. {
  6. public enum ErrCode
  7. {
  8. Success,
  9. FailSerial,
  10. FailDeserial,
  11. FailConnect,
  12. FailSend,
  13. FailReceive,
  14. ErrData,
  15. }
  16. public enum ClientFunc
  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 ClientFunc Func;
  34. public object Object;
  35. public ClientRequest(ClientFunc 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. NoStart=0,
  66. Begin,
  67. WaitCheckig,
  68. CheckigSuccess,
  69. CheckigFail,
  70. //
  71. }
  72. [Serializable]
  73. public class UserCourseInfo
  74. {
  75. public short JobId;//工号
  76. public string Name;//姓名
  77. public string InfoDescribe;//信息描述
  78. }
  79. /*
  80. #region 学生题目信息一览
  81. #endregion
  82. #region 学生单题详细信息
  83. public class HistoryInfo
  84. {
  85. DateTime Time;
  86. string Describe;
  87. }
  88. public class DetailInfo
  89. {
  90. public short CourseId;
  91. public short JobId;
  92. List<HistoryInfo> Describes;
  93. }
  94. #endregion
  95. */
  96. //[Serializable]
  97. //public class ServerSend
  98. //{
  99. // public short permission { get; set; }
  100. // public DataSet ds { get; set; }
  101. //}
  102. }
  103. namespace StuMgmClient
  104. {
  105. //class Data
  106. //{
  107. // //状态值字符串转字典
  108. // public Dictionary<int, int> StateParsing(DataTable table)
  109. // {
  110. // Dictionary<int, int> myDictionary = new Dictionary<int, int>();
  111. // ClientMysql cm = new ClientMysql();
  112. // DataSet ds = cm.SelectState();
  113. // DataRow dr = ds.Tables["user_info"].Rows[0];
  114. // string state = dr["course_status"].ToString();
  115. // int num = 0;
  116. // int oldTem = 0;
  117. // //切割字符串
  118. // string[] sArray = state.Split(new char[2] { ':', ';' });
  119. // foreach (string i in sArray)
  120. // {
  121. // if (i.Equals("")) { break; }
  122. // int tem = Convert.ToInt32(i);
  123. // num++;
  124. // if (num % 2 != 0)
  125. // {
  126. // myDictionary.Add(tem, 0);
  127. // oldTem = tem;
  128. // }
  129. // else
  130. // {
  131. // myDictionary[oldTem] = tem;
  132. // }
  133. // }
  134. // return myDictionary;
  135. // }
  136. // //字典转字符串
  137. // public string DicParsing(Dictionary<int, int> dic)
  138. // {
  139. // string stateText = "";
  140. // foreach (var item in dic)
  141. // {
  142. // stateText = stateText + item.Key + ":" + item.Value + ";";
  143. // }
  144. // return stateText;
  145. // }
  146. // //查询所有子节点
  147. // public void GetAllNodes(string id, DataTable table, ref Dictionary<int, int> nodesDic)
  148. // {
  149. // //把父节点的数据筛选出来
  150. // DataRow[] rows = table.Select("pid =" + id);//取根
  151. // if (rows.Length <= 0)
  152. // {
  153. // nodesDic.Add(Convert.ToInt32(id), 0);
  154. // return;
  155. // }
  156. // foreach (DataRow dr in rows)
  157. // {
  158. // GetAllNodes(dr["id"].ToString(), table, ref nodesDic);
  159. // }
  160. // }
  161. // //获取所有子节点Dictionary
  162. // public Dictionary<int, int> GetNodesDic(DataTable table)
  163. // {
  164. // Dictionary<int, int> nodesDic = new Dictionary<int, int>();
  165. // GetAllNodes("0", table, ref nodesDic);
  166. // return nodesDic;
  167. // }
  168. //}
  169. }