You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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