public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var biz = new GetListQuaTrinhCongTacByCriteriaBiz(context);
                biz.QUA_TRINH_CONG_TAC_ID = _quaTrinhCongTacId;

                var list = (await biz.Execute()).ToList();

                var total = 0;
                if (list.Count() > 0)
                {
                    var obj = list.FirstOrDefault();

                    total = Protector.Int(obj.MAXCNT);
                }

                dynamic _metaData = new System.Dynamic.ExpandoObject();
                _metaData.draw  = _draw;
                _metaData.total = total;

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, list, _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Beispiel #2
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var orderClause = sortName + " " + sortDir;
                var total       = 0;

                var biz = new GetListQuaTrinhCongTacByCriteriaBiz(context);
                biz.NHAN_VIEN_ID = _nhanVienId;
                biz.SKIP         = _start;
                biz.TAKE         = _length;
                biz.ORDER_CLAUSE = orderClause;

                var list = (await biz.Execute()).ToList();

                if (list.Count() > 0)
                {
                    var obj = list.FirstOrDefault();

                    total = Protector.Int(obj.MAXCNT);
                }

                dynamic _metaData = new System.Dynamic.ExpandoObject();
                _metaData.draw  = _draw;
                _metaData.total = total;

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, list, _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }