public ActionResult CheckinOrder(string orderCode) { var result = new AjaxOperationResult(); if (orderCode != null) { var _orderService = this.Service <IOrderService>(); Order order = _orderService.FirstOrDefaultActive(o => o.OrderCode.Equals(orderCode)); if (order != null) { if (_orderService.ChangeOrderStatus(order.Id, (int)OrderStatus.CheckedIn) != null) { result.Succeed = true; } else { result.Succeed = false; result.AddError("Update", "Đã có lỗi xảy ra"); } } else { result.Succeed = false; result.AddError("Update", "Không tìm thấy đơn đặt sân"); } } else { result.Succeed = false; result.AddError("Update", "Đã có lỗi trong lúc truyền dữ liệu"); } return(Json(result)); }
public ActionResult CheckUsername(string username) { var result = new AjaxOperationResult(); var service = this.Service <IAspNetUserService>(); if (username != null && username.Length > 0) { var user = service.GetActive(u => u.Email.ToLower().Equals(username.ToLower())).FirstOrDefault(); if (user != null) { result.Succeed = true; } else { result.Succeed = false; result.AddError("username", "Email không tồn tại trong hệ thống"); } } else { result.Succeed = true; } return(Json(result)); }
public ActionResult ConfirmPaid(int id) { var result = new AjaxOperationResult(); if (id != 0) { var _orderService = this.Service <IOrderService>(); Order order = _orderService.FirstOrDefaultActive(o => o.Id == id); if (order != null) { if (order.PaidType != (int)OrderPaidType.PaidByCash || order.PaidType != (int)OrderPaidType.PaidOnline) { order.PaidType = order.PaidType == (int)OrderPaidType.ChosePayByCash ? (int)OrderPaidType.PaidByCash : (int)OrderPaidType.PaidOnline; _orderService.Update(order); _orderService.Save(); result.Succeed = true; } else { result.Succeed = false; result.AddError("Update", "Thông tin đơn đặt sân không phù hợp"); } } else { result.Succeed = false; result.AddError("Update", "Không tìm thấy đơn đặt sân"); } } else { result.Succeed = false; result.AddError("Update", "Đã có lỗi trong lúc truyền dữ liệu"); } return(Json(result)); }
public ActionResult Update(CreateFieldScheduleViewModel schedule) { var result = new AjaxOperationResult(); try { schedule.StartDate = DateTime.ParseExact(schedule.StartDateStr, "dd/MM/yyyy", CultureInfo.InvariantCulture); schedule.EndDate = DateTime.ParseExact(schedule.EndDateStr, "dd/MM/yyyy", CultureInfo.InvariantCulture); schedule.StartTime = TimeSpan.Parse(schedule.StartTimeStr); schedule.EndTime = TimeSpan.Parse(schedule.EndTimeStr); string[] days = schedule.Days.Split(','); int repeatDay = 0; for (int i = 0; i < days.Length; i++) { if (days[i].Length > 0) { int mark = 1 << Int16.Parse(days[i]); repeatDay = repeatDay | mark; } } schedule.AvailableDay = repeatDay; var userService = this.Service <IAspNetUserService>(); if (schedule.UserName != null && schedule.UserName.Length > 0) { var user = userService.GetActive(u => u.Email.ToLower().Equals(schedule.UserName.ToLower())).FirstOrDefault(); if (user != null) { schedule.UserId = user.Id; } else { result.Succeed = false; result.AddError("Update", "Email không tồn tại trong hệ thống. Vui lòng thử lại"); return(Json(result)); } } schedule.Active = true; var scheduleService = this.Service <IFieldScheduleService>(); var entity = scheduleService.Get(schedule.Id); if (checkValid(schedule)) { schedule.CopyToEntity(entity); scheduleService.Update(entity); result.Succeed = true; } else { result.Succeed = false; result.AddError("Update", "Thời gian đặt bị trùng lịch. Vui lòng chọn thời gian khác"); } } catch (Exception e) { result.Succeed = false; result.AddError("Update", "Vui lòng nhập đầy đủ thông tin"); } //DateTime startTime = new DateTime(_startDay.Date.Year, _startDay.Date.Month, _startDay.Date.Day, _startTime.Hours, _startTime.Minutes, _startTime.Seconds); //DateTime endTime = new DateTime(_endDay.Date.Year, _endDay.Date.Month, _endDay.Date.Day, _endTime.Hours, _endTime.Minutes, _endTime.Seconds); //var result = new AjaxOperationResult(); return(Json(result)); }