コード例 #1
0
        public async Task <ObjectResultModule> LableByName([FromBody] LableManageIn LableManageInfo)
        {
            if (!Commons.CheckSecret(LableManageInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;

            if (!string.IsNullOrEmpty(LableManageInfo.LableName))
            {
                LableManageInfo.AndAlso(t => t.LableName == LableManageInfo.LableName);
            }
            if (LableManageInfo.Id > 0)
            {
                LableManageInfo.AndAlso(t => t.Id == LableManageInfo.Id);
            }
            LableManageInfo.AndAlso(t => !t.IsDelete);
            var values = await _lableManageService.LableManageByName(LableManageInfo);

            if (values == null)
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Message    = "NotFound";
            }
            else
            {
                this.ObjectResultModule.Object     = values;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "LableByName",
                OperContent = JsonHelper.ToJson(LableManageInfo),
                OperType    = "LableByName",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(ObjectResultModule);
        }
コード例 #2
0
        public async Task <ObjectResultModule> LableList([FromBody] LableManageIn LableManageInfo)
        {
            if (!Commons.CheckSecret(LableManageInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            //var usermanager = _userManagerService.UserManager(userid);
            DateTime StartTime = new DateTime();
            DateTime EndTime   = new DateTime();

            if (!string.IsNullOrEmpty(LableManageInfo.StartTime))
            {
                StartTime = DateTime.Parse(LableManageInfo.StartTime);
                if (string.IsNullOrEmpty(LableManageInfo.EndTime))
                {
                    LableManageInfo.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(LableManageInfo.EndTime))
            {
                EndTime = DateTime.Parse(LableManageInfo.EndTime);
            }
            if (!string.IsNullOrEmpty(LableManageInfo.StartTime))
            {
                LableManageInfo.AndAlso(t => t.CreatedOn >= StartTime && t.CreatedOn < EndTime.AddDays(+1));
            }
            if (!string.IsNullOrEmpty(LableManageInfo.KeyWord))
            {
                LableManageInfo.AndAlso(t => t.LableName.Contains(LableManageInfo.KeyWord));
            }
            LableManageInfo.AndAlso(t => t.IsDelete == false);
            var values = await _lableManageService.LableManageList(LableManageInfo);

            if (values.Count == 0)
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 204;
                this.ObjectResultModule.Message    = "NoContent";
            }
            else
            {
                this.ObjectResultModule.Object     = values;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "LableList",
                OperContent = JsonHelper.ToJson(LableManageInfo),
                OperType    = "LableList",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(ObjectResultModule);
        }
コード例 #3
0
        public async Task <ObjectResultModule> LablePage([FromBody] LableManageIn LableManageInfo)
        {
            if (!Commons.CheckSecret(LableManageInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            // var usermanager = _userManagerService.UserManager(userid);
            var      usermanager = JsonHelper.FromJson <UserMemory>(_IabpSession.GetUserData());
            DateTime StartTime   = new DateTime();
            DateTime EndTime     = new DateTime();

            if (!string.IsNullOrEmpty(LableManageInfo.StartTime))
            {
                StartTime = DateTime.Parse(LableManageInfo.StartTime);
                if (string.IsNullOrEmpty(LableManageInfo.EndTime))
                {
                    LableManageInfo.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(LableManageInfo.EndTime))
            {
                EndTime = DateTime.Parse(LableManageInfo.EndTime);
            }
            if (!string.IsNullOrEmpty(LableManageInfo.StartTime))
            {
                LableManageInfo.AndAlso(t => t.CreatedOn >= StartTime);
                LableManageInfo.AndAlso(t => t.CreatedOn < EndTime.AddDays(+1));
            }
            if (!string.IsNullOrEmpty(LableManageInfo.KeyWord))
            {
                LableManageInfo.AndAlso(t => t.LableName.Contains(LableManageInfo.KeyWord));
            }
            LableManageInfo.AndAlso(t => t.IsDelete == false);

            if (usermanager.MobileRoleName == "doctor" || usermanager.IsDoctor)
            {
                if (LableManageInfo.Platform == "PC")
                {
                    LableManageInfo.DoctorID = usermanager.DoctorID;
                }
                else if (LableManageInfo.Platform == "Mobile")
                {
                    var doctor = await _yaeherDoctorService.YaeherDoctorByUserID(userid);

                    LableManageInfo.DoctorID = doctor.Id;
                }
                var value = await _doctorRelationService.LabelDoctorRelationPage(LableManageInfo);

                this.ObjectResultModule.Object = new DoctorRelationOut(value, LableManageInfo);
            }
            else
            {
                var values = await _lableManageService.LableManagePage(LableManageInfo);

                this.ObjectResultModule.Object = new LableManageOut(values, LableManageInfo);
            }

            this.ObjectResultModule.StatusCode = 200;
            this.ObjectResultModule.Message    = "success";
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "LablePage",
                OperContent = JsonHelper.ToJson(LableManageInfo),
                OperType    = "LablePage",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }