//預約服務 public ActionResult ReserveClass(string CoachId, string CoachName) { ReserveServiceModel model = new ReserveServiceModel(); if (LoginState) { User member = GetMemberInfo(); SearchService search = new SearchService(); Coach coach = search.GetCoachDetail(CoachId); ServicePara para = new ServicePara() { CoachId = CoachId, MemberId = member.MemberId, ServiceDate = DateTime.Now, Location = coach.Address.Replace("|", "")//預設教練地址 }; model.Para = para; model.CoachName = CoachName; //教練有服務的項目 var trainprogrem = ReserveService.Instance.GetCoachTraingProgramList(coach.TrainingProgramId.ToArray()); var course = ReserveService.Instance.GetCoachCourseList(coach.CourseId.ToArray()); model.TrainProgramList = new SelectList(trainprogrem, "Value", "Text"); model.CourseList = new SelectList(course, "Value", "Text"); return(View(model)); } else { return(RedirectToAction("Login", "Home")); } }
//預約服務 public Result reserveClass(ServicePara para) { var result = new Result(); string returnStr = ShareService.Instance.SendApi("Reserve/ReserveClass", JsonConvert.SerializeObject(para)); result = JsonConvert.DeserializeObject <Result>(returnStr); return(result); }
/// <summary> /// 預約服務 /// </summary> /// <param name="model"></param> /// <returns></returns> public Result ReserveClass(ServicePara model) { var result = new Result(); var para = new DynamicParameters(); con.Open(); para.Add("@CoachId", model.CoachId, DbType.String, ParameterDirection.Input, 50); para.Add("@MemberId", model.MemberId, DbType.String, ParameterDirection.Input, 50); para.Add("@StatusId", model.StatusId, DbType.Int32, ParameterDirection.Input, 50); para.Add("@ServiceDate", model.ServiceDate, DbType.DateTime, ParameterDirection.Input, 50); para.Add("@TrainingProgramId", model.TrainingProgramId, DbType.Int32, ParameterDirection.Input, 200); para.Add("@CourseId", model.CourseId, DbType.Int32, ParameterDirection.Input, 100); para.Add("@Charge", model.Charge, DbType.Int32, ParameterDirection.Input, 100); para.Add("@Location", model.Location, DbType.String, ParameterDirection.Input, 200); try { con.Execute(@"Insert into ReserveService(CoachId,MemberId,StatusId,ServiceDate,TrainingProgramId,CourseId,Charge,Location) values(@CoachId,@MemberId,@StatusId,@ServiceDate,@TrainingProgramId,@CourseId,@Charge,@Location)", para, commandTimeout: 300, commandType: CommandType.Text); } catch (Exception ex) { result.ReturnNo = -99; result.Message = ex.ToString(); return(result); } finally { con.Close(); } result.ReturnNo = 1; result.Message = "新增訂單成功"; return(result); }
public Result ReserveClass(ServicePara model) { return(repository.ReserveClass(model)); }
public Result ReserveClass(ServicePara model) { return(facade.ReserveClass(model)); }