/// <summary> /// 陪驾 /// </summary> public void WithDrivingOrder() { try { var withdrivinglist = WithDrivingOrderBLL.Instance.GetList(new WithDrivingOrderEntity() { Status = (int)QX360.Model.Enums.PaySatus.已支付 }); if (withdrivinglist.Count > 0) { withdrivinglist.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (DateTime.Now > servicetime.AddDays(day)) { //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime); SendSysMessageBLL.SendMessage(QX360.Model.Enums.MessageAlterType.陪驾预约提示, QX360.Model.Enums.NoticeType.预约提醒, o.MemberId, o.MemberName, _servicetime, "您的陪驾预约即将到期,请按时进行陪驾服务", o.DrivingOrderNo); //发送短信 SendSmsMessageBLL.SendSubricNotice(o.MemberId, o.MemberMobile, o.MemberName, _servicetime, "您的陪驾预约即将到期,请按时进行陪驾服务", o.DrivingOrderNo); } } }); } } catch (Exception ex) { logger.Error("发送陪驾提示失败:" + ex.Message); } }
/// <summary> /// 学车 /// </summary> public void StudyOrder() { try { var studylist = StudyOrderBLL.Instance.GetList(new StudyOrderEntity() { Status = (int)RCHL.Model.Enums.StudySubscribeStatus.预约成功 }); if (studylist.Count > 0) { studylist.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { //DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString() + " " + o.ServiceTime.Split(',')[0].ToString().Split('-')[0]); DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (servicetime < DateTime.Now) { o.StudyOrderId = o.StudyOrderId; o.Status = (int)RCHL.Model.Enums.StudySubscribeStatus.预约完成; StudyOrderBLL.Instance.Update(o); //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime.TrimEnd(',')); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.学车预约提示, RCHL.Model.Enums.NoticeType.完成通知, o.MemberId, o.MemberName, _servicetime, "预约学车已完成,请前往人车APP对本次服务进行评价", o.StudyOrderNo); } } }); } } catch (Exception ex) { logger.Error("处理学车订单失败:" + ex.Message); } }
public JsonResult Cancel2(string id) { var result = new ReturnMessage(false) { Message = "操作失败!" }; try { var order = TrainingOrderBLL.Instance.GetEntity(id); TrainingOrderBLL.Instance.Cancel(id); result.IsSuccess = true; result.Message = "取消成功"; string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), order.ServiceTime.TrimEnd(',')); var trainingCar = TrainingCarBLL.Instance.GetEntity(order.TrainingCarId); string txt = string.Format("实训预约,预约车辆:{0},车牌:{1},预约机构:{2},个人原因取消预约", trainingCar.Name, trainingCar.CarNumber, order.SchoolName); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.实训预约提示, RCHL.Model.Enums.NoticeType.取消提醒, LoginTeacher.UserId, order.MemberName, servicetime, txt, order.TrainingOrderNo); } catch (Exception ex) { ex.Data["Method"] = "TrainingCarController>>Cancel"; new ExceptionHelper().LogException(ex); } return(Json(result)); }
/// <summary> /// 保险 /// </summary> public void InsuranceOrder() { try { var list = InsuranceOrderBLL.Instance.GetList(new InsuranceOrderEntity() { Status = (int)RCHL.Model.Enums.SubscribeStatus.预约成功 }); if (list.Count > 0) { list.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (servicetime < DateTime.Now) { o.InsuranceOrderId = o.InsuranceOrderId; o.Status = (int)RCHL.Model.Enums.SubscribeStatus.已完成; InsuranceOrderBLL.Instance.Update(o); //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.保险预约提示, RCHL.Model.Enums.NoticeType.完成通知, o.MemberId, o.MemberName, _servicetime, "保险预约已完成,祝您生活愉快", o.InsuranceOrderNo); } } }); } } catch (Exception ex) { logger.Error("处理保险完成订单失败:" + ex.Message); } }
/// <summary> /// 保险 /// </summary> public void InsuranceOrder() { try { var list = InsuranceOrderBLL.Instance.GetList(new InsuranceOrderEntity() { Status = (int)RCHL.Model.Enums.SubscribeStatus.预约成功 }); if (list.Count > 0) { list.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (DateTime.Now > servicetime.AddDays(day)) { //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.保险预约提示, RCHL.Model.Enums.NoticeType.预约提醒, o.MemberId, o.MemberName, _servicetime, "您的保险预约即将到期,请按时进行保险服务", o.InsuranceOrderNo); //发送短信 SendSmsMessageBLL.SendSubricNotice(o.MemberId, o.Mobile, o.MemberName, _servicetime, "您的保险预约即将到期,请按时进行保险服务", o.InsuranceOrderNo); } } }); } } catch (Exception ex) { logger.Error("发送保险提示失败:" + ex.Message); } }
public ActionResult Cancel(string keyValue) { try { string[] keys = keyValue.Split(','); if (keys != null) { bool flag = true; foreach (var key in keys) { var entity = TrainingOrderBLL.Instance.GetEntity(key); if (entity != null && entity.Status != (int)RCHL.Model.Enums.TrainingStatus.待审核) { flag = false; return(Error("非待审核状态的订单不能取消操作")); } } if (flag) { foreach (var key in keys) { TrainingOrderBLL.Instance.Cancel(key); var entity = TrainingOrderBLL.Instance.GetEntity(key); //发送取消微信通知 var _ServiceTime = ""; var detail = TrainingOrderDetailBLL.Instance.GetList(new TrainingOrderDetailEntity() { TrainingOrderId = entity.TrainingOrderId }); detail.ForEach((o) => { _ServiceTime += o.ServiceTime + ","; }); string servicetime = string.Format("{0} {1}", DateTime.Parse(entity.ServiceDate.ToString()).ToString("yyyy-MM-dd"), _ServiceTime.TrimEnd(',')); if (entity.UserType == (int)RCHL.Model.Enums.TrainingUserType.学员) { SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.实训预约提示, RCHL.Model.Enums.NoticeType.取消提醒, entity.MemberId, entity.MemberName, servicetime, "预约实训,该实训订单已取消,请重新预约", entity.TrainingOrderNo); } else if (entity.UserType == (int)RCHL.Model.Enums.TrainingUserType.教练) { SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.取消提醒, entity.MemberId, servicetime, "预约实训,该实训订单已取消,请重新预约", entity.TrainingOrderNo); } } } } return(Success("操作成功")); } catch (Exception ex) { ex.Data["Method"] = "TrainingOrderController>>Cancel"; new ExceptionHelper().LogException(ex); return(Error("操作失败")); } }
public JsonResult Cancel(string id) { var result = new ReturnMessage(false) { Message = "操作失败!" }; try { //判断取消的权限 int lev = 0; int.TryParse(LoginUser.MemberLevId, out lev); var order = StudyOrderBLL.Instance.GetEntity(id); DateTime orderdatetime = DateTime.Now; if (order != null) { orderdatetime = DateTime.Parse(order.CreateTime.ToString()); } int space = 0; switch (lev) { case (int)RCHL.Model.Enums.UserType.预约记时会员: int.TryParse(SettingsBLL.Instance.GetValue("canoffordertime_normal"), out space); break; case (int)RCHL.Model.Enums.UserType.VIP会员: int.TryParse(SettingsBLL.Instance.GetValue("canoffordertime_vip"), out space); break; } if (DateTime.Now > orderdatetime.AddHours(space)) { result.Message = string.Format("该订单已无法取消,只能取消{0}小时内的预约", space); return(Json(result)); } StudyOrderBLL.Instance.Cancel(id); result.IsSuccess = true; result.Message = "取消成功"; string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), order.ServiceTime.TrimEnd(',')); var teacher = TeacherBLL.Instance.GetEntity(order.TeacherId); string txt = string.Format("预约学车,预约人:{0},联系电话:{1},预约机构:{2},个人原因取消预约", teacher.Name, teacher.Mobile, order.SchoolName); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.学车预约提示, RCHL.Model.Enums.NoticeType.取消提醒, LoginUser.UserId, order.MemberName, servicetime, txt, order.StudyOrderNo); } catch (Exception ex) { ex.Data["Method"] = "StudyController>>Cancel"; new ExceptionHelper().LogException(ex); } return(Json(result)); }
public JsonResult CreateOrder(string data) { var result = new ReturnMessage(false) { Message = "创建订单失败!" }; try { lock (objLock) { var order = JsonConvert.DeserializeObject <TakeAuditOrderEntity>(data); if (order == null) { return(Json(result)); } order.TakeAuditOrderId = Util.NewUpperGuid(); order.TakeAuditOrderNo = TakeAuditOrderBLL.Instance.GetOrderNo(); order.CreateTime = DateTime.Now; order.Status = (int)Model.Enums.PaySatus.待支付; order.MemberId = LoginUser == null ? "" : LoginUser.UserId; TakeAuditOrderBLL.Instance.Add(order); result.IsSuccess = true; result.Message = "创建成功"; if (LoginUser != null) { //写消息 string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), order.ServiceTime); string txt = "预约代审,检测机构:" + order.OrganizationName; SendSysMessageBLL.SendMessage(QX360.Model.Enums.MessageAlterType.代审预约提示, QX360.Model.Enums.NoticeType.预约提醒, LoginUser.UserId, order.MemberName, servicetime, txt, order.TakeAuditOrderNo); //送积分 GivePointBLL.GivePoint(QX360.Model.Enums.OperationType.预约代审完成, LoginUser.UserId, double.Parse(order.Price.ToString()), order.TakeAuditOrderNo); } } } catch (Exception ex) { ex.Data["Method"] = "TakeAuditController>>CreateOrder"; new ExceptionHelper().LogException(ex); } return(Json(result)); }
public JsonResult CreateOrder(string data) { var result = new ReturnMessage(false) { Message = "创建订单失败!" }; try { lock (objLock) { var order = JsonConvert.DeserializeObject <SeeCarOrderEntity>(data); if (order == null) { return(Json(result)); } order.SeeCarOrderId = Util.NewUpperGuid(); order.SeeCarOrderNo = SeeCarOrderBLL.Instance.GetOrderNo(); order.CreateTime = DateTime.Now; order.Status = (int)Model.Enums.SubscribeStatus.预约成功; SeeCarOrderBLL.Instance.Add(order); result.IsSuccess = true; result.Message = "创建成功"; //写消息 string content = string.Format("车辆型号{0}", order.ShopCarName); string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), order.ServiceTime); SendSysMessageBLL.SendMessage(QX360.Model.Enums.MessageAlterType.车预约提示, QX360.Model.Enums.NoticeType.预约提醒, LoginUser.UserId, order.MemberName, servicetime, content, order.SeeCarOrderNo); } } catch (Exception ex) { ex.Data["Method"] = "ShopController>>CreateOrder"; new ExceptionHelper().LogException(ex); } return(Json(result)); }
public JsonResult CreateOrder(string data) { var result = new ReturnMessage(false) { Message = "创建订单失败!" }; try { lock (objLock) { var order = JsonConvert.DeserializeObject <StudyOrderEntity>(data); if (order == null) { result.Message = "无效对象"; return(Json(result)); } if (order.DetailList == null || order.DetailList.Count == 0) { result.Message = "请选择预约时间"; return(Json(result)); } var member = MemberBLL.Instance.GetEntity(LoginUser.UserId); if (member == null) { result.Message = "会员对象无效"; return(Json(result)); } //验证时间段是否有预约 var hasflag = false; foreach (var item in order.DetailList) { var freetime = StudyFreeTimeBLL.Instance.GetEntity(item.StudyFreeTimeId); if (freetime != null) { if (freetime.FreeStatus != (int)RCHL.Model.Enums.FreeTimeStatus.空闲) { hasflag = true; break; } } } if (hasflag) { result.Message = "您下手晚了,请重新选择预约时间"; return(Json(result)); } //判断课时是否还有 if (order.DetailList != null) { int hour1 = 0; int hour2 = 0; foreach (var item in order.DetailList) { if (item.TimeType == (int)RCHL.Model.Enums.WorkTimeType.白班) { hour1++; } else if (item.TimeType == (int)RCHL.Model.Enums.WorkTimeType.夜班) { hour2++; } } if ((member.StudyHour1 ?? 0) < hour1) { result.Message = "白班课时不足,预约此时段失败"; return(Json(result)); } if ((member.StudyHour2 ?? 0) < hour2) { result.Message = "夜班课时不足,预约此时段失败"; return(Json(result)); } } //判断是否存在有未评价的订单 var commitcount = StudyOrderBLL.Instance.GetList(new StudyOrderEntity() { MemberId = LoginUser.UserId, Status = (int)RCHL.Model.Enums.StudySubscribeStatus.预约完成 }).Count(); if (commitcount > 0) { result.Message = "请先对上次学车订单进行评价后再次预约学习"; return(Json(result)); } order.StudyOrderId = Util.NewUpperGuid(); order.StudyOrderNo = StudyOrderBLL.Instance.GetOrderNo(); order.CreateTime = DateTime.Now; order.Status = (int)Model.Enums.StudySubscribeStatus.预约成功; order.MemberId = LoginUser.UserId; order.MemberName = LoginUser.NickName; order.MemberMobile = LoginUser.Mobile; string _ServiceTime = ""; if (StudyOrderBLL.Instance.Add(order)) { if (order.DetailList != null) { foreach (var item in order.DetailList) { StudyOrderDetailEntity detail = new StudyOrderDetailEntity(); detail.StudyOrderDetailId = Util.NewUpperGuid(); detail.TimeType = item.TimeType; detail.ServiceTime = item.ServiceTime; detail.ServiceDate = item.ServiceDate; detail.StudyOrderId = order.StudyOrderId; detail.StudyFreeTimeId = item.StudyFreeTimeId; if (StudyOrderDetailBLL.Instance.Add(detail)) { _ServiceTime += detail.ServiceTime + ","; //修改预约时间状态 StudyFreeTimeEntity freetime = new StudyFreeTimeEntity(); freetime.StudyFreeTimeId = detail.StudyFreeTimeId; freetime.FreeStatus = (int)RCHL.Model.Enums.FreeTimeStatus.已预约; StudyFreeTimeBLL.Instance.Update(freetime); //修改对应课时 if (detail.TimeType == (int)RCHL.Model.Enums.WorkTimeType.白班) { member.MemberId = LoginUser.UserId; member.StudyHour1 = member.StudyHour1 - 1; MemberBLL.Instance.Update(member); } else if (detail.TimeType == (int)RCHL.Model.Enums.WorkTimeType.夜班) { member.MemberId = LoginUser.UserId; member.StudyHour2 = member.StudyHour2 - 1; MemberBLL.Instance.Update(member); } } } } } result.IsSuccess = true; result.Message = "创建成功"; //写消息 string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), _ServiceTime.TrimEnd(',')); var teacher = TeacherBLL.Instance.GetEntity(order.TeacherId); string txt = string.Format("预约学车,预约人:{0},联系电话:{1},预约机构:{2}", teacher.Name, teacher.Mobile, order.SchoolName); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.学车预约提示, RCHL.Model.Enums.NoticeType.预约提醒, LoginUser.UserId, order.MemberName, servicetime, txt, order.StudyOrderNo); txt = string.Format("预约学车,预约人:{0},联系电话:{1}", order.MemberName, order.MemberMobile); SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, teacher.TeacherId, servicetime, txt, order.StudyOrderNo); //送积分 GivePointBLL.GivePoint(RCHL.Model.Enums.OperationType.预约学车完成, LoginUser.UserId, 0, order.StudyOrderNo); } } catch (Exception ex) { ex.Data["Method"] = "StudyController>>CreateOrder"; new ExceptionHelper().LogException(ex); } return(Json(result)); }
public JsonResult CreateOrder(string data, string freetimeid) { var result = new ReturnMessage(false) { Message = "创建订单失败!" }; try { lock (objLock) { var order = JsonConvert.DeserializeObject <WithDrivingOrderEntity>(data); if (order == null) { return(Json(result)); } //验证时间段是否有预约 var freetime = WithDrivingFreeTimeBLL.Instance.GetEntity(freetimeid); if (freetime != null) { if (freetime.FreeStatus != (int)RCHL.Model.Enums.FreeTimeStatus.空闲) { result.Message = "您下手晚了,请重新选择预约时间"; return(Json(result)); } } order.DrivingOrderId = Util.NewUpperGuid(); order.DrivingOrderNo = WithDrivingOrderBLL.Instance.GetOrderNo(); order.CreateTime = DateTime.Now; order.Status = (int)Model.Enums.PaySatus.已支付; if (WithDrivingOrderBLL.Instance.Add(order)) { //更改时间状态 freetime = new WithDrivingFreeTimeEntity(); freetime.WithDrivingFreeTimeId = freetimeid; freetime.FreeStatus = (int)RCHL.Model.Enums.FreeTimeStatus.已预约; WithDrivingFreeTimeBLL.Instance.Update(freetime); } result.IsSuccess = true; result.Message = "创建成功"; //写消息 string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), order.ServiceTime); var teacher = TeacherBLL.Instance.GetEntity(order.TeacherId); if (teacher != null) { string content = string.Format("预约陪驾,所需费用:{1},陪驾教练:{2},联系电话:{3},陪驾车辆:{0}", order.IsBandCar == 1 ? "教练提供" : "个人提供", order.Price, teacher.Name, teacher.Mobile); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.陪驾预约提示, RCHL.Model.Enums.NoticeType.预约提醒, LoginUser.UserId, order.MemberName, servicetime, content, order.DrivingOrderNo); //对象陪驾教练发送消息 content = string.Format("预约陪驾,所需费用:{1},陪驾车辆:{0},预约人:{2},联系电话:{3}", order.IsBandCar == 1 ? "教练提供" : "个人提供", order.Price, order.MemberName, order.MemberMobile); SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, order.TeacherId, servicetime, content, order.DrivingOrderNo); } //送积分 GivePointBLL.GivePoint(RCHL.Model.Enums.OperationType.预约陪驾完成, LoginUser.UserId, double.Parse(order.Price.ToString()), order.DrivingOrderNo); } } catch (Exception ex) { ex.Data["Method"] = "WithDrivingController>>CreateOrder"; new ExceptionHelper().LogException(ex); } return(Json(result)); }
/// <summary> /// 代审 /// </summary> public void TakeAuditOrder() { try { var list = TakeAuditOrderBLL.Instance.GetList(new TakeAuditOrderEntity() { Status = (int)RCHL.Model.Enums.PaySatus.待支付 }); if (list.Count > 0) { list.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (servicetime < DateTime.Now) { o.TakeAuditOrderId = o.TakeAuditOrderId; o.Status = (int)RCHL.Model.Enums.PaySatus.已取消; TakeAuditOrderBLL.Instance.Update(o); //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.代审预约提示, RCHL.Model.Enums.NoticeType.取消提醒, o.MemberId, o.MemberName, _servicetime, "代审预约未支付,系统已自动取消,请重新预约", o.TakeAuditOrderNo); } } }); } } catch (Exception ex) { logger.Error("处理代审取消订单失败:" + ex.Message); } try { var list = TakeAuditOrderBLL.Instance.GetList(new TakeAuditOrderEntity() { Status = (int)RCHL.Model.Enums.PaySatus.已支付 }); if (list.Count > 0) { list.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (servicetime < DateTime.Now) { o.TakeAuditOrderId = o.TakeAuditOrderId; o.Status = (int)RCHL.Model.Enums.PaySatus.已完成; TakeAuditOrderBLL.Instance.Update(o); //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime); SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.代审预约提示, RCHL.Model.Enums.NoticeType.完成通知, o.MemberId, o.MemberName, _servicetime, "代审预约已完成,请前往人车APP对本次服务进行评价", o.TakeAuditOrderNo); } } }); } } catch (Exception ex) { logger.Error("处理代审完成订单失败:" + ex.Message); } }
public ActionResult ChangeTime(string keyValue, string json) { try { var detaillist = Serializer.DeserializeJson <List <TrainingOrderDetailEntity> >(json, true); if (detaillist != null && detaillist.Count == 0) { return(Error("请选择预约时间")); } var entity = TrainingOrderBLL.Instance.GetEntity(keyValue); if (entity != null) { var _OldServiceTime = ""; var _OldServiceDate = ""; //修改之前状态 var olddetail = TrainingOrderDetailBLL.Instance.GetList(new TrainingOrderDetailEntity() { TrainingOrderId = entity.TrainingOrderId }); olddetail.ForEach((o) => { //更改之前预约时间状态 TrainingFreeTimeEntity freetime = new TrainingFreeTimeEntity(); freetime.TrainingFreeTimeId = o.TrainingFreeTimeId; freetime.FreeStatus = (int)RCHL.Model.Enums.FreeTimeStatus.空闲; TrainingFreeTimeBLL.Instance.Update(freetime); //删除明细 TrainingOrderDetailBLL.Instance.Delete(o.TrainingOrderDetailId); _OldServiceTime += o.ServiceTime + ","; _OldServiceDate = DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"); }); //插入新的预约 var _ServiceTime = ""; foreach (var item in detaillist) { TrainingOrderDetailEntity detail = new TrainingOrderDetailEntity(); detail.TrainingOrderDetailId = Util.Util.NewUpperGuid(); detail.ServiceTime = item.ServiceTime; detail.ServiceDate = item.ServiceDate; detail.TrainingOrderId = entity.TrainingOrderId; detail.TrainingFreeTimeId = item.TrainingFreeTimeId; if (TrainingOrderDetailBLL.Instance.Add(detail)) { _ServiceTime += detail.ServiceTime + ","; //修改预约时间状态 TrainingFreeTimeEntity freetime = new TrainingFreeTimeEntity(); freetime.TrainingFreeTimeId = detail.TrainingFreeTimeId; freetime.FreeStatus = (int)RCHL.Model.Enums.FreeTimeStatus.已预约; TrainingFreeTimeBLL.Instance.Update(freetime); } } //发送取消微信通知 string servicetime = string.Format("{0} {1}", DateTime.Parse(entity.ServiceDate.ToString()).ToString("yyyy-MM-dd"), _ServiceTime.TrimEnd(',')); string text = "预约实训,预约时间调整,原预约时间:" + string.Format("{0} {1}", _OldServiceDate.ToString(), _OldServiceTime.TrimEnd(',')); if (entity.UserType == (int)RCHL.Model.Enums.TrainingUserType.学员) { SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.实训预约提示, RCHL.Model.Enums.NoticeType.更改提醒, entity.MemberId, entity.MemberName, servicetime, text, entity.TrainingOrderNo); } else if (entity.UserType == (int)RCHL.Model.Enums.TrainingUserType.教练) { SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, entity.MemberId, servicetime, text, entity.TrainingOrderNo); } } return(Success("操作成功")); } catch (Exception ex) { ex.Data["Method"] = "TrainingOrderController>>ChangeTime"; new ExceptionHelper().LogException(ex); return(Error("操作失败")); } }
public ActionResult Pay(string keyValue, string json) { try { var order = Serializer.DeserializeJson <TrainingOrderEntity>(json, true); if (order == null) { return(Error("无效对象")); } var entity = TrainingOrderBLL.Instance.GetEntity(keyValue); if (entity != null) { if (entity.Status != (int)RCHL.Model.Enums.TrainingStatus.待支付) { return(Error("非待支付状态的订单不能支付操作")); } if (entity.Status == (int)RCHL.Model.Enums.TrainingStatus.待支付) { entity.Status = (int)RCHL.Model.Enums.TrainingStatus.已支付; entity.Price = order.Price; entity.CashType = order.CashType; TrainingOrderBLL.Instance.Update(entity); //插入财务表 FinaceBLL.Instance.Add(new FinaceEntity() { FinaceId = QSDMS.Util.Util.NewUpperGuid(), SourceType = (int)RCHL.Model.Enums.FinaceSourceType.实训报名, ObjectId = order.SchoolId, CreateTime = DateTime.Now, CosMoney = entity.Price, Status = (int)RCHL.Model.Enums.TrainingStatus.已支付, MemberId = entity.MemberId, MemberName = entity.MemberName, PayType = (int)RCHL.Model.Enums.PayType.线下支付, Operate = (int)RCHL.Model.Enums.FinaceOperateType.增加, Remark = string.Format("实训报名|{0}|{1}", entity.MemberName, entity.TrainingOrderNo) }); } var _ServiceTime = ""; var detail = TrainingOrderDetailBLL.Instance.GetList(new TrainingOrderDetailEntity() { TrainingOrderId = entity.TrainingOrderId }); detail.ForEach((o) => { _ServiceTime += o.ServiceTime + ","; }); string servicetime = string.Format("{0} {1}", DateTime.Parse(entity.ServiceDate.ToString()).ToString("yyyy-MM-dd"), _ServiceTime.TrimEnd(',')); if (entity.UserType == (int)RCHL.Model.Enums.TrainingUserType.学员) { SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.实训预约提示, RCHL.Model.Enums.NoticeType.预约提醒, entity.MemberId, entity.MemberName, servicetime, "预约实训,单据已付款。请按预约时间完成实训", entity.TrainingOrderNo); } else if (entity.UserType == (int)RCHL.Model.Enums.TrainingUserType.教练) { SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, entity.MemberId, servicetime, "预约实训,单据已付款。请按预约时间完成实训", entity.TrainingOrderNo); } } return(Success("操作成功")); } catch (Exception ex) { ex.Data["Method"] = "TrainingOrderController>>Pay"; new ExceptionHelper().LogException(ex); return(Error("操作失败")); } }
public ActionResult Audit(string keyValue) { try { string[] keys = keyValue.Split(','); if (keys != null) { bool flag = true; foreach (var key in keys) { var entity = TrainingOrderBLL.Instance.GetEntity(key); if (entity != null && entity.Status != (int)RCHL.Model.Enums.TrainingStatus.待审核) { flag = false; return(Error("非待审核状态的订单不能审核操作")); } } if (flag) { foreach (var key in keys) { var order = TrainingOrderBLL.Instance.GetEntity(key); if (order != null) { if (order.Status == (int)RCHL.Model.Enums.TrainingStatus.待审核) { order.Status = (int)RCHL.Model.Enums.TrainingStatus.待支付; TrainingOrderBLL.Instance.Update(order); var _ServiceTime = ""; var detail = TrainingOrderDetailBLL.Instance.GetList(new TrainingOrderDetailEntity() { TrainingOrderId = order.TrainingOrderId }); detail.ForEach((o) => { _ServiceTime += o.ServiceTime + ","; //修改预约状态为已预约 TrainingFreeTimeEntity freetime = new TrainingFreeTimeEntity(); freetime.TrainingFreeTimeId = o.TrainingFreeTimeId; freetime.FreeStatus = (int)RCHL.Model.Enums.FreeTimeStatus.已预约; TrainingFreeTimeBLL.Instance.Update(freetime); }); string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), _ServiceTime.TrimEnd(',')); if (order.UserType == (int)RCHL.Model.Enums.TrainingUserType.学员) { SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.实训预约提示, RCHL.Model.Enums.NoticeType.预约提醒, order.MemberId, order.MemberName, servicetime, "预约实训,单据已审核。请前往机构缴费完成实训", order.TrainingOrderNo); } else if (order.UserType == (int)RCHL.Model.Enums.TrainingUserType.教练) { SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, order.MemberId, servicetime, "预约实训,单据已审核。请前往机构缴费完成实训", order.TrainingOrderNo); } } } } } } return(Success("操作成功")); } catch (Exception ex) { ex.Data["Method"] = "TrainingOrderController>>Audit"; new ExceptionHelper().LogException(ex); return(Error("操作失败")); } }
/// <summary> /// 实训 /// </summary> public void TraingOrder() { try { var trainglist = TrainingOrderBLL.Instance.GetList(new TrainingOrderEntity() { Status = (int)RCHL.Model.Enums.PaySatus.待支付 }); if (trainglist.Count > 0) { trainglist.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (servicetime < DateTime.Now) { o.TrainingOrderId = o.TrainingOrderId; o.Status = (int)RCHL.Model.Enums.PaySatus.已取消; TrainingOrderBLL.Instance.Update(o); //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime.TrimEnd(',')); if (o.UserType == (int)RCHL.Model.Enums.TrainingUserType.学员) { SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.实训预约提示, RCHL.Model.Enums.NoticeType.取消提醒, o.MemberId, o.MemberName, _servicetime, "实训预约未支付,系统已自动取消,请重新预约", o.TrainingOrderNo); } else if (o.UserType == (int)RCHL.Model.Enums.TrainingUserType.教练) { SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, o.MemberId, _servicetime, "实训预约未支付,系统已自动取消,请重新预约", o.TrainingOrderNo); } } } }); } } catch (Exception ex) { logger.Error("处理实训取消订单失败:" + ex.Message); } try { var trainglist = TrainingOrderBLL.Instance.GetList(new TrainingOrderEntity() { Status = (int)RCHL.Model.Enums.PaySatus.已支付 }); if (trainglist.Count > 0) { trainglist.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (servicetime < DateTime.Now) { o.TrainingOrderId = o.TrainingOrderId; o.Status = (int)RCHL.Model.Enums.PaySatus.已完成; TrainingOrderBLL.Instance.Update(o); //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime.TrimEnd(',')); if (o.UserType == (int)RCHL.Model.Enums.TrainingUserType.学员) { SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.实训预约提示, RCHL.Model.Enums.NoticeType.完成通知, o.MemberId, o.MemberName, _servicetime, "实训预约已完成,祝您生活愉快", o.TrainingOrderNo); } else if (o.UserType == (int)RCHL.Model.Enums.TrainingUserType.教练) { SendSysMessageBLL.SendMessageTeacher(RCHL.Model.Enums.NoticeType.预约提醒, o.MemberId, _servicetime, "实训预约已完成,祝您生活愉快", o.TrainingOrderNo); } } } }); } } catch (Exception ex) { logger.Error("处理实训完成订单失败:" + ex.ToString() + ",StackTrace:" + ex.StackTrace); } }
public JsonResult CreateOrder(string data) { var result = new ReturnMessage(false) { Message = "创建订单失败!" }; try { lock (objLock) { var order = JsonConvert.DeserializeObject <TrainingOrderEntity>(data); if (order == null) { return(Json(result)); } //验证时间段是否有预约 var hasflag = false; foreach (var item in order.DetailList) { var freetime = TrainingFreeTimeBLL.Instance.GetEntity(item.TrainingFreeTimeId); if (freetime != null) { if (freetime.FreeStatus != (int)RCHL.Model.Enums.FreeTimeStatus.空闲) { hasflag = true; break; } } } if (hasflag) { result.Message = "您下手晚了,请重新选择预约时间"; return(Json(result)); } order.TrainingOrderId = Util.NewUpperGuid(); order.TrainingOrderNo = TrainingOrderBLL.Instance.GetOrderNo(); order.CreateTime = DateTime.Now; order.Status = (int)Model.Enums.TrainingStatus.待审核; order.MemberId = LoginUser.UserId; order.MemberName = LoginUser.NickName; order.MemberMobile = LoginUser.Mobile; order.UserType = (int)RCHL.Model.Enums.TrainingUserType.学员; string _ServiceTime = ""; if (TrainingOrderBLL.Instance.Add(order)) { if (order.DetailList != null) { foreach (var item in order.DetailList) { TrainingOrderDetailEntity detail = new TrainingOrderDetailEntity(); detail.TrainingOrderDetailId = Util.NewUpperGuid(); detail.ServiceTime = item.ServiceTime; detail.ServiceDate = item.ServiceDate; detail.TrainingOrderId = order.TrainingOrderId; detail.TrainingFreeTimeId = item.TrainingFreeTimeId; if (TrainingOrderDetailBLL.Instance.Add(detail)) { _ServiceTime += detail.ServiceTime + ","; //修改预约时间状态 TrainingFreeTimeEntity freetime = new TrainingFreeTimeEntity(); freetime.TrainingFreeTimeId = detail.TrainingFreeTimeId; freetime.FreeStatus = (int)RCHL.Model.Enums.FreeTimeStatus.锁定; TrainingFreeTimeBLL.Instance.Update(freetime); } } } } result.IsSuccess = true; result.Message = "创建成功"; //写消息 string servicetime = string.Format("{0} {1}", DateTime.Parse(order.ServiceDate.ToString()).ToString("yyyy-MM-dd"), _ServiceTime.TrimEnd(',')); string txt = "预约实训," + order.SchoolName + order.TrainingTypeName + "考场实训"; SendSysMessageBLL.SendMessage(RCHL.Model.Enums.MessageAlterType.实训预约提示, RCHL.Model.Enums.NoticeType.预约提醒, LoginUser.UserId, order.MemberName, servicetime, txt, order.TrainingOrderNo); } } catch (Exception ex) { ex.Data["Method"] = "TrainingCarController>>CreateOrder"; new ExceptionHelper().LogException(ex); } return(Json(result)); }
/// <summary> /// 陪驾 /// </summary> public void WithDrivingOrder() { try { var withdrivinglist = WithDrivingOrderBLL.Instance.GetList(new WithDrivingOrderEntity() { Status = (int)QX360.Model.Enums.PaySatus.待支付 }); if (withdrivinglist.Count > 0) { withdrivinglist.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (servicetime < DateTime.Now) { o.DrivingOrderId = o.DrivingOrderId; o.Status = (int)QX360.Model.Enums.PaySatus.已取消; WithDrivingOrderBLL.Instance.Update(o); //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime); SendSysMessageBLL.SendMessage(QX360.Model.Enums.MessageAlterType.陪驾预约提示, QX360.Model.Enums.NoticeType.取消提醒, o.MemberId, o.MemberName, _servicetime, "陪驾预约未支付,系统已自动取消,请重新预约", o.DrivingOrderNo); } } }); } } catch (Exception ex) { logger.Error("处理陪驾取消订单失败:" + ex.Message); } try { var withdrivinglist = WithDrivingOrderBLL.Instance.GetList(new WithDrivingOrderEntity() { Status = (int)QX360.Model.Enums.PaySatus.已支付 }); if (withdrivinglist.Count > 0) { withdrivinglist.ForEach((o) => { //当前时间大于预约时间修改状态为完成状态 if (o.ServiceDate != null && o.ServiceTime != null) { DateTime servicetime = Convert.ToDateTime(Convert.ToDateTime(o.ServiceDate).ToString("yyyy-MM-dd").ToString()); if (servicetime < DateTime.Now) { o.DrivingOrderId = o.DrivingOrderId; o.Status = (int)QX360.Model.Enums.PaySatus.已完成; WithDrivingOrderBLL.Instance.Update(o); //发送消息 string _servicetime = string.Format("{0} {1}", DateTime.Parse(o.ServiceDate.ToString()).ToString("yyyy-MM-dd"), o.ServiceTime); SendSysMessageBLL.SendMessage(QX360.Model.Enums.MessageAlterType.陪驾预约提示, QX360.Model.Enums.NoticeType.完成通知, o.MemberId, o.MemberName, _servicetime, "陪驾预约已完成,祝您生活愉快", o.DrivingOrderNo); } } }); } } catch (Exception ex) { logger.Error("处理陪驾完成订单失败:" + ex.Message); } }