public JsonResult ReadItemsFo1CList([DataSourceRequest] DataSourceRequest request, Guid tmcInId)
        {
            ApplicationPoaRepository repository = new ApplicationPoaRepository(false);
            var data = repository.GetLimsTmcTempViews(m => m.TmcInId == tmcInId && m.IsSelected.Value);

            return(Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }
        // Принять
        public PartialViewResult AcceptTmcView(Guid id, Guid tmcInId)
        {
            ApplicationPoaRepository repository = new ApplicationPoaRepository();
            var limsTmcTemp = repository.GetLimsTmcTempViews(l => l.Id == id && l.TmcInId == tmcInId).FirstOrDefault();

            return(PartialView(new TmcViewModel()
            {
                Id = limsTmcTemp.Id,
                TmcInId = limsTmcTemp.TmcInId,
                CountRequest = limsTmcTemp.CountRequest.Value,
                Count = limsTmcTemp.CountRequest.Value,
                CountConvert = limsTmcTemp.CountRequest.Value,
                MeasureTypeConvertDicId = limsTmcTemp.MeasureTypeConvertDicId,
                MeasureTypeDicId = limsTmcTemp.MeasureTypeDicId,
                ReceivingDate = limsTmcTemp.ReceivingDate,
                MeasureTypeConvertDic = new MeasureType()
                {
                    Id = limsTmcTemp.MeasureTypeConvertDicId.Value,
                    Name = limsTmcTemp.MeasureTypeConvertDicName
                }
            }));
        }
        /// <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));
        }