Exemple #1
0
        public ActionResult EditContract(string id)
        {
            var repository = new SafetyAssessmentRepository();
            var contract   = repository.GetContractById(new Guid(id));
            var model      = repository.FindDeclarationByContract(new Guid(id));

            if (model == null)
            {
                model = new OBK_AssessmentDeclaration {
                    EmployeeId          = UserHelper.GetCurrentEmployee().Id,
                    Type_Id             = contract.OBK_Ref_Type.Id,
                    Id                  = Guid.NewGuid(),
                    CreatedDate         = DateTime.Now,
                    StatusId            = CodeConstManager.STATUS_DRAFT_ID,
                    CertificateDate     = DateTime.Now,
                    Contract_Id         = contract.Id,
                    IsDeleted           = false,
                    CertificateGMPCheck = contract.OBK_Ref_Type.Code == CodeConstManager.OBK_SA_DECLARATION
                };
                repository.SaveAssessmentDeclaration(model);
            }
            return(Json(model.Id, JsonRequestBehavior.AllowGet));
        }