コード例 #1
0
        public async Task <ObjectResultModule> QualityControlManageList([FromBody] QualityControlManageIn QualityControlManageInList)
        {
            if (!Commons.CheckSecret(QualityControlManageInList.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;

            QualityControlManageInList.AndAlso(t => !t.IsDelete);
            if (!string.IsNullOrEmpty(QualityControlManageInList.KeyWord))
            {
                QualityControlManageInList.AndAlso(t => t.DoctorName.Contains(QualityControlManageInList.KeyWord) ||
                                                   t.ConsultantName.Contains(QualityControlManageInList.KeyWord));
            }
            var values = await _QualityControlManageService.QualityControlManageList(QualityControlManageInList);

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

            #endregion

            return(this.ObjectResultModule);
        }
コード例 #2
0
        public async Task <ObjectResultModule> QualityControlManagePage([FromBody] QualityControlManageIn QualityControlManageInPage)
        {
            if (!Commons.CheckSecret(QualityControlManageInPage.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 = JsonHelper.FromJson <UserMemory>(_IabpSession.GetUserData());

            DateTime StartTime = new DateTime();
            DateTime EndTime   = new DateTime();

            if (!string.IsNullOrEmpty(QualityControlManageInPage.StartTime))
            {
                StartTime = DateTime.Parse(QualityControlManageInPage.StartTime);
                if (string.IsNullOrEmpty(QualityControlManageInPage.EndTime))
                {
                    QualityControlManageInPage.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(QualityControlManageInPage.EndTime))
            {
                EndTime = DateTime.Parse(QualityControlManageInPage.EndTime);
            }
            if (!string.IsNullOrEmpty(QualityControlManageInPage.StartTime))
            {
                QualityControlManageInPage.AndAlso(t => t.CreatedOn >= StartTime);
                QualityControlManageInPage.AndAlso(t => t.CreatedOn < EndTime.AddDays(+1));
            }
            if (QualityControlManageInPage.Platform == "PC")
            {
                if (!usermanager.IsAdmin && usermanager.IsDoctor)
                {
                    QualityControlManageInPage.AndAlso(t => t.DoctorID == usermanager.DoctorID);
                }
            }
            else if (QualityControlManageInPage.Platform == "Mobile")
            {
                if (usermanager.MobileRoleName == "doctor")
                {
                    var doctor = await _yaeherDoctorService.YaeherDoctorByUserID(userid);

                    QualityControlManageInPage.AndAlso(t => t.DoctorID == doctor.Id);
                }
            }
            if (!string.IsNullOrEmpty(QualityControlManageInPage.KeyWord))
            {
                QualityControlManageInPage.AndAlso(t => t.DoctorName.Contains(QualityControlManageInPage.KeyWord) ||
                                                   t.ConsultantName.Contains(QualityControlManageInPage.KeyWord));
            }
            QualityControlManageInPage.AndAlso(t => !t.IsDelete);
            var values = await _QualityControlManageService.QualityControlManagePage(QualityControlManageInPage);

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

            #endregion

            return(this.ObjectResultModule);
        }