public ActionResult SerialActData(Guid?assessmentId) { var assessment = db.OBK_AssessmentDeclaration.FirstOrDefault(o => o.Id == assessmentId); var numberCount = db.OBK_ActReception.Where(o => o.OBK_AssessmentDeclarationId == assessmentId).Count(); ViewData["ContractId"] = assessment.ContractId; ViewData["AttachPath"] = FileHelper.GetObjectPathRoot(); var model = new OBK_ActReception(); model.Id = Guid.NewGuid(); var exp = db.OBK_StageExpDocumentResult.FirstOrDefault(o => o.AssessmetDeclarationId == assessmentId); model.Number = assessment.Number + "-" + (numberCount + 1); model.OBK_AssessmentDeclarationId = assessmentId; var employee = db.Employees.FirstOrDefault(o => o.Id == assessment.EmployeeId); model.Declarer = employee.DisplayName; var product = db.OBK_RS_Products.FirstOrDefault(o => o.ContractId == assessment.ContractId); model.Producer = product.ProducerNameRu; ViewData["ProductSampleList"] = new SelectList(repository.GetProductSamples(), "Id", "Name"); ViewData["InspectionInstalledList"] = new SelectList(repository.GetInspectionInstalls(), "Id", "Name"); ViewData["PackageConditionList"] = new SelectList(repository.GetPackageConditions(), "Id", "Name"); ViewData["StorageConditionsList"] = new SelectList(repository.GetStorageConditions(), "Id", "Name"); ViewData["MarkingList"] = new SelectList(repository.GetMarkings(), "Id", "Name"); ViewData["OBKApplicants"] = new SelectList(repository.OBKApplicants(), "Id", "NameRU"); ViewData["ProductList"] = new SelectList(repository.OBKContractProducts(assessment.ContractId, model.Id), "Id", "DrugFormFullName"); return(PartialView(model)); }
public ActionResult ExpertActData(Guid assessmentId) { var model = db.OBK_ActReception.FirstOrDefault(o => o.OBK_AssessmentDeclarationId == assessmentId); var assessment = db.OBK_AssessmentDeclaration.FirstOrDefault(o => o.Id == assessmentId); ViewData["ContractId"] = assessment.ContractId; if (model == null) { model = new OBK_ActReception(); model.Id = Guid.NewGuid(); var exp = db.OBK_StageExpDocumentResult.FirstOrDefault(o => o.AssessmetDeclarationId == assessmentId); model.Number = assessment.Number; model.ActDate = exp.SelectionDate; model.Address = exp.SelectionPlace; model.OBK_AssessmentDeclarationId = assessmentId; var employee = db.Employees.FirstOrDefault(o => o.Id == assessment.EmployeeId); model.Declarer = employee.DisplayName; var product = db.OBK_RS_Products.FirstOrDefault(o => o.ContractId == assessment.ContractId); model.Producer = product.ProducerNameRu; db.OBK_ActReception.Add(model); db.SaveChanges(); } var safetyRepository = new SafetyAssessmentRepository(); ViewData["ProductSampleList"] = new SelectList(safetyRepository.GetProductSamples(), "Id", "Name"); ViewData["InspectionInstalledList"] = new SelectList(safetyRepository.GetInspectionInstalls(), "Id", "Name"); ViewData["PackageConditionList"] = new SelectList(safetyRepository.GetPackageConditions(), "Id", "Name"); ViewData["StorageConditionsList"] = new SelectList(safetyRepository.GetStorageConditions(), "Id", "Name"); ViewData["MarkingList"] = new SelectList(safetyRepository.GetMarkings(), "Id", "Name"); ViewData["OBKApplicants"] = new SelectList(safetyRepository.OBKApplicants(), "Id", "NameRU"); return(PartialView(model)); }
public ActionResult ActSelection(string id) { var assess = GetSaDeclarationById(id); var model = new OBK_ActReception(); if (assess != null) { var temp = db.OBK_ActReception.FirstOrDefault(o => o.OBK_AssessmentDeclarationId == new Guid(id)); if (temp != null) { model = temp; } else { model.Id = Guid.NewGuid(); model.OBK_AssessmentDeclarationId = new Guid(id); db.OBK_ActReception.Add(model); db.SaveChanges(); } } var product = db.OBK_RS_Products.FirstOrDefault(o => o.ContractId == assess.ContractId); if (model.Producer == null && product != null) { repository.UpdateAct(assess, "Producer", model.Id, product.ProducerNameRu, UserHelper.GetCurrentEmployee().Id.ToString(), "Producer"); } if (model.ActDate == null) { repository.UpdateAct(assess, "ActDate", model.Id, DateTime.Now.ToString(), UserHelper.GetCurrentEmployee().Id.ToString(), "ActDate"); } if (model.Declarer == null) { repository.UpdateAct(assess, "Declarer", model.Id, UserHelper.GetCurrentEmployee().DisplayName, UserHelper.GetCurrentEmployee().Id.ToString(), "Declarer");; } ViewData["ContractId"] = assess.ContractId; var safetyRepository = new SafetyAssessmentRepository(); ViewData["ProductSampleList"] = new SelectList(safetyRepository.GetProductSamples(), "Id", "Name"); ViewData["InspectionInstalledList"] = new SelectList(safetyRepository.GetInspectionInstalls(), "Id", "Name"); ViewData["PackageConditionList"] = new SelectList(safetyRepository.GetPackageConditions(), "Id", "Name"); ViewData["StorageConditionsList"] = new SelectList(safetyRepository.GetStorageConditions(), "Id", "Name"); ViewData["MarkingList"] = new SelectList(safetyRepository.GetMarkings(), "Id", "Name"); ViewData["OBKApplicants"] = new SelectList(safetyRepository.OBKApplicants(), "Id", "NameRU"); return(PartialView("ActSelectionView", model)); }