| @@ -20,9 +20,10 @@ namespace StuMgmClient | |||
| public enum ClientFunc | |||
| { | |||
| VerifLogin = 1, | |||
| VerifyLogin = 1, | |||
| GetCourseInfo, | |||
| GetUserCourseInfo, | |||
| GetSelfUserCourseInfo | |||
| } | |||
| public enum Roles | |||
| { | |||
| @@ -50,7 +50,7 @@ namespace StuMgmClient | |||
| private void btnSubmit_Click(object sender, EventArgs e) | |||
| { | |||
| LvErr userRole; | |||
| Lvl userRole; | |||
| int token; | |||
| short job_id; | |||
| if (VerifLogin(out job_id, out userRole, out token) != ErrCode.Success) | |||
| @@ -58,7 +58,7 @@ namespace StuMgmClient | |||
| switch (userRole) | |||
| { | |||
| case LvErr.Student: | |||
| case Lvl.Student: | |||
| ShowStudentForm(job_id, token); | |||
| break; | |||
| default: | |||
| @@ -67,7 +67,7 @@ namespace StuMgmClient | |||
| } | |||
| } | |||
| ErrCode VerifLogin(out short job_id, out LvErr userRole, out int token) | |||
| ErrCode VerifLogin(out short job_id, out Lvl userRole, out int token) | |||
| { | |||
| job_id = 01943; | |||
| //ErrCode errcode = SystemCtrl.VerifLogin(txtUserName.Text, txtPassWord.Text, out userRole, out token); | |||
| @@ -1,4 +1,5 @@ | |||
| using System; | |||
| using StuMgmLib.MyNameSpace; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.ComponentModel; | |||
| using System.Data; | |||
| @@ -10,15 +11,21 @@ namespace StuMgmClient | |||
| { | |||
| public partial class SelectFrom : Form | |||
| { | |||
| Dictionary<int, string> dic = new Dictionary<int, string>(); | |||
| DataRow dr = null; | |||
| int stateN = 0; | |||
| public SelectFrom(DataRow drView,int state) | |||
| Dictionary<short, CourseStatusEnum> dicStatus; | |||
| short t_job_id; | |||
| int t_token; | |||
| int stateNum; | |||
| public SelectFrom(DataRow drView, Dictionary<short, CourseStatusEnum> allCourseStatus, short job_id, int toKen) | |||
| { | |||
| InitializeComponent(); | |||
| dr=drView; | |||
| stateN = state; | |||
| dic.Add(0, "未开始"); dic.Add(1, "进行中"); dic.Add(2, "待验收"); dic.Add(3, "等待验收中"); dic.Add(4, "验收中"); dic.Add(5, "验收完成"); dic.Add(6, "超时"); dic.Add(7, "预习"); | |||
| dicStatus = allCourseStatus; | |||
| t_job_id = job_id; | |||
| t_token = toKen; | |||
| dic.Add(0, "未开始"); dic.Add(1, "进行中"); dic.Add(2, "待验收"); dic.Add(3, "验收成功"); dic.Add(4, "验收失败"); | |||
| } | |||
| private void SelectFrom_Load(object sender, EventArgs e) | |||
| { | |||
| @@ -27,10 +34,13 @@ namespace StuMgmClient | |||
| //数据回显 | |||
| public void ShowData(DataRow dr) | |||
| { | |||
| short idState = Convert.ToInt16((dr["id"])); | |||
| stateNum= (int)dicStatus[idState]; | |||
| txtMsg.Text = dr["Content"].ToString(); | |||
| label2.Text =dr["name"].ToString(); | |||
| lblState.Text = dic[stateN]; | |||
| lblState.Text = dic[stateNum]; | |||
| MssionPower(stateNum); | |||
| //try | |||
| //{ | |||
| // lblTime.Text = Convert.ToDateTime(dr["Time"]).ToString("yyyy-MM-dd"); | |||
| @@ -47,43 +57,42 @@ namespace StuMgmClient | |||
| DialogResult result = MessageBox.Show("是否确定提交", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); | |||
| if (result == DialogResult.OK) | |||
| { | |||
| int userNameId = Convert.ToInt32(dr["NameId"]); | |||
| int nowMssionId = Convert.ToInt32(dr["MissionId"]); | |||
| int newMssionId = nowMssionId+1; | |||
| // sms.UpdateState(userNameId, nowMssionId, newMssionId); | |||
| short idState = Convert.ToInt16((dr["id"])); | |||
| dicStatus[idState]=(CourseStatusEnum)2; | |||
| UserCourseInfoOper o = new UserCourseInfoOper(); | |||
| o.Job_Id = t_job_id; | |||
| o.Token = t_token; | |||
| Utility.DicParsing(dicStatus); | |||
| o.Status = Utility.DicParsing(dicStatus); | |||
| SystemCtrl.SendUserCourseInfoOper(o); | |||
| MessageBox.Show("提交成功,可预习下一阶段内容", "提示"); | |||
| btnSumit.Visible = false; | |||
| this.Dispose(); | |||
| } | |||
| } | |||
| ////状态值改变控件 | |||
| //public void MssionPower() | |||
| //{ | |||
| // //任务权限 | |||
| // int stateNum = Convert.ToInt32(dr["State"]); | |||
| // switch (stateNum) | |||
| // { | |||
| // case 0: | |||
| // dr["Content"] = "当前不可查看"; | |||
| // lblTime.Visible = false; | |||
| // lblState.Visible = false; | |||
| // btnSumit.Visible = false; | |||
| // break; | |||
| // case 1: | |||
| // btnSumit.Visible = true; | |||
| // break; | |||
| // case 2: | |||
| // case 3: | |||
| // case 4: | |||
| // case 5: | |||
| // case 6: | |||
| // btnSumit.Visible = false; | |||
| // break; | |||
| // case 7: | |||
| // lblTime.Visible = false; | |||
| // btnSumit.Visible = false; | |||
| // break; | |||
| // } | |||
| //} | |||
| //状态值改变控件 | |||
| public void MssionPower(int state) | |||
| { | |||
| //任务权限 | |||
| switch (stateNum) | |||
| { | |||
| case 0: | |||
| dr["Content"] = "当前不可查看"; | |||
| lblTime.Visible = false; | |||
| lblState.Visible = false; | |||
| btnSumit.Visible = false; | |||
| break; | |||
| case 1: | |||
| btnSumit.Visible = true; | |||
| break; | |||
| case 2: | |||
| case 3: | |||
| case 4: | |||
| btnSumit.Visible = false; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -88,6 +88,7 @@ | |||
| // | |||
| this.btnSumit.Anchor = System.Windows.Forms.AnchorStyles.None; | |||
| this.btnSumit.BackColor = System.Drawing.Color.Transparent; | |||
| this.btnSumit.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSumit.BackgroundImage"))); | |||
| this.btnSumit.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; | |||
| this.btnSumit.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); | |||
| this.btnSumit.FlatAppearance.BorderSize = 0; | |||
| @@ -211,7 +212,7 @@ | |||
| // | |||
| this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); | |||
| this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
| this.ClientSize = new System.Drawing.Size(894, 623); | |||
| this.ClientSize = new System.Drawing.Size(899, 624); | |||
| this.Controls.Add(this.panMyMission); | |||
| this.DoubleBuffered = true; | |||
| this.Name = "SelectFrom"; | |||
| @@ -112,12 +112,12 @@ | |||
| <value>2.0</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <resheader name="writer"> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> | |||
| <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> | |||
| <data name="tlpMisson.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value> | |||
| /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwg | |||
| @@ -296,27 +296,59 @@ | |||
| QBZooooAKgmUDkd6KKAIqKKKACiiigApKKKACiiigAooooAKKKKACiiigAooooAmgctwanoooA//2Q== | |||
| </value> | |||
| </data> | |||
| <data name="picTime.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <data name="btnSumit.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value> | |||
| iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 | |||
| YQUAAAPsSURBVGhD7VhBaNRAFO1BBA8ePEgR226SLQoKBdGLeCmCgogHDxUE9SxCRUTQY09KEarWTtJS | |||
| tZ5UClYQrIpoD4JWL7XgRVC8KGpLazczu4rYxj/Jz+5PdtKtzWy3h33wsM77+/6fZCbzk4Y66qgCsux3 | |||
| q2nzToPlulYDM3buAJa2NEDxA0BvNTFr53dieZWhMqg15Z3A8irDYG6PyqSG/NDSz7dheUuDac+2Gdd5 | |||
| uyQYTBCziXBcK5kYIjk8oy93JtSaerx1WNbyAIZjxHwMh7VCLhGSw5OFo5QesmhiXp+ACtWdAIvsgXc4 | |||
| rBWGnbtNcvh7AKX0MG3xmZhP47BWGI54RHIAxTGU0gPMnhSNmStwWCvA+1mpeO5lBvKbUEqP2Pr8azg/ | |||
| DZS0wbD5e5LDw2E9yDju4ZK5mDdZ/hBKWtDkFDaDbyHMYdliFCU9aO6dy5Ym4E/iKUpaAOv/EvgukByd | |||
| KOmDLJok8EwndxylVJAtAvhx4Hzg7c5mWaEZZX2QBReLDxK9QSkRsh2p1AbA2ncivoxfQ0k/yu4CHGry | |||
| 3QHlCEhDmNiIWeXFf4ccbSjrhzQPkpCkcEaoXjhoTLwVDl6YxGMa41PTslwUkKijLDEQruZdevyr7oB8 | |||
| /MolAmM/wt+FjE+yqoCEyklIWo74IieytXt6fbgHWuy5DaB9iseGXNHiQ5hsbj8kn4wXE9JibreMa+3l | |||
| G1U6ksMmPukb1gKmw49AEVOxonzCnRiSMfJuqHRgAdqSy75RLQDJzymKCjlDNzb8n7bjEcrHKIatHOK9 | |||
| e5EOn4HNe1PGhJ9mwolYjguvjGK87DcBh2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MA6wIWe1HDqTR5tGJqAzFbPDEAX5TPkTIeLI+zhXcXXbTeontt | |||
| pN2xtYUkxtLkAbrbMJa3AhINwPwP4frYHaFdXs7qnjJxEV2XMGVy1XYmyS10kf2IdqJxOgqg8sggW7xl | |||
| 9e3iiQEAqusZZcERwdBdSg9am04NkGs3RMk6ut/Ggok9NhZVWVtWQNwA/A5xggbmJN3+4XOkf5z00PkZ | |||
| ZwvIjQHYyXz6Wy+7P6hzeIJ8eER/n/geW+oTLB8qpdvnl37tJHPX6XdRdvDMAIA9tGzI4wt89Xsf6604 | |||
| 8GDawReQtSEDgcT0gp8GIb79+6x26uGcOPUca0+yNAj7+jLaS787OUBW0i0lro1RuI0u+rw8uJSuHS/T | |||
| HdiB2JkzBUYnys/faD49PkzXtTJtbYCwxqH95xw8JfXUADMQIPTMQbp9K/6rf/oAZhecSrkwzeCRAdLR | |||
| 82SHt7tKW8gbB7pYMMTRiIMSAosRIpbHAzeuypZhsmR/B3vcLJaxAj9EoZNgawo5+X5ZMQBgJMjS7SCO | |||
| JuMwv2eWczAHAXQSdDOc/CoIsmaAQo4yIMcoA3KMMiDHKANyjIUB6t+Q2WBOUcMCLeR6Tf0lVV5J4R2+ | |||
| VZG5Wsj1oplfGgsrvKdwRf0FWsj1KgiEF8sqKLyDzjKrtXDLRQsdNlZSeEdece15WqjNRQuqf0t6T7xw | |||
| beRGLcSZ5VsdXEQr1VC6hUYUzhii1OavaVimhdWd8L9W7F0V9rnQH5ynhU/p7FVe3r/P0W8rv2eB2wAA | |||
| AABJRU5ErkJggg== | |||
| </value> | |||
| </data> | |||
| <data name="picTime.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value> | |||
| iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAA+xJREFUaEPt | |||
| WEFo1EAU7UEEDx48SBHbbpItCgoF0Yt4KYKCiAcPFQT1LEJFRNB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fo5UAsd9KOcQ4DusBXPGLJXP+x7wqGlHSBvB9TXJ424e9tSilBxxOr0rmbg6HtcKw3VE6AbPv | |||
| Vwal9JAnLDGvygTA9yXJ4WUYP4VSeoBh2adFbNIGUVsW5SFoYaFy48JYcQJ6Py0GCSMTgG7zAhlbPhmf | |||
| ki13fQKLAQzLJmD2i33w9wAsg+eVKeS/L0Ki3xgsn5GqLKHATHylhrWleNg6WGjC8ioj/p1ylbADy6sM | |||
| aNTuKAxqyv9aUhYTR+Eu3Icf+mu11pQfCORXDiyvjjr0oaHhHzetE48/dl7WAAAAAElFTkSuQmCC | |||
| </value> | |||
| </data> | |||
| <data name="panHead.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| @@ -6,16 +6,15 @@ namespace StuMgmClient | |||
| { | |||
| public partial class StudentForm : Form | |||
| { | |||
| int m_token; | |||
| int m_jobId; | |||
| public StudentForm(short job_id, int token) | |||
| { | |||
| m_token = token; | |||
| if (SystemCtrl.RefreshUserCourseInfo(job_id, token) != ErrCode.Success) | |||
| throw new Exception("获取用户信息异常,请重新启动"); | |||
| InitializeComponent(); | |||
| studentTree.Job_id = job_id; | |||
| studentTree.Token = token; | |||
| } | |||
| void GetStudentData() | |||
| { | |||
| @@ -6,7 +6,6 @@ using System.Data; | |||
| using System.Text; | |||
| using System.Windows.Forms; | |||
| using StuMgmLib.MyNameSpace; | |||
| namespace StuMgmClient | |||
| { | |||
| public partial class StudentTree : UserControl | |||
| @@ -15,6 +14,8 @@ namespace StuMgmClient | |||
| { | |||
| InitializeComponent(); | |||
| } | |||
| internal short Job_id; | |||
| internal int Token; | |||
| DataTable db = null; | |||
| Dictionary<short, CourseStatusEnum> allCourseStatus = null; | |||
| //dataRows转化成的table | |||
| @@ -93,9 +94,8 @@ namespace StuMgmClient | |||
| if (e.ColumnIndex == 1 && e.RowIndex != -1) | |||
| { | |||
| DataRow drViews = tableClone.Rows[e.RowIndex]; | |||
| short idState = Convert.ToInt16((drViews["id"])); | |||
| int state=(int)allCourseStatus[idState]; | |||
| SelectFrom sf = new SelectFrom(drViews, state); | |||
| SelectFrom sf = new SelectFrom(drViews, allCourseStatus, Job_id, Token); | |||
| //string test = da.DicParsing(stateDic); | |||
| sf.ShowDialog(); | |||
| } | |||
| @@ -90,6 +90,29 @@ namespace StuMgmClient | |||
| return ErrCode.FailDeserial; | |||
| return ErrCode.Success; | |||
| } | |||
| internal static ErrCode sendData(ClientRequest req,out ServerResponse o) | |||
| { | |||
| o = null; | |||
| if (!Connect()) | |||
| return ErrCode.FailConnect; | |||
| byte[] sendBuf; | |||
| if (!Utility.BinSerialize(req, out sendBuf)) | |||
| return ErrCode.FailSerial; | |||
| if (!Send(sendBuf)) | |||
| return ErrCode.FailSend; | |||
| if (!Receive()) | |||
| return ErrCode.FailReceive; | |||
| DisConnect(); | |||
| if (!Utility.BinDeserialize(m_buf, out o)) | |||
| return ErrCode.FailDeserial; | |||
| return ErrCode.Success; | |||
| } | |||
| } | |||
| } | |||
| @@ -10,24 +10,30 @@ namespace StuMgmClient | |||
| { | |||
| class SystemCtrl | |||
| { | |||
| internal static ErrCode VerifLogin(short userName, string pawssword, out LvErr role, out int token) | |||
| internal static ErrCode VerifLogin(short userName, string pawssword, out Lvl role, out int token) | |||
| { | |||
| role = LvErr.Error; | |||
| LoginResponse lr = new LoginResponse(); | |||
| role = Lvl.Error; | |||
| token = 0; | |||
| UserInfo cs = new UserInfo(userName, pawssword); | |||
| ClientRequest req = new ClientRequest(ClientFunc.VerifLogin, cs); | |||
| UserInfoLogin cs = new UserInfoLogin(userName, pawssword); | |||
| ClientRequest req = new ClientRequest(ClientFunc.VerifyLogin, cs); | |||
| ServerResponse o = new ServerResponse(null); | |||
| ErrCode err = SystemComm.GetData(req, out o); | |||
| if (err != ErrCode.Success) | |||
| return err; | |||
| //if (!(o.Object is UserInfo)) | |||
| // return ErrCode.ErrData; | |||
| role = o.Lev; | |||
| token = o.Token; | |||
| if (!(o.Object is LoginResponse)) | |||
| return ErrCode.ErrData; | |||
| if (!o.Final) | |||
| { | |||
| Debug.Print(o.ErrMessage); | |||
| return ErrCode.ErrData; | |||
| } | |||
| lr=(LoginResponse)o.Object; | |||
| role = lr.Level; | |||
| token = lr.Token; | |||
| return ErrCode.Success; | |||
| } | |||
| @@ -45,6 +51,11 @@ namespace StuMgmClient | |||
| if (!(o.Object is List<CourseInfo>)) | |||
| return ErrCode.ErrData; | |||
| if (!o.Final) | |||
| { | |||
| Debug.Print(o.ErrMessage); | |||
| return ErrCode.ErrData; | |||
| } | |||
| courseInfo = (List<CourseInfo>)o.Object; | |||
| return ErrCode.Success; | |||
| } | |||
| @@ -65,13 +76,34 @@ namespace StuMgmClient | |||
| return ErrCode.Success; | |||
| } | |||
| internal static ErrCode SendUserCourseInfoOper(UserCourseInfoOper uo) | |||
| { | |||
| //****** | |||
| ClientRequest req = new ClientRequest(ClientFunc.SUpdateCourse, uo); | |||
| ServerResponse o = new ServerResponse(null); | |||
| ErrCode err = SystemComm.sendData(req, out o); | |||
| if (err != ErrCode.Success) | |||
| return err; | |||
| //if (!(o.Object is List<CourseInfo>)) | |||
| // return ErrCode.ErrData; | |||
| if (!o.Final) | |||
| { | |||
| Debug.Print(o.ErrMessage); | |||
| return ErrCode.ErrData; | |||
| } | |||
| return ErrCode.Success; | |||
| } | |||
| static ErrCode GetUserCourseInfo(short job_id, int token, out UserCourseInfo info) | |||
| { | |||
| info = null; | |||
| Dictionary<short, int> dic = new Dictionary<short, int>(); | |||
| dic.Add(job_id, token); | |||
| ClientRequest req = new ClientRequest(ClientFunc.GetUserCourseInfo, dic); | |||
| UserCourseInfoReq infoRe = new UserCourseInfoReq(); | |||
| infoRe.Job_Id = job_id; | |||
| infoRe.Token = token; | |||
| ClientRequest req = new ClientRequest(ClientFunc.GetSelfUserCourseInfo, infoRe); | |||
| ServerResponse o = new ServerResponse(null); | |||
| ErrCode err = SystemComm.GetData(req, out o); | |||
| if (err != ErrCode.Success) | |||
| @@ -85,7 +117,6 @@ namespace StuMgmClient | |||
| info = (UserCourseInfo)o.Object; | |||
| return ErrCode.Success; | |||
| } | |||
| internal static DataTable GetTable() | |||
| { | |||
| return SystemData.StreeTable(); | |||
| @@ -152,5 +152,6 @@ namespace StuMgmClient | |||
| { | |||
| return allCourseStatus; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| using StuMgmLib.MyNameSpace; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Diagnostics; | |||
| using System.IO; | |||
| using System.Runtime.Serialization.Formatters.Binary; | |||
| @@ -8,6 +9,7 @@ namespace StuMgmClient | |||
| { | |||
| class Utility | |||
| { | |||
| //序列化 | |||
| internal static bool BinSerialize<T>(T data, out byte[] buff) | |||
| { | |||
| try | |||
| @@ -25,7 +27,7 @@ namespace StuMgmClient | |||
| return false; | |||
| } | |||
| } | |||
| //反序列化 | |||
| internal static bool BinDeserialize(byte[] data, out ServerResponse o) | |||
| { | |||
| try | |||
| @@ -42,5 +44,16 @@ namespace StuMgmClient | |||
| return false; | |||
| } | |||
| } | |||
| //字典转字符串 | |||
| internal static string DicParsing(Dictionary<short, CourseStatusEnum> dic) | |||
| { | |||
| string stateText = ""; | |||
| foreach (var item in dic) | |||
| { | |||
| stateText = stateText + item.Key.ToString() + ":" + ((int)item.Value).ToString() + ";"; | |||
| } | |||
| return stateText; | |||
| } | |||
| } | |||
| } | |||
| @@ -16,14 +16,17 @@ namespace StuMgmLib.MyNameSpace | |||
| FailReceive, | |||
| ErrData, | |||
| } | |||
| public enum ClientFunc | |||
| { | |||
| VerifLogin = 1, | |||
| GetCourseInfo, | |||
| GetUserCourseInfo, | |||
| VerifyLogin = 1, | |||
| GetCourseInfo = 2, | |||
| GetSelfUserCourseInfo = 3, | |||
| SUpdateCourse = 4, | |||
| TUpdateCourse = 5, | |||
| GetSomeoneUserCInfo = 6, | |||
| } | |||
| public enum LvErr | |||
| public enum Lvl | |||
| { | |||
| NotFound = -1, | |||
| Error = -2, | |||
| @@ -31,7 +34,7 @@ namespace StuMgmLib.MyNameSpace | |||
| Teacher = 2, | |||
| Student = 3, | |||
| } | |||
| [Serializable] | |||
| public class ClientRequest | |||
| { | |||
| @@ -45,34 +48,36 @@ namespace StuMgmLib.MyNameSpace | |||
| } | |||
| [Serializable] | |||
| public class UserInfo | |||
| public class UserInfoLogin | |||
| { | |||
| public short Account; | |||
| public string Password; | |||
| public Int16 Token; | |||
| public LvErr UserLev; | |||
| public UserInfo(short account, string password) | |||
| public UserInfoLogin(short account, string password) // Changed | |||
| { | |||
| Account = account; | |||
| Password = password; | |||
| } | |||
| } | |||
| [Serializable] | |||
| public class CourseInfo | |||
| public class UserCourseInfoReq | |||
| { | |||
| public short Id; | |||
| public short Pid; | |||
| public int Time; | |||
| public string Name; | |||
| public string Content; | |||
| public short Job_Id; | |||
| public int Token; | |||
| } | |||
| [Serializable] | |||
| public class UserCourseInfoOper // T represents teacher, S ->student | |||
| { | |||
| public short Job_Id; | |||
| public int Token; | |||
| public string Status; // 课程状态 | |||
| } | |||
| [Serializable] | |||
| public enum CourseStatusEnum | |||
| { | |||
| Null = 0, | |||
| NoStart, | |||
| NoStart=0, | |||
| Begin, | |||
| WaitCheckig, | |||
| CheckigSuccess, | |||
| @@ -80,22 +85,12 @@ namespace StuMgmLib.MyNameSpace | |||
| // | |||
| } | |||
| [Serializable] | |||
| public class UserCourseInfo | |||
| { | |||
| public short JobId;//工号 | |||
| public string Name;//姓名 | |||
| public string Status; // 课程状态 | |||
| public string Details;//信息描述 | |||
| } | |||
| [Serializable] | |||
| public class ServerResponse | |||
| { | |||
| public LvErr Lev; | |||
| public int Token; | |||
| public string CourseStatus; | |||
| public bool Final;//操作是否成功 | |||
| public string ErrMessage;//错误信息 | |||
| public object Object; | |||
| public ServerResponse(object obj) | |||
| { | |||
| @@ -103,6 +98,32 @@ namespace StuMgmLib.MyNameSpace | |||
| } | |||
| } | |||
| [Serializable] | |||
| public class LoginResponse | |||
| { | |||
| public int Token; | |||
| public Lvl Level; | |||
| } | |||
| [Serializable] | |||
| public class CourseInfo | |||
| { | |||
| public short Id; | |||
| public short Pid; | |||
| public int Time; | |||
| public string Name; | |||
| public string Content; | |||
| } | |||
| [Serializable] | |||
| public class UserCourseInfo | |||
| { | |||
| public short JobId;//工号 | |||
| public string Name;//姓名 | |||
| public string Status; // 课程状态 | |||
| public string Details;//信息描述 | |||
| } | |||
| public class UserCourseDetail | |||
| { | |||
| public short Id; | |||
| @@ -112,5 +133,7 @@ namespace StuMgmLib.MyNameSpace | |||
| public int Status; | |||
| public List<UserCourseDetail> Children; | |||
| } | |||
| } | |||