コード例 #1
0
        public ActionResult SubmitStopForm(StopDoctorViewModel model, string permissionIds, string keyValue)
        {
            var doctorId = 0;

            int.TryParse(keyValue, out doctorId);
            model.DoctorId = doctorId;
            stopApp.DoctorStop(model);
            return(Success("操作成功。"));
        }
コード例 #2
0
        public void DoctorStop(StopDoctorViewModel model)
        {
            var closeData     = Convert.ToDateTime(model.CloseDate.ToString("yyyy-MM-dd"));
            var orderTimeType = 1;

            //上午
            if (model.Morning)
            {
                orderTimeType = 1;

                var isExist = service.IQueryable(item => item.DoctorId == model.DoctorId &&
                                                 item.OrderTimeType == orderTimeType &&
                                                 item.CloseDate >= closeData && item.CloseDate <= closeData).Count() > 0;
                //不存在则进行添加
                if (!isExist)
                {
                    CloseOrderEntity closeOrderEntity = new CloseOrderEntity();
                    closeOrderEntity.DoctorId      = model.DoctorId;
                    closeOrderEntity.CloseDate     = model.CloseDate;
                    closeOrderEntity.OrderTimeType = orderTimeType;
                    service.Insert(closeOrderEntity);
                }
            }

            //下午
            if (model.Afternoon)
            {
                orderTimeType = 2;
                var isExist = service.IQueryable(item => item.DoctorId == model.DoctorId &&
                                                 item.OrderTimeType == orderTimeType &&
                                                 item.CloseDate >= closeData && item.CloseDate <= closeData).Count() > 0;
                //不存在则进行添加
                if (!isExist)
                {
                    CloseOrderEntity closeOrderEntity = new CloseOrderEntity();
                    closeOrderEntity.DoctorId      = model.DoctorId;
                    closeOrderEntity.CloseDate     = model.CloseDate;
                    closeOrderEntity.OrderTimeType = orderTimeType;
                    service.Insert(closeOrderEntity);
                }
            }

            //晚上
            if (model.Night)
            {
                orderTimeType = 3;
                var isExist = service.IQueryable(item => item.DoctorId == model.DoctorId &&
                                                 item.OrderTimeType == orderTimeType &&
                                                 item.CloseDate >= closeData && item.CloseDate <= closeData).Count() > 0;
                //不存在则进行添加
                if (!isExist)
                {
                    CloseOrderEntity closeOrderEntity = new CloseOrderEntity();
                    closeOrderEntity.DoctorId      = model.DoctorId;
                    closeOrderEntity.CloseDate     = model.CloseDate;
                    closeOrderEntity.OrderTimeType = orderTimeType;
                    service.Insert(closeOrderEntity);
                }
            }

            //修改预约信息
            var orderList = orderService.IQueryable(item => item.OrderDoctorId == model.DoctorId &&
                                                    item.OrderDate >= closeData && item.OrderDate <= closeData &&
                                                    item.OrderType == orderTimeType).ToList();

            if (orderList != null && orderList.Any())
            {
                foreach (var order in orderList)
                {
                    order.OrderStatus = OrderStatusEnum.Stop;
                    orderService.Update(order);
                }
            }
        }