public ActionResult UserOder(UserOderRequest request) { ResponseBase <AddOrderResponse> response = new ResponseBase <AddOrderResponse>(); response.IsSuccess = false; response.Reason = "系统出错,请联系管理员"; #region 验证 if (request == null) { response.IsSuccess = false; response.Reason = "参数不能为空"; return(Content(response.ToJson())); } //证件号码 if (string.IsNullOrWhiteSpace(request.CredentialInformation)) { response.IsSuccess = false; response.Reason = "证件号码输入不正确"; return(Content(response.ToJson())); } //全名 if (string.IsNullOrWhiteSpace(request.FullName)) { response.IsSuccess = false; response.Reason = "全名输入不正确"; return(Content(response.ToJson())); } //就诊卡号 //if (string.IsNullOrWhiteSpace(request.VisitingCardNumber)) //{ // response.IsSuccess = false; // response.Reason = "就诊卡号输入不正确"; // return Content(response.ToJson()); //} //性别 if ((int)request.Gender < 1 || (int)request.Gender > 2) { response.IsSuccess = false; response.Reason = "性别输入不正确"; return(Content(response.ToJson())); } //出生年月 if (request.DateOfBirth == null || request.DateOfBirth == DateTime.MinValue) { response.IsSuccess = false; response.Reason = "出生年月输入不正确"; return(Content(response.ToJson())); } //联系电话 if (string.IsNullOrWhiteSpace(request.ContactNumber)) { response.IsSuccess = false; response.Reason = "联系电话输入不正确"; return(Content(response.ToJson())); } //E-mail if (string.IsNullOrWhiteSpace(request.Email)) { response.IsSuccess = false; response.Reason = "E-mail输入不正确"; return(Content(response.ToJson())); } //症状 if (string.IsNullOrWhiteSpace(request.SymptomDescription)) { response.IsSuccess = false; response.Reason = "症状输入不正确"; return(Content(response.ToJson())); } //国籍 if (string.IsNullOrWhiteSpace(request.Nationality)) { response.IsSuccess = false; response.Reason = "国籍输入不正确"; return(Content(response.ToJson())); } //预约医生Id if (request.OrderDoctorId < 1) { response.IsSuccess = false; response.Reason = "预约医生Id输入不正确"; return(Content(response.ToJson())); } //预约时间 if (request.OrderDateTime == null || request.OrderDateTime == DateTime.MinValue) { response.IsSuccess = false; response.Reason = "预约时间输入不正确"; return(Content(response.ToJson())); } //预约时间类型 if ((int)request.OrderDateTimeType < 1 || (int)request.OrderDateTimeType > 3) { response.IsSuccess = false; response.Reason = "预约时间类型不正确"; return(Content(response.ToJson())); } //预约类型 if ((int)request.OrderType < 1 || (int)request.OrderType > 2) { response.IsSuccess = false; response.Reason = "预约类型不正确"; return(Content(response.ToJson())); } #endregion try { int orderCycle = 0; ////配置文件读取 int.TryParse(Configs.GetValue("OrderCycle"), out orderCycle); var orderBeginDate = DateTime.Now; var orderEndDate = DateTime.Now.AddDays(orderCycle); //验证预约周期以外时间 if (request.OrderDateTime < request.OrderDateTime || request.OrderDateTime > orderEndDate) { response.IsSuccess = false; response.Reason = "Order Fail"; return(Content(response.ToJson())); } OrderViewModel orderViewModel = new OrderViewModel(); orderViewModel.CredentialInformation = request.CredentialInformation; orderViewModel.CredentialType = request.CredentialType; orderViewModel.FullName = request.FullName; orderViewModel.VisitingCardNumber = request.VisitingCardNumber; orderViewModel.Gender = request.Gender; orderViewModel.DateOfBirth = request.DateOfBirth; orderViewModel.ContactNumber = request.ContactNumber; orderViewModel.Email = request.Email; orderViewModel.Nationality = request.Nationality; orderViewModel.SymptomDescription = request.SymptomDescription; orderViewModel.OrderDateTime = request.OrderDateTime; orderViewModel.OrderDateTimeType = request.OrderDateTimeType; orderViewModel.OrderType = request.OrderType; orderViewModel.BeginTime = request.BeginTime; orderViewModel.EndTime = request.EndTime; orderViewModel.OrderDoctorId = request.OrderDoctorId; var orderResonse = orderApp.AddOrder(orderViewModel); //失败 if (!orderResonse.IsSuccess) { response.IsSuccess = false; response.Reason = orderResonse.Reason; return(Content(response.ToJson())); } response.IsSuccess = true; response.Result = orderResonse; } catch (Exception ex) { } return(Content(response.ToJson())); }
public ActionResult UserOder(UserOderRequest request) { ResponseBase <AddOrderResponse> response = new ResponseBase <AddOrderResponse>(); response.IsSuccess = false; response.Reason = "系统出错,请联系管理员"; #region 验证 if (request == null) { response.IsSuccess = false; response.Reason = "参数不能为空"; return(Content(response.ToJson())); } //证件号码 if (string.IsNullOrWhiteSpace(request.CredentialInformation)) { response.IsSuccess = false; response.Reason = "证件号码输入不正确"; return(Content(response.ToJson())); } //全名 if (string.IsNullOrWhiteSpace(request.FullName)) { response.IsSuccess = false; response.Reason = "全名输入不正确"; return(Content(response.ToJson())); } //就诊卡号 if (string.IsNullOrWhiteSpace(request.VisitingCardNumber)) { response.IsSuccess = false; response.Reason = "就诊卡号输入不正确"; return(Content(response.ToJson())); } //性别 if ((int)request.Gender < 1 || (int)request.Gender > 2) { response.IsSuccess = false; response.Reason = "性别输入不正确"; return(Content(response.ToJson())); } //出生年月 if (request.DateOfBirth == null || request.DateOfBirth == DateTime.MinValue) { response.IsSuccess = false; response.Reason = "出生年月输入不正确"; return(Content(response.ToJson())); } //联系电话 if (string.IsNullOrWhiteSpace(request.ContactNumber)) { response.IsSuccess = false; response.Reason = "联系电话输入不正确"; return(Content(response.ToJson())); } //E-mail if (string.IsNullOrWhiteSpace(request.Email)) { response.IsSuccess = false; response.Reason = "E-mail输入不正确"; return(Content(response.ToJson())); } //症状 if (string.IsNullOrWhiteSpace(request.SymptomDescription)) { response.IsSuccess = false; response.Reason = "症状输入不正确"; return(Content(response.ToJson())); } //国籍 if (request.Nationality < 1) { response.IsSuccess = false; response.Reason = "国籍输入不正确"; return(Content(response.ToJson())); } //预约医生Id if (request.OrderDoctorId < 1) { response.IsSuccess = false; response.Reason = "国籍输入不正确"; return(Content(response.ToJson())); } //预约时间 if (request.OrderDateTime == null || request.OrderDateTime == DateTime.MinValue) { response.IsSuccess = false; response.Reason = "预约时间输入不正确"; return(Content(response.ToJson())); } //预约时间类型 if ((int)request.OrderDateTimeType < 1 || (int)request.OrderDateTimeType > 3) { response.IsSuccess = false; response.Reason = "预约时间类型不正确"; return(Content(response.ToJson())); } //预约类型 if ((int)request.OrderType < 1 || (int)request.OrderType > 2) { response.IsSuccess = false; response.Reason = "预约类型不正确"; return(Content(response.ToJson())); } #endregion try { OrderViewModel orderViewModel = new OrderViewModel(); orderViewModel.CredentialInformation = request.CredentialInformation; orderViewModel.CredentialType = request.CredentialType; orderViewModel.FullName = request.FullName; orderViewModel.VisitingCardNumber = request.VisitingCardNumber; orderViewModel.Gender = request.Gender; orderViewModel.DateOfBirth = request.DateOfBirth; orderViewModel.ContactNumber = request.ContactNumber; orderViewModel.Email = request.Email; orderViewModel.Nationality = request.Nationality; orderViewModel.SymptomDescription = request.SymptomDescription; orderViewModel.OrderDateTime = request.OrderDateTime; orderViewModel.OrderDateTimeType = request.OrderDateTimeType; orderViewModel.OrderType = request.OrderType; orderViewModel.BeginTime = request.BeginTime; orderViewModel.EndTime = request.EndTime; var orderResonse = orderApp.AddOrder(orderViewModel); response.IsSuccess = true; response.Result = orderResonse; } catch (Exception ex) { } return(Content(response.ToJson())); }