private WXResponseMsgBase 查看预约(string publicWX, WXRequestMsg msg) { string response = string.Empty; var wx = WXManager.Current[publicWX]; var sid = new WXBindingBLL(wx.DBConnect).GetBindingStudentID(msg.FromUserName, msg.ToUserName); if (string.IsNullOrEmpty(sid)) { return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, "您还没有绑定学号,请先绑定学号")); } var client = new 中国美院接口Client("http://120.78.230.233:8081"); var ret = client.获取预约信息(sid); if (ret.Code == 0 && ret.预约信息 != null && ret.预约信息.Length > 0) { var sb = new StringBuilder(); sb.AppendLine("你已经预约如下这些项目:"); sb.AppendLine("----------------------------------------"); foreach (var item in ret.预约信息) { sb.AppendLine(string.Format("{0} 日期{1}", item.项目名称, item.测试日期.ToString("yyyy-MM-dd"))); } sb.AppendLine("----------------------------------------"); response = sb.ToString(); } else { response = "你没有可预约项目"; } return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, response)); }
private WXResponseMsgBase 查询绑定(string publicWX, WXRequestMsg msg) { string response = _DefaultResponse; var sid = new WXBindingBLL(WXManager.Current[publicWX].DBConnect).GetBindingStudentID(msg.FromUserName, msg.ToUserName); if (string.IsNullOrEmpty(sid)) { response = "您还没有绑定学号。"; } else { var s = new StudentBLL(WXManager.Current[publicWX].DBConnect).GetByID(sid).QueryObject; if (s == null) { response = string.Format("学号:{0}\n{1}", sid, "没有找到学生信息"); } else { StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Format("学号:{0}", s.ID)); sb.AppendLine(string.Format("姓名:{0}", s.Name)); if (s.Grade.HasValue) { sb.AppendLine(string.Format("年级:{0}", GradeHelper.Instance.GetName(s.Grade.Value))); } if (!string.IsNullOrEmpty(s.ClassName)) { sb.AppendLine(string.Format("班级:{0}", s.ClassName)); } response = sb.ToString(); } } return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, response)); }
private WXResponseMsgBase 预约测试(string publicWX, WXRequestMsg msg) { string response = string.Empty; var wx = WXManager.Current[publicWX]; var sid = new WXBindingBLL(wx.DBConnect).GetBindingStudentID(msg.FromUserName, msg.ToUserName); if (string.IsNullOrEmpty(sid)) { return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, "您还没有绑定学号,请先绑定学号")); } if (!string.IsNullOrEmpty(msg.Content)) { DateTime dt; if (msg.Content.Length >= 10) { var dttemp = msg.Content.Substring(0, 8); if (DateTime.TryParseExact(dttemp, "yyyyMMdd", null, System.Globalization.DateTimeStyles.None, out dt)) { var sheme = msg.Content.Substring(9); var client = new 中国美院接口Client("http://120.78.230.233:8081"); var ret = client.预约(sid, dt, sheme); if (ret.Code == 0) { response = "预约成功!"; } else { response = "预约失败"; } } } else { response = "输入的日期格式不正确,请重新输入"; } } else { var client = new 中国美院接口Client("http://120.78.230.233:8081"); var ret = client.获取可预约项目(sid); if (ret.Code == 0 && ret.Scores != null && ret.Scores.Length > 0) { var sb = new StringBuilder(); sb.AppendLine("你可以预约如下这些项目:"); sb.AppendLine("----------------------------------------"); foreach (var item in ret.Scores) { sb.AppendLine(string.Format("{0} 编号{1}", item.项目名称, item.编号)); } sb.AppendLine("----------------------------------------"); sb.AppendLine("预约请发送 年月日+项目编号 如:20180101+7"); response = sb.ToString(); } else { response = "你没有可预约项目"; } } return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, response)); }
private WXResponseMsgBase 取消绑定(string publicWX, WXRequestMsg msg) { string response = _DefaultResponse; var ret = new WXBindingBLL(WXManager.Current[publicWX].DBConnect).UnRegister(msg.FromUserName, msg.ToUserName); if (ret.Result == ResultCode.Successful) { response = "你已经成功取消学号绑定"; } else { response = ret.Message; } return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, response)); }
private WXResponseMsgBase 查询二维码(string publicWX, WXRequestMsg msg) { string response = _DefaultResponse; var wx = WXManager.Current[publicWX]; var sid = new WXBindingBLL(wx.DBConnect).GetBindingStudentID(msg.FromUserName, msg.ToUserName); if (string.IsNullOrEmpty(sid)) { return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, "您还没有绑定学号,请先绑定学号")); } var s = new StudentBLL(wx.DBConnect).GetByID(sid).QueryObject; if (s == null) { return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, "没有找到学生信息")); } response = string.Format(@"点击打开二维码 http://{0}/hhcloud/qr/{1}/{2}/", _Request.RequestUri.Host, publicWX, s.ID); return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, response)); }
private WXResponseMsgBase 绑定学号(string publicWX, WXRequestMsg msg) { if (!string.IsNullOrEmpty(msg.Content)) { string sid = null; if (msg.Content.IndexOf(_regStudentID) == 0 && msg.Content.Length > _regStudentID.Length) { sid = msg.Content.Substring(_regStudentID.Length); // } else { sid = msg.Content; //通过菜单项然后输入学号 } var ret = new WXBindingBLL(WXManager.Current[publicWX].DBConnect).Register(msg.FromUserName, msg.ToUserName, sid); if (ret.Result != ResultCode.Successful) { return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, ret.Message)); } return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, string.Format("你已经成功绑定学号 {0}", sid))); } return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, "请输入你要绑定的学号")); }
private WXResponseMsgBase 查询成绩(string publicWX, WXRequestMsg msg) { string response = _DefaultResponse; var wx = WXManager.Current[publicWX]; var sid = new WXBindingBLL(wx.DBConnect).GetBindingStudentID(msg.FromUserName, msg.ToUserName); if (string.IsNullOrEmpty(sid)) { new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, "您还没有绑定学号,请先绑定学号"); } var s = new StudentBLL(wx.DBConnect).GetByID(sid).QueryObject; if (s == null) { new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, "没有找到学生信息"); } StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Format("学号:{0}", s.ID)); sb.AppendLine(string.Format("姓名:{0}", s.Name)); sb.AppendLine(string.Format("性别:{0}", s.Sex == 1 ? "男" : "女")); if (s.Grade.HasValue) { sb.AppendLine(string.Format("年级:{0}", GradeHelper.Instance.GetName(s.Grade.Value))); } if (!string.IsNullOrEmpty(s.ClassName)) { sb.AppendLine(string.Format("班级:{0}", s.ClassName)); } var con = new StudentScoreSearchCondition() { Grade = s.Grade, StudentID = s.ID, ProjectID = "TizhiCheshi" }; var scores = new StudentScoreBLL(wx.DBConnect).GetItems(con).QueryObjects; scores = (from it in scores orderby it.PhysicalItem ascending select it).ToList(); var pis = UserSettings.Current.CreateDefaultFormula(s.Grade.Value, s.Sex); if (pis != null && pis.Length > 0) { if (scores != null && scores.Count > 0) { var total = CalTotal(s.Grade.Value, scores); if (total > 0) { sb.AppendLine(string.Format("总分:{0}", total)); } var jiafen = CalJiafen(scores); if (jiafen.HasValue) { sb.AppendLine(string.Format("加分:{0}", jiafen.Value.Trim())); } sb.AppendLine("----------------------"); foreach (var score in scores) { if (pis.Contains(score.PhysicalItem)) { if (!score.Result.HasValue || score.PhysicalItem == 1 || score.PhysicalItem == 2) { sb.AppendLine(string.Format("{0}:{1}", score.PhysicalName, score.Score)); } else { sb.AppendLine(string.Format("{0}:{1}_{2}分_{3}", score.PhysicalName, score.Score, score.Result.Value.Trim(), score.Rank)); } } } } if (pis.Any(it => scores == null || !scores.Exists(sc => sc.PhysicalItem == it))) { sb.AppendLine("------------------未测试科目"); foreach (var pi in pis) { if (scores == null || !scores.Exists(it => it.PhysicalItem == pi)) { sb.AppendLine(UserSettings.Current.GetPhysicalName(pi)); } } } response = sb.ToString(); } return(new WXTextResponseMsg(msg.FromUserName, msg.ToUserName, DateTime.Now, response)); }