예제 #1
0
        /// <summary>
        ///  Получить список Реактив
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ActionResult ReadTmcList([DataSourceRequest] DataSourceRequest request, Guid tmcInId, int type = 0)
        {
            //TmcRepository repository = new TmcRepository(false);
            //var data = repository.TvGetAsQuarable().Where(m => m.TmcInId == tmcInId).OrderByDescending(m => m.CreatedDate);
            ApplicationPoaRepository repository = new ApplicationPoaRepository(false);
            var tmcIn = repository.GetById(tmcInId);
            var data  = repository.GetLimsTmcTempViews(l => l.TmcInId == tmcInId);

            if (type == 1 || (tmcIn.StateType != TmcIn.TmcInStatuses.New && tmcIn.StateType != TmcIn.TmcInStatuses.Repeal && tmcIn.StateType != TmcIn.TmcInStatuses.Rejected))
            {
                data = data.Where(l => l.IsSelected.Value);
            }
            data = data.OrderByDescending(l => l.CreatedDate);
            return(Json(data.ToDataSourceResult(request, tv =>
            {
                return new TmcViewModel()
                {
                    Id = tv.Id,
                    TmcInId = tv.TmcInId,
                    Name = tv.TmcName,
                    Count = tv.Count,
                    CountRequest = tv.CountRequest,
                    MeasureTypeDicValue = tv.MeasureTypeDicName,
                    MeasureTypeDicId = tv.MeasureTypeDicId,
                    IsSelected = tv.IsSelected != null && tv.IsSelected.Value,
                    CountFact = tv.StateType == Tmc.TmcStatuses.New ? 0 : tv.CountFact,
                    CountConvert = tv.StateType == Tmc.TmcStatuses.New ? 0 : tv.CountConvert,
                    //CountActual = tv.StateType == Tmc.TmcStatuses.New ? 0 : tv.CountActual,
                    MeasureTypeConvertDicId = tv.MeasureTypeConvertDicId,
                    MeasureTypeConvertDicValue = tv.MeasureTypeConvertDicName,
                    ReceivingDate = tv.ReceivingDate,
                    StateType = tv.StateType,
                    StateTypeValue = "",
                };
            }), JsonRequestBehavior.AllowGet));
        }