public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //Document document = db.Documents.Find(id); //if (document == null) //{ // return HttpNotFound(); //} ViewBag.UiId = Guid.NewGuid().ToString(); var contractTypes = db.OBK_Ref_Type.Where(x => x.ViewOption == CodeConstManager.OBK_VIEW_OPTION_SHOW_ON_CREATE).OrderBy(x => x.Id).Select(o => new { o.Id, Name = o.NameRu, o.Code, o.NameKz }); var expertOrganizations = obkRepo.GetExpertOrganizations(); var signers = obkRepo.GetSigners(); var countries = db.Dictionaries.Where(x => x.Type == "Country").ToList(); var organizationForms = db.Dictionaries.Where(x => x.Type == "OpfType").ToList(); var docTypes = db.Dictionaries.Where(x => x.Type == "OBKContractDocumentType").ToList(); var currencies = db.Dictionaries.Where(x => x.Type == "Currency").ToList(); var contract = obkRepo.LoadContract(id.Value); var declarant = obkRepo.GetDeclarant(id.Value); //declarant.NameEn // var productInfo = obkRepo.GetProducts(id.Value); var prices = obkRepo.GetContractPrices(id.Value); var obkContract = db.OBK_Contract.Where(x => x.Id == id).FirstOrDefault(); obkContract.ObkRsProductCount = productInfo.Count; ViewBag.Contract = obkContract; ViewBag.ContractTypes = new SelectList(contractTypes, "Id", "Name", obkContract.Type); ViewBag.ExpertOrganizations = new SelectList(expertOrganizations, "Id", "Name", obkContract.ExpertOrganization); ViewBag.Signers = new SelectList(signers, "Id", "Name", obkContract.Signer); ViewBag.Countries = new SelectList(countries, "Id", "Name", declarant.CountryId); ViewBag.OrganizationForms = new SelectList(organizationForms, "Id", "Name", declarant.OrganizationFormId); Guid selectedNonResident = Guid.Empty; if (declarant.IsConfirmed) { selectedNonResident = declarant.Id.Value; } ViewBag.NamesNonResidents = new SelectList((IEnumerable <object>)obkRepo.GetNamesNonResidents(declarant.CountryId), "Id", "Name", selectedNonResident); ViewBag.DocTypes = new SelectList(docTypes, "Id", "Name", contract.BossDocType); ViewBag.BoolValues = new SelectList(new List <SelectListItem> { new SelectListItem { Selected = false, Text = "Нет", Value = false.ToString() }, new SelectListItem { Selected = false, Text = "Да", Value = true.ToString() }, }, "Value", "Text", contract.IsHasBossDocNumber.ToString()); ViewBag.Currencies = new SelectList(currencies, "Id", "Name", contract.CurrencyId); ViewData["Courrency"] = new SelectList(currencies, "Id", "Name"); ViewBag.declarant = declarant; ViewBag.productInfo = productInfo; ViewBag.prices = prices; ViewBag.ShowProductComments = true; ViewBag.HidePriceAndCurrency = true; #region Attachments var repository = new UploadRepository(); string type = ""; if (declarant.IsResident) { type = CodeConstManager.ATTACH_CONTRACT_FILE_RESIDENT; } else { type = CodeConstManager.ATTACH_CONTRACT_FILE_NON_RESIDENT; } var list = repository.GetAttachListEdit(id, type); ViewBag.ListAttachments = list; #endregion ViewBag.ShowMeetsRequirementsBtn = IsMeetsRequirementsBtnAllowed(id.Value); ViewBag.ShowDoesNotMeetRequirementsBtn = ViewBag.ShowMeetsRequirementsBtn; ViewBag.ShowReturnToApplicantBtn = IsShowReturnToApplicantBtnAllowed(id.Value); ViewBag.ShowSendToBossForApprovalBtn = IsShowSendToBossForApprovalBtnAllowed(id.Value); ViewBag.ShowSendToBossForApprovalWithWarningBtn = false; string questionMessage = ""; if (ViewBag.ShowSendToBossForApprovalBtn == false) { ViewBag.ShowSendToBossForApprovalWithWarningBtn = IsShowSendToBossForApprovalBtnWithWarningAllowed(id.Value, out questionMessage); } ViewBag.QuestionMessage = questionMessage; var isShowDoApprovementBtnAndShowRefuseApprovementBtnAllowed = IsShowDoApprovementBtnAllowed(id.Value); ViewBag.ShowDoApprovementBtn = isShowDoApprovementBtnAndShowRefuseApprovementBtnAllowed; ViewBag.ShowRefuseApprovementBtn = isShowDoApprovementBtnAndShowRefuseApprovementBtnAllowed; ViewBag.ShowShowRefuseReasonBtn = IsShowRefuseReasonBtnAllowed(id.Value); ViewBag.ShowRegisterBtn = IsRegisterBtnAllowed(id.Value); ViewBag.ShowAttachContractBtn = IsAttachContractBtnAllowed(id.Value); ViewBag.ShowSignContractBtn = IsSignContractBtnAllowed(id.Value); return(PartialView("Contract", contract)); }
public ActionResult GetExpertOrganizations() { var expertOrganizations = obkRepo.GetExpertOrganizations(); return(Json(expertOrganizations.ToList(), JsonRequestBehavior.AllowGet)); }