Example #1
0
        public ActionResult SendExpertiseDocumentToAgreement(Guid docId, string documentType, Guid?executorId = null, string taskType = null)
        {
            taskType = string.IsNullOrEmpty(taskType) ? null : taskType;
            var db              = new ncelsEntities();
            var repository      = new DrugDeclarationRepository();
            var stageRepo       = new ExpertiseStageRepository();
            var activityManager = new ActivityManager();

            switch (documentType)
            {
            case Dictionary.ExpAgreedDocType.EXP_DrugFinalDocument:
                var declarationInfo      = db.EXP_ExpertiseStageDosage.FirstOrDefault(e => e.Id == docId);
                var finalDocExecutorsIds = stageRepo.GetExecutorsByDicStageId(declarationInfo.EXP_ExpertiseStage.StageId,
                                                                              declarationInfo.EXP_ExpertiseStage.EXP_DrugDeclaration.TypeId)
                                           .Select(e => e.Id).ToArray();
                activityManager.SendToExecution(Dictionary.ExpActivityType.FinalDocAgreement, docId,
                                                Dictionary.ExpAgreedDocType.EXP_DrugFinalDocument, taskType ?? Dictionary.ExpTaskType.Agreement,
                                                declarationInfo.EXP_DrugDosage.RegNumber, declarationInfo.EXP_DrugDosage.EXP_DrugDeclaration.CreatedDate, finalDocExecutorsIds);
                var primaryDocStatus = repository.GetPrimaryFinalDocumentStatus(docId);
                return(Json(primaryDocStatus.Name, JsonRequestBehavior.AllowGet));

            case Dictionary.ExpAgreedDocType.Letter:
                var  primaryRepo = new DrugPrimaryRepository();
                bool isSigning   = taskType == Dictionary.ExpTaskType.Signing;
                var  letter      = primaryRepo.GetCorespondence(docId.ToString());
                if (isSigning)
                {
                    var stageSupervisor = stageRepo.GetStageSupervisor(letter.StageId, letter.EXP_DrugDeclaration.TypeId);
                    activityManager.SendToExecution(Dictionary.ExpActivityType.ExpertiseLetterSigning, docId,
                                                    Dictionary.ExpAgreedDocType.Letter, Dictionary.ExpTaskType.Signing,
                                                    letter.NumberLetter, letter.DateCreate, stageSupervisor.Id);
                    return(Json(
                               DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONSIGNING,
                                                                 CodeConstManager.STATUS_ONSIGNING).Name, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var letterExecutorsIds = stageRepo.GetExecutorsByDicStageId(letter.StageId, letter.EXP_DrugDeclaration.TypeId).Select(e => e.Id).ToArray();
                    activityManager.SendToExecution(Dictionary.ExpActivityType.ExpertiseLetterAgreement, docId,
                                                    Dictionary.ExpAgreedDocType.Letter, Dictionary.ExpTaskType.Agreement,
                                                    letter.NumberLetter, letter.DateCreate, letterExecutorsIds);
                    return(Json(
                               DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONAGREEMENT,
                                                                 CodeConstManager.STATUS_ONAGREEMENT).Name, JsonRequestBehavior.AllowGet));
                }

            case Dictionary.ExpAgreedDocType.CertificateOfCompletion:
                var coc = db.EXP_CertificateOfCompletion.FirstOrDefault(e => e.Id == docId);
                if (coc != null)
                {
                    var certExecutorsIds = stageRepo.GetExecutorsByDicStageId(coc.DicStageId.Value, coc.EXP_DrugDeclaration.TypeId).Select(e => e.Id).ToArray();
                    activityManager.SendToExecution(Dictionary.ExpActivityType.CertificateOfComplitionAgreement, docId,
                                                    Dictionary.ExpAgreedDocType.CertificateOfCompletion, taskType ?? Dictionary.ExpTaskType.Agreement,
                                                    string.Empty, coc.CreateDate, certExecutorsIds);
                }
                return(Json(DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONAGREEMENT,
                                                              CodeConstManager.STATUS_ONAGREEMENT).Name, JsonRequestBehavior.AllowGet));
            }
            return(null);
        }
        public ActionResult LetterPreview(Guid id)
        {
            var repo           = new DrugPrimaryRepository();
            var correspondence = repo.GetCorespondence(id.ToString());
            var reportTemplate = "";

            switch (correspondence.EXP_DIC_CorespondenceSubject.Code)
            {
            case EXP_DIC_CorespondenceSubject.Remarks:
                reportTemplate = "~/Reports/DrugPrimary/Corespondence.mrt";
                break;

            case EXP_DIC_CorespondenceSubject.RefuseByPayment:
                reportTemplate = "~/Reports/DrugPrimary/RefuseByPaymentLetter.mrt";
                break;

            default:
                reportTemplate = "";
                break;
            }
            var    reportPath = Server.MapPath(reportTemplate);
            string fileType;
            string fileName;
            var    file = repo.GetCorespondenceFilePreview(id, reportPath, out fileType, out fileName);

            return(File(file, fileType, fileName));
        }
Example #3
0
        public override ActionResult CreateRemark(string id)
        {
            var isSuccess = new DrugPrimaryRepository().CreateRemark(id, UserHelper.GetCurrentEmployee(), CodeConstManager.STAGE_PHARMACOLOGICAL);

            return(Json(new
            {
                isSuccess
            }));
        }
Example #4
0
        public virtual ActionResult CreateRemark(string id)
        {
            var isSuccess = new DrugPrimaryRepository().CreateRemark(id, UserHelper.GetCurrentEmployee(), CodeConstManager.STAGE_PRIMARY);

            return(Json(new
            {
                isSuccess
            }));
        }
Example #5
0
        public ActionResult PharmacologicalPageView(Guid id)
        {
            var expertiseStage = new ExpertiseStageRepository().GetById(id);

            if (expertiseStage == null)
            {
                return(HttpNotFound());
            }
            var primaryRepository = new DrugPrimaryRepository();
            var repository        = new ReadOnlyDictionaryRepository();

            var model = new PharmacologicalEntity
            {
                EXP_DrugDeclaration = expertiseStage.EXP_DrugDeclaration,
                DrugDeclarationId   = expertiseStage.DeclarationId.ToString(),
                Applicant           = new EmployeesRepository().GetById(expertiseStage.EXP_DrugDeclaration.OwnerId),
                Editor = UserHelper.GetCurrentEmployee(),
                ExpExpertiseStageRemarks = new List <EXP_ExpertiseStageRemark>(),
                ExpStageId   = expertiseStage.Id,
                CurrentStage = new StageModel()
                {
                    CurrentStage = GetExpertiseStage(expertiseStage.Id),
                    StageResults = repository.GetStageResultsByStage(expertiseStage.StageId)
                }
            };
            var employeName = "";

            if (UserHelper.GetCurrentEmployee() != null)
            {
                employeName = UserHelper.GetCurrentEmployee().DisplayName;
            }
            ViewBag.CurrentEmployeeName = employeName;
            var markList    = primaryRepository.GetPrimaryMarkList(expertiseStage.DeclarationId, CodeConstManager.STAGE_PHARMACOLOGICAL);
            var remarkTypes = repository.GetRemarkTypes().ToArray();

            ViewData["RemarkTypes" + model.DrugDeclarationId] = new SelectList(remarkTypes, "Id", "NameRu",
                                                                               null);
            foreach (var expDrugPrimaryRemark in markList)
            {
                model.ExpExpertiseStageRemarks.Add(expDrugPrimaryRemark);
            }
            foreach (var expDrugPrimaryRemark in model.ExpExpertiseStageRemarks)
            {
                ViewData["RemarkTypes" + model.DrugDeclarationId + "_" + expDrugPrimaryRemark.Id] = new SelectList(remarkTypes, "Id", "NameRu",
                                                                                                                   expDrugPrimaryRemark.RemarkTypeId);
            }
            model.ExpDrugCorespondences = primaryRepository.GetDrugCorespondences(expertiseStage.DeclarationId);


            return(PartialView(model));
        }
Example #6
0
        public FileStreamResult ExportFile(Guid id)
        {
            var db             = new ncelsEntities();
            var repo           = new DrugPrimaryRepository();
            var correspondence = repo.GetCorespondence(id.ToString());
            var reportTemplate = "";

            switch (correspondence.EXP_DIC_CorespondenceSubject.Code)
            {
            case EXP_DIC_CorespondenceSubject.Remarks:
                switch (correspondence.StageId)
                {
                case CodeConstManager.STAGE_PHARMACOLOGICAL:
                case CodeConstManager.STAGE_SAFETYREPORT:
                    reportTemplate = "~/Reports/DrugPrimary/CorespondencePharmacological.mrt";
                    break;

                case CodeConstManager.STAGE_TRANSLATE:
                    reportTemplate = "~/Reports/DrugPrimary/CorespondenceTranslate.mrt";
                    break;

                case CodeConstManager.STAGE_PHARMACEUTICAL:
                    reportTemplate = "~/Reports/DrugPrimary/CorespondencePharmaceutical.mrt";
                    break;

                default:
                    reportTemplate = "~/Reports/DrugPrimary/Corespondence.mrt";
                    break;
                }
                break;

            case EXP_DIC_CorespondenceSubject.RefuseByPayment:
                reportTemplate = "~/Reports/DrugPrimary/RefuseByPaymentLetter.mrt";
                break;

            default:
                reportTemplate = "";
                break;
            }
            var    reportPath = Server.MapPath(reportTemplate);
            string fileType;
            string fileName;
            var    file = repo.GetCorespondenceFilePreview(id, reportPath, out fileType, out fileName);

            return(File(file, fileType, fileName));
        }
Example #7
0
        public ActionResult SendMailRemark(string id)
        {
            var    model = new DrugPrimaryRepository().SendMailRemark(id, UserHelper.GetCurrentEmployee());
            string sendDate;
            string statusName;

            if (model != null)
            {
                sendDate   = model.DateSend.ToString();
                statusName = model.Dictionary.Name;
            }
            else
            {
                sendDate   = null;
                statusName = null;
            }
            return(Json(new
            {
                isSuccess = true,
                sendDate,
                statusName
            }));
        }
Example #8
0
        protected void FillViewBag(EXP_DrugDeclaration model)
        {
            var drugPrimaryRepo = new DrugPrimaryRepository();

            ViewData["ContractList"] =
                new SelectList(new ContractRepository(false).GetActiveContractListWithInfo(model.OwnerId), "Id",
                               "ContractInfo", model.ContractId);
            var repository = new ReadOnlyDictionaryRepository();

            ViewData["AccelerationTypeList"] = new SelectList(repository.GetAccelerationTypes(), "Id",
                                                              "NameRu", model.AccelerationTypeId);

            ViewData["TypeList"] = new SelectList(repository.GetDicTypes(), "Id",
                                                  "NameRu", model.TypeId);

            if (model.RegisterId > 0 && model.sr_register != null)
            {
                model.ReestrNumber  = model.sr_register.reg_number + "/" + model.sr_register.reg_number_kz;
                model.ReestrRegDate = model.sr_register.reg_date.ToShortDateString();
                if (model.sr_register.expiration_date != null)
                {
                    model.ReestrExpirationDate = model.sr_register.expiration_date.Value.ToShortDateString();
                }
                var reestrDrug = new ExternalRepository().GEtRegisterDrugById(model.RegisterId);
                if (reestrDrug != null)
                {
                    model.NumberNd = reestrDrug.nd_number;
                }
            }

            if (model.ExpDrugChangeTypes.Count == 0)
            {
                model.ExpDrugChangeTypes.Add(new EXP_DrugChangeType());
            }
            if (model.ExpDrugProtectionDocs.Count == 0)
            {
                model.ExpDrugProtectionDocs.Add(new EXP_DrugProtectionDoc());
            }
            if (model.ExpDrugOtherCountries.Count == 0)
            {
                model.ExpDrugOtherCountries.Add(new EXP_DrugOtherCountry());
            }
            if (model.ExpDrugExportTrades.Count == 0)
            {
                model.ExpDrugExportTrades.Add(new EXP_DrugExportTrade());
            }
            if (model.ExpDrugPatents.Count == 0)
            {
                model.ExpDrugPatents.Add(new EXP_DrugPatent());
            }
            if (model.ExpDrugTypes.Count == 0)
            {
                model.ExpDrugTypes.Add(new EXP_DrugType());
            }

            /*  if (model.ExpDrugWrappings.Count == 0)
             * {
             *    model.ExpDrugWrappings.Add(new EXP_DrugWrapping());
             * }*/

            if (model.ExpDrugOrganizationses.Count == 0)
            {
                model.ExpDrugOrganizationses.Add(new EXP_DrugOrganizations());
            }
            if (model.ExpDrugDosages.Count == 0)
            {
                model.ExpDrugDosages.Add(new EXP_DrugDosage());
            }

            /*if (model.ExpDrugPrices.Count == 0)
             * {
             *  model.ExpDrugPrices.Add(new EXP_DrugPrice());
             * }*/
            var externalRepository = new ExternalRepository();
            var countries          = externalRepository.GetCounties().ToArray();

            ViewData["Counties"] = new SelectList(countries, "Id", "name", 0);
            for (var i = 0; i < model.ExpDrugExportTrades.Count; i++)
            {
                ViewData["Counties" + i] = new SelectList(countries, "Id", "name",
                                                          model.ExpDrugExportTrades[i].CountryId);
            }

            var types     = repository.GetDrugType().ToArray();
            var typeKinds = repository.GetDrugTypeKinds().ToArray();

            ViewData["DrugTypes"]     = new SelectList(types, "Id", "NameRu", 0);
            ViewData["DrugTypeKinds"] = new SelectList(typeKinds, "Id", "NameRu", 0);
            for (var i = 0; i < model.ExpDrugTypes.Count; i++)
            {
                ViewData["DrugTypes" + i]     = new SelectList(types, "Id", "NameRu", model.ExpDrugTypes[i].DrugTypeId);
                ViewData["DrugTypeKinds" + i] = new SelectList(typeKinds, "Id", "NameRu",
                                                               model.ExpDrugTypes[i].DrugTypeKind);
            }

            model.AtcCodeses = externalRepository.GetAtcList();

            var methods = externalRepository.GetUseMethods();

            model.MethodUseList = new MultiSelectList(methods, "id", "name", model.MethodUseIds);

            /*  ViewData["SaleTypeList"] = new SelectList(repository.GetSaleType(), "Id",
             *    "NameRu", model.SaleTypeId);*/

            var measures = externalRepository.GetMeasures();

            ViewData["MeasureList"] = new SelectList(measures, "Id",
                                                     "name", null);
            var wrappingTypes = repository.GetWrappingTypes().ToArray();
            var boxes         = externalRepository.GetBoxes().ToArray();

            ViewData["WrappingTypes"]     = new SelectList(wrappingTypes, "Id", "NameRu", 0);
            ViewData["Boxes"]             = new SelectList(boxes, "id", "name", 0);
            ViewData["MeasureShortList"]  = new SelectList(measures, "id", "short_name", 0);
            ViewData["SizeMeasureList"]   = new SelectList(measures, "id", "short_name", 0);
            ViewData["VolumeMeasureList"] = new SelectList(measures, "id", "short_name", 0);

            var booleans = repository.GetBooleanList();

            ViewData["Booleans"] = new SelectList(booleans, "IsSign", "NameRu", false);

            var origins        = repository.GetOrigins().ToArray();
            var plantKinds     = repository.GetPlantKinds().ToArray();
            var normDocs       = repository.GetExpDicNormDocFarms().ToArray();
            var substanceTypes = externalRepository.GetSubstanceTypes().ToArray();

            ViewData["SubstanceTypes"]       = new SelectList(substanceTypes, "Id", "name", null);
            ViewData["Origins"]              = new SelectList(origins, "Id", "NameRu", null);
            ViewData["NormDocs"]             = new SelectList(normDocs, "Id", "NameRu", null);
            ViewData["PlantKinds"]           = new SelectList(plantKinds, "Id", "NameRu", null);
            ViewData["IsControlList"]        = new SelectList(booleans, "IsSign", "NameRu", null);
            ViewData["IsPoisonList"]         = new SelectList(booleans, "IsSign", "NameRu", null);
            ViewData["SubstanceCounties"]    = new SelectList(countries, "Id", "name", 0);
            ViewData["SubstanceMeasureList"] = new SelectList(measures, "id", "short_name", 0);
            var sales = repository.GetSaleType().ToList();

            ViewData["SaleTypeList"] = new SelectList(sales, "Id", "NameRu", null);
            ViewData["BestBeforeMeasureTypeList"] = new SelectList(measures, "id", "short_name",
                                                                   null);
            ViewData["AppPeriodMixMeasureList"] = new SelectList(measures, "id", "short_name",
                                                                 null);
            ViewData["AppPeriodOpenMeasureList"] = new SelectList(measures, "id", "short_name",
                                                                  null);



            var drugDeclarationRepository = new DrugDeclarationRepository();

            for (var i = 0; i < model.ExpDrugDosages.Count; i++)
            {
                var dosage = model.ExpDrugDosages[i];
                if (dosage.ExpDrugWrappings == null || dosage.ExpDrugWrappings.Count == 0)
                {
                    dosage.ExpDrugWrappings = new List <EXP_DrugWrapping> {
                        new EXP_DrugWrapping()
                    };
                }
                if (dosage.ExpDrugSubstances == null || dosage.ExpDrugSubstances.Count == 0)
                {
                    dosage.ExpDrugSubstances = new List <EXP_DrugSubstance> {
                        new EXP_DrugSubstance()
                        {
                            ExpDrugSubstanceManufactures = new List <EXP_DrugSubstanceManufacture>()
                            {
                                new EXP_DrugSubstanceManufacture()
                            }
                        }
                    };
                }
                if (dosage.ExpDrugPrices == null)
                {
                    dosage.ExpDrugPrices = new List <EXP_DrugPrice>();
                }

                ViewData["MeasureList" + dosage.Id] = new SelectList(measures, "Id", "name",
                                                                     model.ExpDrugDosages[i].DosageMeasureTypeId);
                ViewData["SaleTypeList" + dosage.Id] = new SelectList(sales, "Id", "NameRu", model.ExpDrugDosages[i].SaleTypeId);
                ViewData["BestBeforeMeasureTypeList" + dosage.Id] = new SelectList(measures, "id", "short_name",
                                                                                   model.ExpDrugDosages[i].BestBeforeMeasureTypeDicId);
                ViewData["AppPeriodMixMeasureList" + dosage.Id] = new SelectList(measures, "id", "short_name",
                                                                                 model.ExpDrugDosages[i].AppPeriodMixMeasureDicId);
                ViewData["AppPeriodOpenMeasureList" + dosage.Id] = new SelectList(measures, "id", "short_name",
                                                                                  model.ExpDrugDosages[i].AppPeriodOpenMeasureDicId);
                for (var j = 0; j < dosage.ExpDrugWrappings.Count; j++)
                {
                    var wrap = dosage.ExpDrugWrappings[j];
                    ViewData["WrappingTypes" + wrap.Id] = new SelectList(wrappingTypes, "Id", "NameRu",
                                                                         wrap.WrappingTypeId);
                    ViewData["Boxes" + wrap.Id]           = new SelectList(boxes, "Id", "name", wrap.WrappingKindId);
                    ViewData["SizeMeasureList" + wrap.Id] = new SelectList(measures, "Id", "short_name",
                                                                           wrap.SizeMeasureId);
                    ViewData["VolumeMeasureList" + wrap.Id] = new SelectList(measures, "Id", "short_name",
                                                                             wrap.VolumeMeasureId);
                }

                for (var j = 0; j < dosage.ExpDrugPrices.Count; j++)
                {
                    var price = dosage.ExpDrugPrices[j];
                    model.ExpDrugDosages[i].ExpDrugPrices[j].PrimaryText      = drugDeclarationRepository.GetNameByWrappingNames(price.PrimaryValue);
                    model.ExpDrugDosages[i].ExpDrugPrices[j].SecondaryText    = drugDeclarationRepository.GetNameByWrappingNames(price.SecondaryValue);
                    model.ExpDrugDosages[i].ExpDrugPrices[j].IntermediateText = drugDeclarationRepository.GetNameByWrappingNames(price.IntermediateValue);
                }

                for (var j = 0; j < dosage.ExpDrugSubstances.Count; j++)
                {
                    var id = dosage.ExpDrugSubstances[j].Id.ToString();
                    dosage.ExpDrugSubstances[j].CategoryName = GetCategoryName(dosage.ExpDrugSubstances[j].sr_substances);
                    dosage.ExpDrugSubstances[j].CategoryPos  = dosage.ExpDrugSubstances[j].sr_substances?.category_pos;
                    ViewData["SubstanceTypes" + id]          = new SelectList(substanceTypes, "Id", "name",
                                                                              dosage.ExpDrugSubstances[j].SubstanceTypeId);
                    ViewData["Origins" + id]    = new SelectList(origins, "Id", "NameRu", dosage.ExpDrugSubstances[j].OriginId);
                    ViewData["NormDocs" + id]   = new SelectList(normDocs, "Id", "NameRu", dosage.ExpDrugSubstances[j].NormDocFarmId);
                    ViewData["PlantKinds" + id] = new SelectList(plantKinds, "Id", "NameRu",
                                                                 dosage.ExpDrugSubstances[j].PlantKindId);
                    ViewData["SubstanceMeasureList" + id] = new SelectList(measures, "Id", "short_name",
                                                                           dosage.ExpDrugSubstances[j].MeasureId);

                    /*          ViewData["SubstanceCounties" + id] = new SelectList(countries, "Id", "name",
                     *            dosage.ExpDrugSubstances[j].CountryId);*/
                    ViewData["IsControlList" + id] = new SelectList(booleans, "IsSign", "NameRu",
                                                                    dosage.ExpDrugSubstances[j].IsControl);
                    ViewData["IsPoisonList" + id] = new SelectList(booleans, "IsSign", "NameRu",
                                                                   dosage.ExpDrugSubstances[j].IsPoison);

                    /*  ViewData["SubstanceCounties" + i] = new SelectList(countries, "Id", "name",
                     *    dosage.ExpDrugSubstances[j].CountryId);*/
                    if (dosage.ExpDrugSubstances[j].ExpDrugSubstanceManufactures != null)
                    {
                        for (var k = 0; k < dosage.ExpDrugSubstances[j].ExpDrugSubstanceManufactures.Count; k++)
                        {
                            ViewData[
                                "SubstanceCounties" + dosage.ExpDrugSubstances[j].ExpDrugSubstanceManufactures[k].Id
                            ] =
                                new SelectList(countries, "Id", "name",
                                               dosage.ExpDrugSubstances[j].ExpDrugSubstanceManufactures[k].CountryId);
                        }
                    }
                    else
                    {
                        dosage.ExpDrugSubstances[j].ExpDrugSubstanceManufactures =
                            new List <EXP_DrugSubstanceManufacture> {
                            new EXP_DrugSubstanceManufacture()
                        };
                    }
                }
            }



            ViewData["IsGrlsList"] = new SelectList(booleans, "IsSign", "NameRu", model.IsGrls);
            ViewData["IsGmpList"]  = new SelectList(booleans, "IsSign", "NameRu", model.IsGmp);

            var manufactures = repository.GetManufactureTypeList();

            ViewData["ManufactureTypeList"] = new SelectList(manufactures, "Id", "NameRu", model.ManufactureTypeId);

            /*    ViewData["BestBeforeMeasureTypeList"] = new SelectList(measures, "id", "short_name",
             *      model.BestBeforeMeasureTypeDicId);
             *  ViewData["AppPeriodMixMeasureList"] = new SelectList(measures, "id", "short_name",
             *      model.AppPeriodMixMeasureDicId);
             *  ViewData["AppPeriodOpenMeasureList"] = new SelectList(measures, "id", "short_name",
             *      model.AppPeriodOpenMeasureDicId);
             */
            for (var i = 0; i < model.ExpDrugOtherCountries.Count; i++)
            {
                ViewData["OtherCounties" + i] = new SelectList(countries, "Id", "name",
                                                               model.ExpDrugOtherCountries[i].CountryId);
            }

            var orgManufactureTypes = repository.GetDictionaries(CodeConstManager.DIC_ORG_MANUFACTURE_TYPE);
            var countyDics          = repository.GetDictionaries(CodeConstManager.DIC_COUNTRY_TYPE);
            var opfTypeDics         = repository.GetDictionaries(CodeConstManager.DIC_OPF_TYPE);

            ViewData["OrgManufactureTypes"] = new SelectList(orgManufactureTypes, "Id", "Name", null);
            ViewData["CountryDics"]         = new SelectList(countyDics, "Id", "Name", null);
            ViewData["OpfTypeDics"]         = new SelectList(opfTypeDics, "Id", "Name", null);

            for (var i = 0; i < model.ExpDrugOrganizationses.Count; i++)
            {
                var id = model.ExpDrugOrganizationses[i].Id.ToString();
                ViewData["OrgManufactureTypes" + id] = new SelectList(orgManufactureTypes, "Id", "name",
                                                                      model.ExpDrugOrganizationses[i].OrgManufactureTypeDicId);
                ViewData["CountryDics" + id] = new SelectList(countyDics, "Id", "name",
                                                              model.ExpDrugOrganizationses[i].CountryDicId);
                ViewData["OpfTypeDics" + id] = new SelectList(opfTypeDics, "Id", "name",
                                                              model.ExpDrugOrganizationses[i].OpfTypeDicId);
                var manufacture = repository.GetDictionaryById(CodeConstManager.DIC_ORG_MANUFACTURE_TYPE,
                                                               model.ExpDrugOrganizationses[i].OrgManufactureTypeDicId);
                if (manufacture != null)
                {
                    model.ExpDrugOrganizationses[i].ManufactureName = manufacture.Name;
                }
            }
            var changeTypes = repository.GetDicChangeTypes().ToArray();

            ViewData["ChangeTypes"] = new SelectList(changeTypes, "Id", "Code", 0);
            for (var i = 0; i < model.ExpDrugChangeTypes.Count; i++)
            {
                ViewData["ChangeTypes" + i] = new SelectList(changeTypes, "Id", "Code",
                                                             model.ExpDrugChangeTypes[i].ChangeTypeId);
            }

            var markList = drugPrimaryRepo.GetPrimaryMarkList(model.Id, null);

            var remarkTypes = repository.GetRemarkTypes().ToArray();

            ViewData["RemarkTypes" + model.Id] = new SelectList(remarkTypes, "Id", "NameRu",
                                                                null);
            model.ExpExpertiseStageRemarks = new List <EXP_ExpertiseStageRemark>();
            foreach (var expDrugPrimaryRemark in markList)
            {
                model.ExpExpertiseStageRemarks.Add(expDrugPrimaryRemark);
            }

            if (model.ExpExpertiseStageRemarks.Count == 0)
            {
                model.ExpExpertiseStageRemarks.Add(new EXP_ExpertiseStageRemark());
            }
            else
            {
                model.IsShowRemark = true;
            }

            foreach (var expDrugPrimaryRemark in model.ExpExpertiseStageRemarks)
            {
                ViewData["RemarkTypes" + model.Id + "_" + expDrugPrimaryRemark.Id] = new SelectList(remarkTypes,
                                                                                                    "Id", "NameRu",
                                                                                                    expDrugPrimaryRemark.RemarkTypeId);
            }
            ViewBag.PaymentOverdue = model.EXP_DirectionToPays.Any(e => e.Type == 1 &&
                                                                   e.Status.Code == Dictionary.ExpDirectionToPayStatus.PaymentExpired);
            model.Letters = new List <EXP_DrugCorespondence>(drugPrimaryRepo.GetDrugCorespondences(model.Id, true));
        }
Example #9
0
        public ActionResult PrimaryPageView(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var expertiseStage = new ExpertiseStageRepository().GetById(id);

            if (expertiseStage == null)
            {
                return(HttpNotFound());
            }
            var primaryRepository = new DrugPrimaryRepository();
            var ntd = primaryRepository.GetPrimaryNtdByDeclarationId(expertiseStage.DeclarationId);

            if (ntd == null)
            {
                ntd = new EXP_DrugPrimaryNTD
                {
                    DrugDeclarationId   = expertiseStage.DeclarationId,
                    EXP_DrugDeclaration = expertiseStage.EXP_DrugDeclaration
                };
            }
            var repository = new ReadOnlyDictionaryRepository();

            ViewData["TypeNDList" + expertiseStage.DeclarationId] = new SelectList(repository.GetDicTypeNDs(), "Id", "NameRu",
                                                                                   ntd.TypeNDId);
            ViewData["TypeFileNDList" + expertiseStage.DeclarationId] = new SelectList(repository.GetDicTypeFileNDs(), "Id", "NameRu",
                                                                                       ntd.TypeFileNDId);

            var model = new PrimaryEntity
            {
                EXP_DrugPrimaryNTD  = ntd,
                EXP_DrugDeclaration = expertiseStage.EXP_DrugDeclaration,
                DrugDeclarationId   = expertiseStage.DeclarationId.ToString(),
                Applicant           = new EmployeesRepository().GetById(expertiseStage.EXP_DrugDeclaration.OwnerId),
                Editor = UserHelper.GetCurrentEmployee(),
                ExpExpertiseStageRemarks = new List <EXP_ExpertiseStageRemark>(),
                ExpDrugPrimaryKinds      = primaryRepository.GetPrimaryKindList(expertiseStage.DeclarationId),
                ExpeditedType            = expertiseStage.EXP_DrugDeclaration.ExpeditedType,
                ExpStageId   = expertiseStage.Id,
                CurrentStage = new StageModel()
                {
                    CurrentStage = GetExpertiseStage(expertiseStage.Id),
                    StageResults = repository.GetStageResultsByStage(expertiseStage.StageId)
                }
            };
            var employeName = "";

            if (UserHelper.GetCurrentEmployee() != null)
            {
                employeName = UserHelper.GetCurrentEmployee().DisplayName;
            }
            ViewBag.CurrentEmployeeName = employeName;
            var markList    = primaryRepository.GetPrimaryMarkList(expertiseStage.DeclarationId, CodeConstManager.STAGE_PRIMARY);
            var remarkTypes = repository.GetRemarkTypes().ToArray();

            ViewData["RemarkTypes" + model.DrugDeclarationId] = new SelectList(remarkTypes, "Id", "NameRu",
                                                                               null);
            foreach (var expDrugPrimaryRemark in markList)
            {
                model.ExpExpertiseStageRemarks.Add(expDrugPrimaryRemark);
            }
            foreach (var expDrugPrimaryRemark in model.ExpExpertiseStageRemarks)
            {
                ViewData["RemarkTypes" + model.DrugDeclarationId + "_" + expDrugPrimaryRemark.Id] = new SelectList(remarkTypes, "Id", "NameRu",
                                                                                                                   expDrugPrimaryRemark.RemarkTypeId);
            }
            model.ExpDrugCorespondences = primaryRepository.GetDrugCorespondences(expertiseStage.DeclarationId);


            return(PartialView(model));
        }
Example #10
0
        public virtual ActionResult UpdateOtd(Guid stageId, int noteId, bool isChecked)
        {
            var success = new DrugPrimaryRepository().UpdateOtd(stageId, noteId, isChecked, UserHelper.GetCurrentEmployee().Id);

            return(Json(new { success }));
        }
Example #11
0
        public virtual ActionResult GetCorespondence(string id)
        {
            var mail = new DrugPrimaryRepository().GetCorespondence(id);

            return(Json(new { mail.NumberLetter, mail.Subject, mail.Note, mail.DateSend }));
        }
Example #12
0
        public virtual ActionResult UpdateFinalDocument(string fieldName, string fieldValue, Guid objectId)
        {
            var finalDoc = new DrugPrimaryRepository().UpdateFinalDocument(fieldName, fieldValue, objectId, UserHelper.GetCurrentEmployee().Id);

            return(Json(new { Success = true, DocId = finalDoc.Id, Status = finalDoc.EXP_ExpertiseStageDosage.FinalDocStatus }));
        }