public void SendJG(string reserveId, string coachId, string courseId, string currentUserId) { try { var user = UserHelper.GetUserById(reserveId); var studentName = UserHelper.GetUserName(user); //教学管理员, 给学员和教练都发系统消息 //发给教练 string message = string.Format("[教学管理员]修改了你的课程预约, 请查看"); Dictionary <string, object> extrasToCoach = new Dictionary <string, object>(); extrasToCoach.Add("Type", SystemMessageType.CoachReservedCourseDetail); extrasToCoach.Add("BusinessId", courseId); extrasToCoach.Add("Message", message); JPushHelper.SendCourseSystemMessage(extrasToCoach, coachId); //发给学员 Dictionary <string, object> extrasToStudent = new Dictionary <string, object>(); extrasToStudent.Add("Type", SystemMessageType.StudentReservedCourseDetail); extrasToStudent.Add("BusinessId", courseId); extrasToStudent.Add("Message", message); JPushHelper.SendCourseSystemMessage(extrasToStudent, reserveId); } catch (Exception) { } }
public void SendJG(string reserveId, string coachId, string currentUserId) { try { var user = UserHelper.GetUserById(reserveId); var studentName = UserHelper.GetUserName(user); if (currentUserId != SystemDic.SystemManagerId)//普通用户 { //普通用户, 给教练 发系统消息 Dictionary <string, object> extras = new Dictionary <string, object>(); extras.Add("Type", SystemMessageType.DoNotJump); extras.Add("Message", string.Format("[{0}]取消了对你课程的预约", studentName)); JPushHelper.SendCourseSystemMessage(extras, coachId); } else if (currentUserId == SystemDic.SystemManagerId) { //系统管理员, 给学员和教练都发系统消息 //发给教练 string message = string.Format("[系统管理员]取消了你课程的预约"); Dictionary <string, object> extrasToCoach = new Dictionary <string, object>(); extrasToCoach.Add("Type", SystemMessageType.DoNotJump); extrasToCoach.Add("Message", message); JPushHelper.SendCourseSystemMessage(extrasToCoach, coachId); //发给学员 Dictionary <string, object> extrasToStudent = new Dictionary <string, object>(); extrasToStudent.Add("Type", SystemMessageType.DoNotJump); extrasToStudent.Add("Message", message); JPushHelper.SendCourseSystemMessage(extrasToStudent, reserveId); } } catch (Exception) { } }
public void SendJG(string reserveId, string coachId, string courseId) { try { var user = UserHelper.GetUserById(reserveId); var studentName = UserHelper.GetUserName(user); Dictionary <string, object> extras = new Dictionary <string, object>(); extras.Add("Type", SystemMessageType.CoachReservedCourseDetail); extras.Add("BusinessId", courseId); extras.Add("Message", string.Format("[{0}]学员预约了你的课程, 请查看", studentName)); JPushHelper.SendCourseSystemMessage(extras, coachId); } catch (Exception) { } }
public Response Execute(User currentUser, string request) { var req = JsonConvert.DeserializeObject <Request <GetCoachRelatedFilter> >(request); string sql = @" SELECT a.* , b.TrainingPlanContent FROM dbo.UserAccount a LEFT JOIN dbo.CoachTrainingPlan b ON a.Id=b.StudentId AND b.CoachId=@CoachId WHERE a.Id=@Id "; var cmd = CommandHelper.CreateText <User>(FetchType.Fetch, sql); cmd.Params.Add("@Id", req.Filter.StudentId); cmd.Params.Add("@CoachId", req.Filter.CurrentUserId); var result = DbContext.GetInstance().Execute(cmd); var user = result.FirstEntity <User>(); user.CardName = UserHelper.GetUserName(user); return(result); }
public Response Execute(User currentUser, string request) { var req = JsonConvert.DeserializeObject <Request <CoachCourse> >(request); Response rsp = ResultHelper.CreateResponse(); var obj = req.FirstEntity(); //获取课程信息 var coachCourse = GetCoachCourse(obj); if (coachCourse == null) { //如果不存在, 说明是首次通过集训模板课程创建实际课程的情况, 那就去创建一个实际课程 coachCourse = CreateActualCoachCourse(obj); } obj.Id = coachCourse.Id;//补全Id //删除之前的学员列表并返还次数 DeleteOldStudentList(obj); //如果学员列表为空就删除此课程 if (obj.CoursePersonInfoList.Count == 0) { return(DeleteCoachCourse(obj)); } //保存新的学员列表 foreach (var personInfo in obj.CoursePersonInfoList) { personInfo.CourseId = obj.Id; User user = UserHelper.GetUserById(personInfo.YdlUserId); personInfo.StudentName = UserHelper.GetUserName(user); personInfo.StudentMobile = user.Mobile; //插入一个学员 SystemHelper.Instance.InsertEntity(personInfo); //扣除一次学员的集训余额 CoachHelper.Instance.SubBootcampBalanceOne(personInfo.YdlUserId, obj.CoachBootcampId); } rsp.Tag = obj.Id; return(rsp); }
public Response Execute(User currentUser, string request) { var req = JsonConvert.DeserializeObject <Request <GetCoachRelatedFilter> >(request); //先获取教练有哪些学员 var cmd = CommandHelper.CreateProcedure <CoachStudentMoney>(text: "GetCoachStudentList"); cmd.Params.Add("@CoachId", req.Filter.CoachId);//(不传教练Id是获取所有学员) cmd.Params.Add("@Name", req.Filter.StudentName); cmd.CreateParamPager(req.Filter); var result = DbContext.GetInstance().Execute(cmd); result.SetRowCount(); List <CoachStudent> studentList = new List <CoachStudent>(); foreach (var item in result.Entities) { CoachStudent coachStudent = new CoachStudent(); var StudentUserId = (item as CoachStudentMoney).StudentUserId; //获取学员的基本信息 var user = UserHelper.GetUserById(StudentUserId); if (user == null) { continue; } coachStudent.HeadUrl = user.HeadUrl; coachStudent.Name = UserHelper.GetUserName(user); coachStudent.Sex = user.Sex; coachStudent.Id = StudentUserId; //获取学员的余额信息 GetBalance(coachStudent, StudentUserId, req.Filter.CoachId); studentList.Add(coachStudent); } result.Entities.Clear(); result.Entities.AddRange(studentList); return(result); }
public Response Execute(User currentUser, string request) { var req = JsonConvert.DeserializeObject <Request <GetCoachRelatedFilter> >(request); Response rsp = new Response(); //附近的一个场馆 CoachCourse coachCourse = new CoachCourse(); coachCourse.Venue = GetVenue(req); //课时列表 List <SysDic> list = new List <SysDic>(); list.Add(new SysDic() { CourseCount = 10 }); list.Add(new SysDic() { CourseCount = 30 }); list.Add(new SysDic() { CourseCount = 50 }); coachCourse.CourseCountList = list; rsp.IsSuccess = true; rsp.Entities.Add(coachCourse); //个人信息 coachCourse.StudentName = UserHelper.GetUserName(currentUser); var user = UserHelper.GetUserById(currentUser.Id); if (user != null) { coachCourse.StudentMobile = user.Mobile; } return(rsp); }
public Coach GetCoach(string userId) { var sql = @" SELECT * FROM dbo.Coach WHERE Id=@userId "; var cmd = CommandHelper.CreateText <Coach>(FetchType.Fetch, sql); cmd.Params.Add("@userId", userId); var result = DbContext.GetInstance().Execute(cmd); var obj = result.FirstEntity <Coach>(); if (obj != null) { User user = UserHelper.GetUserById(obj.Id); if (user != null) { obj.Name = UserHelper.GetUserName(user); } } return(result.FirstEntity <Coach>()); }