public void AddMeetingNegation([Bind] NewMeetingDto model)
        {
            //			Console.WriteLine ("AddMeeting");
            String validateCreateMsg = validateCreateMeeting(model);

            if (validateCreateMsg != null)
            {
                model.ResponseMessage = validateCreateMsg;
                var temp = new NewMeeting {
                    Model = model
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
            }
            else
            {
                model.HasNegation = true;
                model.Terminate   = DateTime.Today;
                int?idCase = createMeeting(model);
                int az     = idCase.GetValueOrDefault();
                //String Response = "Se ha guardado exitosamente";
                Index();
            }
        }
Beispiel #2
0
        public int?createMeeting(NewMeetingDto imputed)
        {
            using (var db = FactoryConn.GetConn()) {
                int?result = null;
                try {
                    Case    caseDetention = new Case();
                    Imputed newImputed    = new Imputed();
                    newImputed.Name          = imputed.Name.Trim();
                    newImputed.LastNameP     = imputed.LastNameP.Trim();
                    newImputed.LastNameM     = imputed.LastNameM.Trim();
                    newImputed.FoneticString = services.getFoneticByName(imputed.Name, imputed.LastNameP, imputed.LastNameM);
                    newImputed.Gender        = imputed.Gender.GetValueOrDefault();
                    newImputed.BirthDate     = imputed.DateBirth.GetValueOrDefault();

                    var reincident = db.Table <Imputed> ().Where(impu => impu.LastNameM == newImputed.LastNameM &&
                                                                 impu.LastNameP == newImputed.LastNameP && impu.Name == newImputed.Name &&
                                                                 impu.BirthDate == newImputed.BirthDate).ToList();
                    if (reincident != null && reincident.Count > 0)
                    {
                        caseDetention.Recidivist = true;
                    }
                    else
                    {
                        caseDetention.Recidivist = false;
                    }

//					caseDetention.Status = services.statusCasefindByCode (Constants.CASE_STATUS_MEETING);
                    caseDetention.StatusCaseId = services.statusCasefindByCode(Constants.CASE_STATUS_MEETING).Id;
                    caseDetention.IdFolder     = imputed.IdFolder;
                    caseDetention.DateCreate   = DateTime.Today;
                    //caseDetention.setChangeArrangementType(false);
                    // se agrega para poder contar si un caso cambia de MC a SCPP en algun formato de audiencia
                    //caseDetention = caseRepository.save(caseDetention);
                    db.Insert(caseDetention);
                    Meeting meeting = new Meeting();
                    meeting.MeetingType     = Constants.MEETING_PROCEDURAL_RISK;
                    meeting.CaseDetentionId = caseDetention.Id;
//					meeting.CaseDetention = caseDetention;
                    StatusMeeting statusMeeting = services.statusMeetingfindByCode(Constants.S_MEETING_INCOMPLETE);
                    meeting.StatusMeetingId = statusMeeting.Id;
//					meeting.StatusMeeting = statusMeeting;
                    //				meeting.ReviewerId=LoggedUserId(); TODO agrega al usuario asociado al dispositivo
                    meeting.DateCreate = DateTime.Today;
                    db.Insert(meeting);
                    newImputed.MeetingId = meeting.Id;
//					newImputed.Meeting = meeting;
                    db.Insert(newImputed);
                    db.Update(meeting);
                    db.Update(caseDetention);
                    //				imputedRepository.save(imputed);
                    result = caseDetention.Id;
                } catch (Exception e) {
                    Console.WriteLine("e.Message>" + e.Message + "<< createMeeting");
                }
                db.Close();
                return(result);
            }
        }
Beispiel #3
0
 public String validateCaseConditionalReprieve(NewMeetingDto model)
 {
     if (model.DateBirth.HasValue)
     {
         int age = services.calculateAge(model.DateBirth.Value);
         if (age.CompareTo(18) < 0)
         {
             return("El imputado debe tener más de 18 años para continuar");
         }
     }
     else
     {
         return("Favor de ingresar la fecha de nacimiento del imputado.");
     }
     if (model.IdMP != null)
     {
         var repeated = 0;
         var fonetic  = services.getFoneticByName(model.Name, model.LastNameP, model.LastNameM);
         using (var db = FactoryConn.GetConn()) {
             var casos = db.Table <Case> ().Where(cs => cs.IdMP == model.IdMP).ToList();
             if (casos != null && casos.Count > 0)
             {
                 foreach (Case c in casos)
                 {
                     var entrevistas = db.Table <Meeting> ().Where(ent => ent.CaseDetentionId == c.Id).ToList();
                     if (entrevistas != null && entrevistas.Count > 0)
                     {
                         foreach (Meeting entrevista in entrevistas)
                         {
                             var imputado = db.Table <Imputed> ().Where(imp => imp.MeetingId == entrevista.Id &&
                                                                        imp.FoneticString == fonetic &&
                                                                        imp.BirthDate == model.DateBirth).ToList();
                             if (imputado != null && imputado.Count > 0)
                             {
                                 repeated++;
                             }
                         }
                     }
                 }
             }
             db.Close();
         }
         if (repeated > 0)
         {
             return("El número de carpeta judicial y el imputado ya se encuentran registrados.");
         }
     }
     else
     {
         return("Favor de ingresar el número de carpeta judicial para continuar");
     }
     return(null);
 }
Beispiel #4
0
        public void AddCaseConditionalReprieve([Bind] NewMeetingDto model)
        {
            String validateCreateMsg = validateCaseConditionalReprieve(model);

            if (validateCreateMsg != null)
            {
                model.ResponseMessage = validateCreateMsg;
                var temp = new NewConditionalReprieve2 {
                    Model = model
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
            }
            else
            {
                int?idCase = createCaseConditionalReprieve(model);
                int az     = idCase.GetValueOrDefault();
                Index();
            }
        }
Beispiel #5
0
        public void AddMeeting([Bind] NewMeetingDto model)
        {
            String validateCreateMsg = validateCreateMeeting(model);

            if (validateCreateMsg != null)
            {
                model.ResponseMessage = validateCreateMsg;
                var temp = new NewMeeting {
                    Model = model
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
            }
            else
            {
                int?idCase = createMeeting(model);
                int az     = idCase.GetValueOrDefault();
                //String Response = "Se ha guardado exitosamente";
                MeetingDatosPersonales(az);
            }
        }
Beispiel #6
0
        public int?createCaseConditionalReprieve(NewMeetingDto imputed)
        {
            int?result = null;

            using (var db = FactoryConn.GetConn()) {
                try {
                    db.CreateTable <User> ();
                    var  usrList  = db.Table <User> ().ToList();
                    User reviewer = usrList.FirstOrDefault();
                    int  revId    = 0;
                    if (reviewer != null)
                    {
                        revId = reviewer.Id;
                    }

                    Case    caseDetention = new Case();
                    Imputed newImputed    = new Imputed();
                    newImputed.Name          = imputed.Name.Trim();
                    newImputed.LastNameP     = imputed.LastNameP.Trim();
                    newImputed.LastNameM     = imputed.LastNameM.Trim();
                    newImputed.FoneticString = services.getFoneticByName(imputed.Name, imputed.LastNameP, imputed.LastNameM);
                    newImputed.Gender        = imputed.Gender.GetValueOrDefault();
                    newImputed.BirthDate     = imputed.DateBirth.GetValueOrDefault();

                    var reincident = db.Table <Imputed> ().Where(impu => impu.LastNameM == newImputed.LastNameM &&
                                                                 impu.LastNameP == newImputed.LastNameP && impu.Name == newImputed.Name &&
                                                                 impu.BirthDate == newImputed.BirthDate).ToList();
                    if (reincident != null && reincident.Count > 0)
                    {
                        caseDetention.Recidivist = true;
                    }
                    else
                    {
                        caseDetention.Recidivist = false;
                    }

//					caseDetention.Status = services.statusCasefindByCode (Constants.CASE_STATUS_CONDITIONAL_REPRIEVE);
                    caseDetention.StatusCaseId = services.statusCasefindByCode(Constants.CASE_STATUS_CONDITIONAL_REPRIEVE).Id;

                    caseDetention.IdMP     = imputed.IdMP;
                    caseDetention.IdFolder = "SIN EVALUACIÓN REGISTRADA";

                    caseDetention.DateCreate = DateTime.Today;

                    //caseDetention.setChangeArrangementType(false);
                    // se agrega para poder contar si un caso cambia de MC a SCPP en algun formato de audiencia
                    //caseDetention = caseRepository.save(caseDetention);
                    db.Insert(caseDetention);
                    Meeting meeting = new Meeting();
                    meeting.MeetingType     = Constants.MEETING_CONDITIONAL_REPRIEVE;
                    meeting.CaseDetentionId = caseDetention.Id;
//					meeting.CaseDetention = caseDetention;
                    StatusMeeting statusMeeting = services.statusMeetingfindByCode(Constants.S_MEETING_INCOMPLETE);
                    meeting.StatusMeetingId = statusMeeting.Id;
//					meeting.StatusMeeting = statusMeeting;
                    meeting.DateCreate = DateTime.Today;
                    db.Insert(meeting);
                    meeting.ReviewerId = revId;
//					meeting.Reviewer = reviewer;
                    newImputed.MeetingId = meeting.Id;
//					newImputed.Meeting = meeting;
                    db.Insert(newImputed);
                    db.Update(meeting);
                    db.Update(caseDetention);
                    result = caseDetention.Id;
                } catch (Exception e) {
                    Console.WriteLine("e.Message>" + e.Message + "<< createMeeting");
                }
                db.Close();
            }
            return(result);
        }