public void InsertStatusMeeting(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<StatusMeeting> ();
				if (db.Table<StatusMeeting> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/status_meeting.txt", act);
					List<StatusMeeting> entities = new List<StatusMeeting> (); 
					foreach (String[] line in data) {
						try {
							StatusMeeting model = new StatusMeeting ();
							model.Id = int.Parse (line [0]);
							model.Status = line [1];
							model.Description = line [2];
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("StatusMeeting error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<StatusMeeting> ().ToList ();
					Console.WriteLine ("Se inserto en tabla StatusMeeting:");
					foreach (StatusMeeting m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Status);
					}
				}
				db.Close ();
			}
		}
Beispiel #2
0
        public void IndexVerificacion()
        {
            StatusMeeting statusMeeting1 = services.statusMeetingfindByCode(Constants.S_MEETING_INCOMPLETE);
            StatusMeeting statusMeeting2 = services.statusMeetingfindByCode(Constants.S_MEETING_INCOMPLETE_LEGAL);
            StatusCase    sc             = services.statusCasefindByCode(Constants.CASE_STATUS_MEETING);

            using (var db = FactoryConn.GetConn()) {
                var result = db.Query <MeetingTblDto> (
                    "SELECT cs.id_case as 'CaseId',cs.id_folder as 'IdFolder',im.name as 'Name',im.lastname_p as 'LastNameP',im.lastname_m as 'LastNameM',"
                    + " im.birth_date as 'DateBirth', im.gender as 'Gender', csm.status as 'StatusCode', csm.description as 'Description'"
                    + " FROM meeting as me "
                    + " left JOIN case_detention as cs ON me.id_case = cs.id_case "
                    + " left JOIN imputed as im ON im.id_meeting = me.id_meeting "
                    + " left JOIN cat_status_meeting as csm ON csm.id_status = me.id_status "
                    + " WHERE me.id_status in (?,?) "
                    //				+" and me.id_reviewer = 2 "
                    + " AND cs.id_status = ?; ", statusMeeting1.Id, statusMeeting2.Id, sc.Id);



                var temp = new MeetingList {
                    Model = result
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
                db.Close();
            }
        }
Beispiel #3
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);
            }
        }
        public void Index()
        {
            init();
            StatusMeeting statusMeeting1 = services.statusMeetingfindByCode(Constants.S_MEETING_INCOMPLETE);
            StatusMeeting statusMeeting2 = services.statusMeetingfindByCode(Constants.S_MEETING_INCOMPLETE_LEGAL);
            StatusCase    sc             = services.statusCasefindByCode(Constants.CASE_STATUS_MEETING);
            StatusCase    sc1            = services.statusCasefindByCode(Constants.ST_CASE_TABLET_ASSIGNED);

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

                var result = db.Query <MeetingTblDto> (
                    "SELECT cs.id_case as 'CaseId',cs.id_folder as 'IdFolder',im.name as 'Name',im.lastname_p as 'LastNameP',im.lastname_m as 'LastNameM',"
                    + " im.birth_date as 'DateBirth', im.gender as 'Gender', csm.status as 'StatusCode', csm.description as 'Description'"
                    + " FROM meeting as me "
                    + " left JOIN case_detention as cs ON me.id_case = cs.id_case "
                    + " left JOIN imputed as im ON im.id_meeting = me.id_meeting "
                    + " left JOIN cat_status_meeting as csm ON csm.id_status = me.id_status"
                    + " WHERE me.id_status in (?,?) "
                    + " and me.id_reviewer = ? "
                    + " AND cs.id_status in (?,?); ", statusMeeting1.Id, statusMeeting2.Id, revId, sc.Id, sc1.Id);
                var temp = new MeetingList {
                    Model = result
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
                db.Close();
            }
        }
Beispiel #5
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);
        }
Beispiel #6
0
        public void Index()
        {
            using (var db = FactoryConn.GetConn()) {
                db.CreateTable <User> ();
                var  usrList  = db.Table <User> ().ToList();
                User reviewer = usrList.FirstOrDefault();
                int  revId    = 0;
                if (reviewer != null && reviewer.Id > 0)
                {
                    revId = reviewer.Id;
                }

                //estatus de meeting terminados
                StatusMeeting statusMeeting2 = services.statusMeetingfindByCode(Constants.S_MEETING_INCOMPLETE_LEGAL);
                StatusCase    sc             = services.statusCasefindByCode(Constants.CASE_STATUS_MEETING);
                StatusCase    sc1            = services.statusCasefindByCode(Constants.ST_CASE_TABLET_ASSIGNED);

                var result = db.Query <MeetingTblDto> (
                    "SELECT cs.id_case as 'CaseId',cs.id_folder as 'IdFolder',im.name as 'Name',im.lastname_p as 'LastNameP',im.lastname_m as 'LastNameM',"
                    + " im.birth_date as 'DateBirth', im.gender as 'Gender', csm.status as 'StatusCode', csm.description as 'Description' , me.id_reviewer as 'ReviewerId' "
                    + " FROM meeting as me "
                    + " left JOIN case_detention as cs ON me.id_case = cs.id_case "
                    + " left JOIN imputed as im ON im.id_meeting = me.id_meeting "
                    + " left JOIN cat_status_meeting as csm ON csm.id_status = me.id_status "
                    + " WHERE me.id_status =? "
                    + " and me.id_reviewer = ? "
                    + " AND cs.id_status in (?,?); ", statusMeeting2.Id, revId, sc.Id, sc1.Id);
                var c1 = 0;
                if (result != null)
                {
                    for (c1 = 0; c1 < result.Count; c1++)
                    {
                        result [c1].Action = "meeting";
                    }
                }

                StatusVerification statusVerification1 = services.statusVerificationfindByCode(Constants.VERIFICATION_STATUS_AUTHORIZED);
                StatusVerification statusVerification2 = services.statusVerificationfindByCode(Constants.VERIFICATION_STATUS_MEETING_COMPLETE);
                StatusCase         scv  = services.statusCasefindByCode(Constants.CASE_STATUS_VERIFICATION);
                StatusCase         scv1 = services.statusCasefindByCode(Constants.ST_CASE_TABLET_ASSIGNED);

                var result2 = db.Query <MeetingTblDto> (
                    "SELECT cs.id_case as 'CaseId',cs.id_folder as 'IdFolder', "
                    + " csm.description as 'StatusCode', csm.description as 'Description'  , me.id_reviewer as 'ReviewerId' "
                    + " , me.id_verification as 'MeetingStatusId' "
                    + " FROM verification as me "
                    + " left JOIN case_detention as cs ON me.id_case = cs.id_case "
                    + "  left JOIN cat_status_verification as csm ON csm.id_status = me.id_status_verification "
                    + " WHERE me.id_status_verification  in (?,?) "
                    + " and me.id_reviewer = ? "
                    + " AND cs.id_status in (?,?); ", statusVerification1.Id, statusVerification2.Id, revId, scv.Id, scv1.Id);
                var c2 = 0;
                try {
                    if (result2 != null)
                    {
                        for (c2 = 0; c2 < result2.Count; c2++)
                        {
                            var id       = result2 [c2].MeetingStatusId;
                            var expected = db.Table <SourceVerification> ().Where(sv => sv.VerificationId == id && sv.Visible == true).ToList();
                            var finished = db.Table <SourceVerification> ().Where(sv => sv.VerificationId == id && sv.DateComplete != null && sv.Visible == true).ToList();
                            if (expected.Count == finished.Count)
                            {
                                result2 [c2].Action = "verification";
                            }
                            else
                            {
                                result2 [c2].Action = "verificationIncomplete";
                            }
                            var caseis = result2 [c2].CaseId;
                            var me     = db.Table <Meeting> ().Where(met => met.CaseDetentionId == caseis).FirstOrDefault();
                            if (me != null)
                            {
                                var imp = db.Table <Imputed> ().Where(iputad => iputad.MeetingId == me.Id).FirstOrDefault();
                                if (imp != null)
                                {
                                    result2 [c2].Name      = imp.Name;
                                    result2 [c2].LastNameP = imp.LastNameP;
                                    result2 [c2].LastNameM = imp.LastNameM;
                                    result2 [c2].Gender    = imp.Gender;
                                }
                            }
                        }
                    }
                } catch (Exception e) {
                    Console.WriteLine("excepcion en sincronizacion ");
                    Console.WriteLine(e.Message);
                }


                result.AddRange(result2);

                /////
                StatusMeeting statusMeetingNeg = services.statusMeetingfindByCode(Constants.S_MEETING_DECLINE);
                StatusCase    sc2     = services.statusCasefindByCode(Constants.CASE_STATUS_NOT_PROSECUTE);
                var           result3 = db.Query <MeetingTblDto> (
                    "SELECT cs.id_case as 'CaseId',cs.id_folder as 'IdFolder',im.name as 'Name',im.lastname_p as 'LastNameP',im.lastname_m as 'LastNameM',"
                    + " im.birth_date as 'DateBirth', im.gender as 'Gender', csm.status as 'StatusCode', csm.description as 'Description' , me.id_reviewer as 'ReviewerId' "
                    + " FROM meeting as me "
                    + " left JOIN case_detention as cs ON me.id_case = cs.id_case "
                    + " left JOIN imputed as im ON im.id_meeting = me.id_meeting "
                    + " left JOIN cat_status_meeting as csm ON csm.id_status = me.id_status "
                    + " WHERE me.id_status =? "
                    + " and me.id_reviewer = ? "
                    + " AND cs.id_status = ?; ", statusMeetingNeg.Id, revId, sc2.Id);
                var c3 = 0;
                if (result != null)
                {
                    for (c3 = 0; c3 < result3.Count; c3++)
                    {
                        result3 [c3].Action = "negacion";
                    }
                }
                result.AddRange(result3);
                /////



                var temp = new SyncCaseList {
                    Model = result
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
                db.Close();
            }
        }