Пример #1
0
        public JsonResult AcceptDirection(Guid directionId)
        {
            MaterialDirectionRepository repository = new MaterialDirectionRepository(false);
            EXP_MaterialDirections      m          = repository.GetAsQuarable(d => d.Id == directionId).FirstOrDefault();

            if (m != null)
            {
                DictionaryRepository drep = new DictionaryRepository(false);
                var statusId = drep.GetDictionaryElementIdByTypeAndCode(Dictionary.MaterialDirectionStatusDic.DicCode, Dictionary.MaterialDirectionStatusDic.Accepted);
                if (statusId.HasValue)
                {
                    m.StatusId = statusId.Value;
                }

                m.ReceiveDate        = DateTime.Now;
                m.ExecutorEmployeeId = UserHelper.GetCurrentEmployee().Id;

                repository.Update(m);
                repository.Save();
            }

            return(Json(directionId, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public JsonResult ReadMaterialList([DataSourceRequest] DataSourceRequest request, Guid?ddId)
        {
            MaterialRepository repository = new MaterialRepository(false);

            var data = repository.GetAsQuarable(mp => mp.DrugDeclarationId == ddId)
                       .Include(mp => mp.Unit)
                       .Include(mp => mp.DIC_Storages)
                       .Include(mp => mp.ExternalState)
                       .Include(mp => mp.EXP_DrugDeclaration)
                       .Include(mp => mp.EXP_DrugDeclaration.EXP_DIC_Type);

            MaterialDirectionRepository drep = new MaterialDirectionRepository(false);
            var direction = drep.GetAsQuarable(d => d.DrugDeclarationId == ddId).FirstOrDefault();

            return(Json(data.ToDataSourceResult(request, m => new EXP_Materials()
            {
                Id = m.Id,
                RegistrationDate = m.RegistrationDate,
                CreatedDate = m.CreatedDate,
                DeleteDate = m.DeleteDate,
                Name = m.Name,
                TypeId = m.TypeId,
                DrugFormId = m.DrugFormId,
                Dosage = m.Dosage,
                DosageUnitId = m.DosageUnitId,
                DosageQuantity = m.DosageQuantity,
                Concentration = m.Concentration,
                Volume = m.Volume,
                VolumeUnitId = m.VolumeUnitId,
                IsContainNPP = m.IsContainNPP,
                ProducerId = m.ProducerId,
                CountryId = m.CountryId,
                Quantity = m.Quantity,
                UnitId = m.UnitId,
                Batch = m.Batch,
                DateOfManufacture = m.DateOfManufacture,
                ExpirationDate = m.ExpirationDate,
                RetestDate = m.RetestDate,
                IsCertificatePassport = m.IsCertificatePassport,
                StorageId = m.StorageId,
                StorageTemperatureFrom = m.StorageTemperatureFrom,
                StorageTemperatureTo = m.StorageTemperatureTo,
                ActiveSubstancePercent = m.ActiveSubstancePercent,
                WaterContentPercent = m.WaterContentPercent,
                DrugDeclarationId = m.DrugDeclarationId,
                IsAdditional = m.IsAdditional,
                StorageConditionId = m.StorageConditionId,
                StatusId = m.StatusId,
                ExternalStateId = m.ExternalStateId,
                ConcordanceStatementId = m.ConcordanceStatementId,
                OpeningDate = m.OpeningDate,
                ExpirationAfterOpeningDate = m.ExpirationAfterOpeningDate,
                DirectionNumber = direction?.Number,

                DIC_Storages = m.DIC_Storages,
                Unit = m.Unit,
                ConcordanceStatement = m.ConcordanceStatement,
                Country = m.Country,
                DosageUnit = m.DosageUnit,
                ExternalState = m.ExternalState,
                Status = m.Status,
                StorageCondition = m.StorageCondition,
                MaterialType = m.MaterialType,
                VolumeUnit = m.VolumeUnit,
                EXP_DrugDeclaration = m.EXP_DrugDeclaration,
                Producer = m.Producer,
                sr_dosage_forms = m.sr_dosage_forms
            }), JsonRequestBehavior.AllowGet));
        }