public virtual ActionResult Edit(List <EvaluationTrackingModel> model)
        {
            try
            {
                foreach (var itemModel in model)
                {
                    if (itemModel.EvaluationTrackingId > 0)
                    {
                        ClientEvaluationTracking.ModifiedModel(
                            itemModel, IDBContext.Current.UserName);
                    }
                    else
                    {
                        ClientEvaluationTracking.SaveModel(
                            itemModel, IDBContext.Current.UserName);
                    }
                }

                if (model.Count == 0)
                {
                    return(Json(Url.Action("Details", new { operationNumber = string.Empty })));
                }

                string op = ClientEvaluationTracking.GetOperationNumber(model[0].ResultsMatrixId);
                return(Json(Url.Action("Details", new { operationNumber = op })));
            }
            catch (Exception e)
            {
                Logger.GetLogger().WriteError(
                    "EvaluationTracking", "Error when edit Evaluation Tracking: ", e);
                throw;
            }
        }
        private EvaluationTrackingModel LoadDropDownList()
        {
            EvaluationTrackingModel result = new EvaluationTrackingModel();
            string language  = IDBContext.Current.CurrentLanguage;
            var    listTopic = ClientEvaluationTracking.GetTopic(language)
                               .OrderBy(x => x.Name).ToList();

            result.GetTopicIntervention     = listTopic;
            result.GetTopicEvaluation       = listTopic;
            result.GetMethodologyDem        = ClientEvaluationTracking.GetMethodology(language);
            result.GetMainTopicEvaluation   = listTopic;
            result.GetMainTopicIntervention = listTopic;
            result.GetMethodologyCurrent    = ClientEvaluationTracking.GetMethodology(language)
                                              .OrderBy(x => x.Name).ToList();
            result.GetMethodologyCurrent.Remove(result.GetMethodologyCurrent
                                                .First(x => x.Code == "ETMETHNA"));
            result.GetMethodologyCurrent.Remove(result.GetMethodologyCurrent
                                                .First(x => x.Code == "ETMETHB2009"));
            result.GetStage       = ClientEvaluationTracking.GetStage(language);
            result.GetResponsible = ClientEvaluationTracking.GetResponsible(language)
                                    .OrderBy(x => x.Name).ToList();
            result.GetSourceOfFunding    = ClientEvaluationTracking.GetSourceOfFunding(language);
            result.GetDocumentPermission = ClientEvaluationTracking.GetDocumentPermission(language);
            result.GetTypeDocument       = ClientEvaluationTracking.GetTypeDocument(language);
            result.GetTypeDocumentString = ClientEvaluationTracking.GetTypeDocumentString(language);
            result.GetAllStageString     = ClientEvaluationTracking.GetAllStageString(language);

            return(result);
        }
        public virtual ActionResult TablePartial(int idEvaluationDocument)
        {
            var modelDoc = ClientEvaluationTracking.GetDocument(
                idEvaluationDocument, IDBContext.Current.Operation);

            return(PartialView(
                       "~/Areas/EvaluationTracking/Views/EvaluationTracking/Partial/_DocumentTablePartial.cshtml",
                       modelDoc.OrderByDescending(x => x.DocumentEvaluationTrackingId).ToList()));
        }
        public virtual ActionResult Details(string operationNumber)
        {
            var listApprovedOrNA = ClientEvaluationTracking
                                   .VerifyOperationApproved(operationNumber, IDBContext.Current.CurrentLanguage);

            ViewBag.CodeNotChangedReason = listApprovedOrNA[0].Code;
            var model = ClientEvaluationTracking
                        .GetDetailsModel(operationNumber, IDBContext.Current.CurrentLanguage);

            return(View(model));
        }
        public virtual ActionResult Index(string operationNumber)
        {
            var result = ClientEvaluationTracking.IfExistEvaluation(operationNumber);

            if (result.ExistEvaluation == true)
            {
                return(RedirectToAction("Details", new { operationNumber = operationNumber }));
            }

            return(View(result));
        }
 public virtual ActionResult DeleteDocument(int documentEvaluationTrackingId)
 {
     try
     {
         bool boolRemoveDoc = ClientEvaluationTracking.DeleteDocument(documentEvaluationTrackingId);
         return(Json(new { responseDeleteDoc = boolRemoveDoc }));
     }
     catch (Exception e)
     {
         Logger.GetLogger().WriteError(
             "EvaluationTracking", "Error when delete document Evaluation Tracking: ", e);
         throw;
     }
 }
 public virtual ActionResult SaveDocuments(List <EvaluationTrackingModel> model)
 {
     try
     {
         string stringDocumentId = ClientEvaluationTracking.SaveDocument(model);
         return(Json(new { DocumentEvaluationTrackingId = stringDocumentId }));
     }
     catch (Exception e)
     {
         Logger.GetLogger().WriteError(
             "EvaluationTracking", "Error when edit Evaluation Tracking: ", e);
         throw;
     }
 }
 public virtual ActionResult StageValidation(int resultsMatrixId, string verifyContent)
 {
     try
     {
         var StageValidation = ClientEvaluationTracking
                               .GetStageValidationData(resultsMatrixId, verifyContent);
         return(Json(new { StageValidation = StageValidation[0].RESP }));
     }
     catch (Exception e)
     {
         Logger.GetLogger().WriteError(
             "EvaluationTracking", "Error when edit Evaluation Tracking: ", e);
         throw;
     }
 }
        public virtual JsonResult FilterStage(EvaluationTrackingModel model)
        {
            List <int> stageIds = new List <int>();

            if (model.MethodologyCurrentId.HasValue)
            {
                stageIds.Add(model.MethodologyCurrentId.Value);
                model.GetStage = ClientEvaluationTracking
                                 .GetStageFilter(IDBContext.Current.CurrentLanguage, stageIds)
                                 .OrderBy(x => x.ConvergenceMasterDataId).ToList();
            }

            return(new JsonResult()
            {
                Data = model.GetStage
            });
        }
        public virtual JsonResult FilterTypeDocument(List <int> IdStage)
        {
            EvaluationTrackingModel result = new EvaluationTrackingModel();

            result.GetTypeDocument = ClientEvaluationTracking
                                     .GetTypeDocumentFilter(IDBContext.Current.CurrentLanguage, IdStage)
                                     .OrderBy(x => x.ConvergenceMasterDataId).ToList();

            var resultNamesChanged = from r in result.GetTypeDocument
                                     select new
            {
                value = r.ConvergenceMasterDataId,
                text  = r.Name
            };

            return(new JsonResult()
            {
                Data = resultNamesChanged
            });
        }
        private EvaluationTrackingModel InitEvaluationItem(string operationNumber)
        {
            var listApprovedOrNA = ClientEvaluationTracking
                                   .VerifyOperationApproved(operationNumber, IDBContext.Current.CurrentLanguage);

            var listItems = new List <SelectListItem>();

            listItems.Add(new SelectListItem
            {
                Text     = listApprovedOrNA[0].Name,
                Value    = Convert.ToString(listApprovedOrNA[0].ConvergenceMasterDataId),
                Selected = true
            });

            ViewBag.CodeNotChangedReason = listApprovedOrNA[0].Code;
            ViewBag.itemAprrovedOrNA     = listItems;
            int idMatrix = ClientEvaluationTracking.GetResultsMatrix(operationNumber);

            EvaluationTrackingModel model = LoadDropDownList();

            var demMethodology = model.GetMethodologyDem.ToList();

            foreach (var item in demMethodology)
            {
                if (!listItems.Any(x => x.Value == item.ConvergenceMasterDataId.ToString()))
                {
                    model.GetMethodologyDem.Remove(item);
                }
            }

            model.ResultsMatrixId      = idMatrix;
            model.OperationNumber      = operationNumber;
            model.MethodologyCurrentId = model.GetMethodologyCurrent[0].ConvergenceMasterDataId;
            FilterStage(model);
            model.ResultsMatrix = ClientEvaluationTracking.GetHeaderResultsMatrix(operationNumber);

            return(model);
        }
        public virtual ActionResult EditEvaluationTracking(string operationNumber)
        {
            var listApprovedOrNA = ClientEvaluationTracking
                                   .VerifyOperationApproved(operationNumber, IDBContext.Current.CurrentLanguage);

            ViewBag.CodeNotChangedReason = listApprovedOrNA[0].Code;
            int idMatrix = ClientEvaluationTracking.GetResultsMatrix(operationNumber);
            List <EvaluationTrackingModel> model = ClientEvaluationTracking
                                                   .GetDetailsModel(operationNumber, IDBContext.Current.CurrentLanguage);
            EvaluationTrackingModel        loadDropDownList = LoadDropDownList();
            List <EvaluationTrackingModel> itemModel        = new List <EvaluationTrackingModel>();

            foreach (var item in model)
            {
                item.GetTopicIntervention     = loadDropDownList.GetTopicIntervention;
                item.GetTopicEvaluation       = loadDropDownList.GetTopicEvaluation;
                item.GetMethodologyDem        = loadDropDownList.GetMethodologyDem;
                item.GetMainTopicEvaluation   = loadDropDownList.GetTopicEvaluation;
                item.GetMainTopicIntervention = loadDropDownList.GetTopicIntervention;
                item.GetMethodologyCurrent    = loadDropDownList.GetMethodologyCurrent;
                item.GetStage              = loadDropDownList.GetStage;
                item.GetResponsible        = loadDropDownList.GetResponsible;
                item.GetSourceOfFunding    = loadDropDownList.GetSourceOfFunding;
                item.GetTypeDocument       = loadDropDownList.GetTypeDocument;
                item.GetDocumentPermission = loadDropDownList.GetDocumentPermission;
                item.GetTypeDocumentString = loadDropDownList.GetTypeDocumentString;
                item.GetAllStageString     = loadDropDownList.GetAllStageString;
                itemModel.Add(item);
            }

            var templateModel = InitEvaluationItem(operationNumber);

            templateModel.EvaluationTrackingId = -1;
            itemModel.Add(templateModel);

            return(View(itemModel));
        }