public void InsertFieldVerification(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<FieldVerification> ();
				if (db.Table<FieldVerification> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/field_verification.txt", act);
					List<FieldVerification> entities = new List<FieldVerification> (); 
					foreach (String[] line in data) {
						try {
							FieldVerification model = new FieldVerification ();
							model.Id = int.Parse (line [0]);
							model.Code = line [1];
							model.Section = line [2];
							model.SectionCode = int.Parse (line [3]);
							model.FieldName = line [4];
							model.IndexField = int.Parse (line [5]);
							model.IsObsolete = line [6].Equals ("1");
							model.IdSubsection = int.Parse (line [7]);
							model.Type = line [8];
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("FieldVerfication error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<FieldVerification> ().ToList ();
					Console.WriteLine ("Se inserto en tabla FieldVerfication:");
					foreach (FieldVerification m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Code);
					}
				}
				db.Close ();
			}
		}
		public void InsertStatusVerification(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<StatusVerification> ();
				if (db.Table<StatusVerification> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/status_verification.txt", act);
					List<StatusVerification> entities = new List<StatusVerification> (); 
					foreach (String[] line in data) {
						try {
							StatusVerification model = new StatusVerification ();
							model.Id = int.Parse (line [0]);
							model.Name = line [1];
							model.Description = line [2];
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("StatusVerification error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<StatusVerification> ().ToList ();
					Console.WriteLine ("Se inserto en tabla StatusVerification:");
					foreach (StatusVerification m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Name);
					}
				}
				db.Close ();
			}
		}
		public void InsertRegisterType(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<RegisterType> ();
				if (db.Table<RegisterType> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/register_type.txt", act);
					List<RegisterType> entities = new List<RegisterType> (); 
					foreach (String[] line in data) {
						try {
							RegisterType model = new RegisterType ();
							model.Id = int.Parse (line [0]);
							model.Name = line [1];
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("RegisterType error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<RegisterType> ().ToList ();
					Console.WriteLine ("Se inserto en tabla RegisterType:");
					foreach (RegisterType m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Name);
					}
				}
				db.Close ();
			}
		}
		public void InsertRelationship(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<Relationship> ();
				if (db.Table<Relationship> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/relationship.txt", act);
					List<Relationship> entities = new List<Relationship> (); 
					foreach (String[] line in data) {
						try {
							Relationship r = new Relationship ();
							r.Id = int.Parse (line [0]);
							r.Name = line [1];
							r.IsObsolete = line [2].Equals ("1");
							r.Specification = line [3].Equals ("1");
							entities.Add (r);
						} catch (Exception e) {
							Console.WriteLine ("Relationship error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<Relationship> ().ToList ();
					Console.WriteLine ("Se inserto en tabla Relationship:");
					foreach (Relationship m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Name);
					}
				}
				db.Close ();
			}
		}
		public void InsertLocationCat(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<Location> ();
				if (db.Table<Location> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/location.txt", act);
					List<Location> entities = new List<Location> (); 
					foreach (String[] line in data) {
						try {
							Location model = new Location ();
							model.Id = int.Parse (line [0]);
							model.MunicipalityId = long.Parse (line [1]);
							model.Name = line [2];
							model.Abbreviation = line [3];
							model.Description = line [4];
							model.ZipCode = line [5];
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("Location error ***" + e.Message);
						}
					}
					db.InsertAll (entities);
//					var content = db.Table<Location> ().ToList();
//					Console.WriteLine ("Se inserto en tabla Location:" + content.Count);
//					foreach (Location m in content) {
//						Console.WriteLine ("Id: "+m.Id+" Name:"+m.Name);
//					}
				}
				db.Close ();
			}
		}
		public void InsertCrimeCatalog(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<CrimeCatalog> ();
				if (db.Table<CrimeCatalog> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/crime.txt", act);
					List<CrimeCatalog> entities = new List<CrimeCatalog> (); 
					foreach (String[] line in data) { 
						try {
							CrimeCatalog model = new CrimeCatalog ();
							model.Id = int.Parse (line [0]);
							model.Name = line [1];
							model.Description = line [2];
							model.IsObsolete = line [3].Equals ("1");
							model.GroupCrimeId = int.Parse (line [4]);
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("crime error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<HearingType> ().ToList ();
					Console.WriteLine ("Se inserto en tabla crime:");
					foreach (HearingType m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Description);
					}
				}
				db.Close ();
			}
		}
		public void InsertInformationAviability(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<InformationAviability> ();
				if (db.Table<InformationAviability> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/informationAvailability.txt", act);
					List<InformationAviability> entities = new List<InformationAviability> (); 
					foreach (String[] line in data) {
						try {
							InformationAviability model = new InformationAviability ();
							model.Id = int.Parse (line [0]);
							model.Name = line [1];
							model.IsObsolete = line [2].Equals ("1");
							model.Specification = line [3].Equals ("1");
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("informationAvailability error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<InformationAviability> ().ToList ();
					Console.WriteLine ("Se inserto en tabla InformationAviability:");
					foreach (InformationAviability m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Name);
					}
				}
				db.Close ();
			}
		}
 public void  EditDrugMeeting(int idDrug)
 {
     using (var db = FactoryConn.GetConn()) {
         try {
             var drugId = int.Parse(idDrug.ToString());
             var dto    = new ModelContainer();
             var mdl    = db.Table <Drug> ().Where(mee => mee.Id == drugId).FirstOrDefault();
             dto.Reference = db.Table <Meeting> ().Where(s => s.Id == mdl.MeetingId).FirstOrDefault().CaseDetentionId.ToString() ?? "";
             dto.JsonModel = JsonConvert.SerializeObject(mdl);
             var temp = new DrugUpsert {
                 Model = dto
             };
             var pagestring = "nada que ver";
             pagestring = temp.GenerateString();
             webView.LoadHtmlString(pagestring);
         } catch (Exception e) {
             db.Rollback();
             Console.WriteLine("catched exception in MeetingController method PersonSocialNetwork");
             Console.WriteLine("Exception message :::>" + e.Message);
         } finally {
             db.Commit();
         }
         db.Close();
     }
 }
		public void InsertUserRoles(Activity act){
			//			var db = new SQLiteConnection (ConstantsDb.DB_PATH);
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<Role> ();
				if (db.Table<Role> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/role.txt", act);
					List<Role> entities = new List<Role> (); 
					foreach (String[] line in data) {
						try {
							Role model = new Role ();
							model.Id = int.Parse (line [0]);
							model.role = line [1];
							model.Description = line [2];
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("RoleCatalog error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<Role> ().ToList ();
					Console.WriteLine ("Se inserto en tabla Role:");
					foreach (Role m in content) {
						Console.WriteLine ("Id: " + m.Id + " Role:" + m.role);
					}
				}
				db.Close ();
			}
		}
Exemplo n.º 10
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();
            }
        }
Exemplo n.º 11
0
 public void  PersonSocialNetwork(int idMeeting)
 {
     using (var db = FactoryConn.GetConn()) {
         try {
             var MeetingId = int.Parse(idMeeting.ToString());
             var dto       = new ModelContainer();
             dto.Reference = db.Table <Meeting> ().Where(s => s.Id == idMeeting).FirstOrDefault().CaseDetentionId.ToString() ?? "";
             SocialNetwork me = db.Table <SocialNetwork> ().Where(mee => mee.MeetingId == idMeeting).FirstOrDefault();
             if (me == null)
             {
                 me           = new SocialNetwork();
                 me.Comment   = "";
                 me.MeetingId = idMeeting;
                 db.Insert(me);
             }
             PersonSocialNetwork mdl = new PersonSocialNetwork();
             mdl.SocialNetworkId = me.Id;
             dto.JsonModel       = JsonConvert.SerializeObject(mdl);
             var temp = new PersonSocialNetworkUpsert {
                 Model = dto
             };
             var pagestring = "nada que ver";
             pagestring = temp.GenerateString();
             webView.LoadHtmlString(pagestring);
         } catch (Exception e) {
             db.Rollback();
             Console.WriteLine("catched exception in SyncController method PersonSocialNetwork");
             Console.WriteLine("Exception message :::>" + e.Message);
         } finally {
             db.Commit();
         }
         db.Close();
     }
 }
		public void InsertDistrict(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<District> ();
				if (db.Table<District> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/district.txt", act);
					List<District> entities = new List<District> (); 
					foreach (String[] line in data) {
						try {
							District model = new District ();
							model.Id = int.Parse (line [0]);
							model.Name = line [1];
							model.IsObsolete = line [2].Equals ("1");
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<District> ().ToList ();
					Console.WriteLine ("Se inserto en tabla District:");
					foreach (District m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Name);
					}
				}
				db.Close ();
			}
		}
Exemplo n.º 13
0
        public Java.Lang.String getArrangmentLst(Java.Lang.String national, Java.Lang.String idTipo)
        {
            using (var db = FactoryConn.GetConn()) {
                var n   = bool.Parse(national.ToString());
                var typ = int.Parse(idTipo.ToString());
                List <ArrangementView> lstArrmntView = new List <ArrangementView> ();

                var arras = db.Table <Arrangement> ().Where(ar => ar.IsNational == n &&
                                                            ar.Type == typ).OrderByDescending(ar => ar.Index).ToList();

                foreach (Arrangement ar in arras)
                {
                    ArrangementView arVnew = new ArrangementView();
                    arVnew.id        = ar.Id;
                    arVnew.name      = ar.Description;
                    arVnew.isDefault = ar.IsDefault;
                    if (arVnew.isDefault == true)
                    {
                        arVnew.selVal      = true;
                        arVnew.description = "--";
                    }
                    else
                    {
                        arVnew.selVal = false;
                    }
                    arVnew.isExclusive = ar.IsExclusive;
                    lstArrmntView.Add(arVnew);
                }
                db.Close();
                return(new Java.Lang.String(JsonConvert.SerializeObject(lstArrmntView)));
            }
        }
		public void InsertArrangement(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<Arrangement> ();
				if (db.Table<Arrangement> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/arrangement.txt", act);
					List<Arrangement> entities = new List<Arrangement> (); 
					foreach (String[] line in data) { 
						try {
							Arrangement model = new Arrangement ();
							model.Id = int.Parse (line [0]);
							model.Description = line [1];
							model.Type = int.Parse (line [2]);
							model.Index = int.Parse (line [3]);
							model.IsObsolete = line [4].Equals ("1");
							model.IsNational = line [5].Equals ("1");
							model.IsDefault = line [6].Equals ("1");
							model.IsExclusive = line [7].Equals ("1");
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("arrangement error " + e.Message);
						}
					}
					db.InsertAll (entities);
					var content = db.Table<HearingType> ().ToList ();
					Console.WriteLine ("Se inserto en tabla arrangement:");
					foreach (HearingType m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Description);
					}
				}
				db.Close ();
			}
		}
Exemplo n.º 15
0
 public Java.Lang.String findAllDrugType()
 {
     using (var db = FactoryConn.GetConn()) {
         var drogas = db.Table <DrugType> ().OrderBy(c => c.Name).ToList() ?? new List <DrugType> ();
         db.Close();
         return(new Java.Lang.String(JsonConvert.SerializeObject(drogas)));
     }
 }
Exemplo n.º 16
0
 public Java.Lang.String findAllPeriodicity()
 {
     using (var db = FactoryConn.GetConn()) {
         var periodicidad = db.Table <Periodicity> ().OrderBy(c => c.Name).ToList() ?? new List <Periodicity> ();
         db.Close();
         return(new Java.Lang.String(JsonConvert.SerializeObject(periodicidad)));
     }
 }
Exemplo n.º 17
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);
            }
        }
Exemplo n.º 18
0
 public Java.Lang.String findLocationByMunicipality(Java.Lang.String idMun)
 {
     using (var db = FactoryConn.GetConn()) {
         var n          = int.Parse(idMun.ToString());
         var municipios = db.Table <Location> ().Where(muni => muni.MunicipalityId == n).OrderBy(c => c.Name).ToList() ?? new List <Location> ();
         db.Close();
         return(new Java.Lang.String(JsonConvert.SerializeObject(municipios)));
     }
 }
Exemplo n.º 19
0
        public Java.Lang.String findAllStates()
        {
            var estados = new List <State> ();

            using (var db = FactoryConn.GetConn()) {
                estados = db.Table <State> ().OrderBy(c => c.Name).ToList() ?? new List <State> ();
                db.Close();
            }
            return(new Java.Lang.String(JsonConvert.SerializeObject(estados)));
        }
Exemplo n.º 20
0
        public void IndexSuperv()
        {
            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 para supervicion
                db.CreateTable <HearingFormatImputed> ();
                db.CreateTable <HearingFormat> ();
                StatusCase statusCaseSupervition1 = services.statusCasefindByCode(Constants.CASE_STATUS_TECHNICAL_REVIEW);
                StatusCase statusCaseSupervition2 = services.statusCasefindByCode(Constants.CASE_STATUS_HEARING_FORMAT_END);
                StatusCase statusCaseSupervition3 = services.statusCasefindByCode(Constants.CASE_STATUS_HEARING_FORMAT_INCOMPLETE);
                StatusCase statusCaseSupervition4 = services.statusCasefindByCode(Constants.CASE_STATUS_CONDITIONAL_REPRIEVE);
                StatusCase statusCaseSupervition5 = services.statusCasefindByCode(Constants.CASE_STATUS_FRAMING_INCOMPLETE);
                StatusCase statusCaseSupervition6 = services.statusCasefindByCode(Constants.CASE_STATUS_FRAMING_COMPLETE);
                StatusCase statusCaseSupervition7 = services.statusCasefindByCode(Constants.CASE_STATUS_NOT_PROSECUTE_OPEN);
                StatusCase sc = services.statusCasefindByCode(Constants.CASE_STATUS_VERIFICATION);

                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 cs.id_status in (?,?,?,?,?,?,?) "
                    + " and me.id_reviewer = ? ", statusCaseSupervition1.Id, statusCaseSupervition2.Id,
                    statusCaseSupervition3.Id, statusCaseSupervition4.Id,
                    statusCaseSupervition5.Id, statusCaseSupervition6.Id, statusCaseSupervition7.Id, revId);


                var c1 = 0;
                if (result != null)
                {
                    for (c1 = 0; c1 < result.Count; c1++)
                    {
                        result [c1].Action = "hearing";
                    }
                }

                var temp = new SyncCaseListSup {
                    Model = result
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
                db.Close();
            }
        }
Exemplo n.º 21
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);
 }
Exemplo n.º 22
0
 public Java.Lang.String findAllByLocation(Java.Lang.String idLocation)
 {
     using (var db = FactoryConn.GetConn()) {
         var    n         = int.Parse(idLocation.ToString());
         var    location  = db.Table <Location> ().Where(loc => loc.Id == n).FirstOrDefault();
         var    mnid      = location.MunicipalityId;
         var    municipio = db.Table <Municipality> ().Where(muni => muni.Id == mnid).FirstOrDefault();
         var    stid      = municipio.StateId;
         String obj       = "{ \"StateId\" : " + stid + ", \"MunicipalityId\" : " + mnid + " }";
         db.Close();
         return(new Java.Lang.String(obj));
     }
 }
		public void InsertDegree(Activity act){
			using (var db = FactoryConn.GetConn ()) {
				db.CreateTable<AcademicLevel> ();
				if (db.Table<AcademicLevel> ().Count () == 0) {
					IEnumerable<String[]> data = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/academic_level.txt", act);
					List<AcademicLevel> entities = new List<AcademicLevel> (); 
					foreach (String[] line in data) {
						try {
							AcademicLevel model = new AcademicLevel ();
							model.Id = int.Parse (line [0]);
							model.Name = line [1];
							model.IsObsolete = line [2].Equals ("1");
							entities.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("AcademicLevel error " + e.Message);
						}
					}
					db.InsertAll (entities);
					IEnumerable<String[]> dataDegree = GetDataOfFile (ConstantsDb.CONTENT_FOLDER_CATALOG + "/degree.txt", act);
					List<Degree> entitiesDegree = new List<Degree> (); 
					foreach (String[] line in dataDegree) {
						try {
							Degree model = new Degree ();
							model.Id = int.Parse (line [0]);
							model.Name = line [1];
							model.IsObsolete = line [3].Equals ("1");
							model.AcademicLevelId = int.Parse (line [2]);
							entitiesDegree.Add (model);
						} catch (Exception e) {
							Console.WriteLine ("Degree error " + e.Message);
						}
					}
					db.CreateTable<Degree> ();
					db.InsertAll (entitiesDegree);
					var content = db.Table<AcademicLevel> ().ToList ();
					Console.WriteLine ("Se inserto en tabla AcademicLevel:");
					foreach (AcademicLevel m in content) {
						Console.WriteLine ("Id: " + m.Id + " Name:" + m.Name);
						Console.WriteLine ("    Degree");
						var Degrees = (from c in db.Table<Degree> ()
						              where c.AcademicLevelId.Equals (m.Id)
						              select c).ToList ();
						foreach (Degree d in Degrees) {
							Console.WriteLine ("Id: " + d.Id + " Name:" + d.Name);
						}
					}
				}
				db.Close ();
			}
		}
Exemplo n.º 24
0
        public HearingFormatView newHearingFormatByCase(int idCase)
        {
            using (var db = FactoryConn.GetConn()) {
                var hearingFormatData = new HearingFormatView();

                var formatosAnteriores = db.Table <HearingFormat> ().Where(prev => prev.CaseDetention == idCase &&
                                                                           prev.IsFinished == true).OrderByDescending(prev => prev.Id).ToList();

                //intenta traer los formatos anteriores y con eso llenar el nuevo formato
                if (formatosAnteriores != null && formatosAnteriores.Count > 0)
                {
                    var ultimo = formatosAnteriores.FirstOrDefault();
                    hearingFormatData = fillHearingFormaData(ultimo.Id);
                    Case ActualCase = db.Table <Case> ().Where(actul => actul.Id == idCase).FirstOrDefault();
                    hearingFormatData.IsSubstracted = ActualCase.IsSubstracted;
                }
                else
                {
                    var caso     = db.Table <Case> ().Where(cs => cs.Id == idCase).FirstOrDefault();
                    var meeting  = db.Table <Meeting> ().Where(me => me.CaseDetentionId == idCase).FirstOrDefault();
                    var imputado = db.Table <Imputed> ().Where(im => im.MeetingId == meeting.Id).FirstOrDefault();
                    hearingFormatData.initTime         = DateTime.Now;
                    hearingFormatData.appointmentDate  = DateTime.Today;
                    hearingFormatData.idCase           = caso.Id;
                    hearingFormatData.idFolder         = caso.IdFolder;
                    hearingFormatData.idJudicial       = caso.IdMP;
                    hearingFormatData.imputedName      = imputado.Name;
                    hearingFormatData.imputedFLastName = imputado.LastNameP;
                    hearingFormatData.imputedSLastName = imputado.LastNameM;
                    hearingFormatData.imputedBirthDate = imputado.BirthDate;

                    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;
                    }
                    hearingFormatData.userName = reviewer.fullname;
                }
                hearingFormatData.canSave    = true;
                hearingFormatData.canEdit    = true;
                hearingFormatData.disableAll = false;
                db.Close();
                return(hearingFormatData);
            }
        }
Exemplo n.º 25
0
        public void LogActivityLst(int idCase)
        {
            using (var db = FactoryConn.GetConn()) {
                db.CreateTable <LogCase> ();
                var     caso    = db.Table <Case> ().Where(cs => cs.Id == idCase).FirstOrDefault();
                var     me      = db.Table <Meeting> ().Where(mi => mi.CaseDetentionId == caso.Id).FirstOrDefault();
                Imputed imputed = new Imputed();
                if (me != null)
                {
                    imputed = db.Table <Imputed> ().Where(imp => imp.MeetingId == me.Id).FirstOrDefault();
                }

                var model = new LogActivityListDto();
                model.imputado = imputed.Name + " " + imputed.LastNameP + " " + imputed.LastNameM;
                model.CaseId   = idCase;
                model.folder   = caso.IdFolder;
                var  usuarioAct = db.Table <User> ().ToList();
                User superviser = new User();
                if (usuarioAct != null && usuarioAct.Count > 0)
                {
                    superviser = usuarioAct [0];
                }
                if (superviser != null && superviser.Id > 0)
                {
                    var logs = db.Table <LogCase> ().Where(lc => lc.caseDetentionId == idCase &&
                                                           lc.userId == superviser.Id).ToList();
                    model.rows = new List <LogCase> ();
                    foreach (LogCase l in logs)
                    {
                        l.dateString = String.Format("{0:yyyy/MM/dd HH:mm}", l.date);
                        l.userName   = superviser.fullname;
                        model.rows.Add(l);
                    }
                }
                else
                {
                    model.rows = new List <LogCase> ();
                }
                var temp = new LogActivityList {
                    Model = model
                };
                //			var temp = new NewMeeting{Model = new EntrevistaTabla{Name="nombre" , DateBirthString=DateTime.Today.ToString("yyyy/mm/dd")} };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
                db.Close();
            }
        }
Exemplo n.º 26
0
        public SupervisionController(IHybridWebView webView)
        {
            this.webView = webView;
            services     = new CatalogServiceController();
            using (var db = FactoryConn.GetConn()) {
                db.CreateTable <SocialEnvironment> ();
                db.CreateTable <RelActivity> ();
                db.Commit();
                db.Close();
            }

            this.JsonCountrys     = JsonConvert.SerializeObject(services.CountryFindAllOrderByName());
            this.JsonStates       = JsonConvert.SerializeObject(services.StateFindAllOrderByName());
            this.JsonMunycipality = JsonConvert.SerializeObject(services.MunicipalityFindAllOrderByName());
            this.JsonElection     = JsonConvert.SerializeObject(services.ElectionFindAll());
        }
Exemplo n.º 27
0
        public void IndexFuentes(int idCase)
        {
            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 caso         = db.Table <Case> ().Where(cs => cs.Id == idCase).FirstOrDefault();
                var meeting      = db.Table <Meeting> ().Where(me => me.CaseDetentionId == idCase).FirstOrDefault();
                var imputado     = db.Table <Imputed> ().Where(im => im.MeetingId == meeting.Id).FirstOrDefault();
                var verification = db.Table <Verification> ().Where(ver => ver.CaseDetentionId == idCase && ver.ReviewerId == revId).FirstOrDefault();
                var sources      = db.Table <SourceVerification> ().Where(sv => (sv.VerificationId == verification.Id && sv.Visible == true
//				&& sv.IsAuthorized == true
                                                                                 && sv.CaseRequestId == idCase && sv.DateComplete == null)).ToList();

                var alls          = db.Table <SourceVerification> ().ToList();
                var entrevistador = db.Table <User> ().Where(u => u.Id.Equals(meeting.ReviewerId)).FirstOrDefault();
                var result        = new SourcesTblDto();
                result.Age             = services.calculateAge(imputado.BirthDate);
                result.CaseId          = idCase;
                result.FullnameImputed = imputado.Name + " " + imputado.LastNameP + " " + imputado.LastNameM;
                result.SourceListJson  = JsonConvert.SerializeObject(sources);
                result.tEnd            = meeting.DateTerminate.ToString();
                result.tStart          = meeting.DateCreate.ToString();
                result.IdFolder        = caso.IdFolder;
                if (entrevistador == null)
                {
                    result.reviewerFullname = "";
                }
                else
                {
                    result.reviewerFullname = entrevistador.fullname;
                }
                var temp = new VerificationSourceList {
                    Model = result
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
                db.Close();
            }
        }
Exemplo n.º 28
0
 public void  MeetingDomicilio(int idMeeting)
 {
     using (var db = FactoryConn.GetConn()) {
         var MeetingId = int.Parse(idMeeting.ToString());
         var dto       = new ModelContainer();
         dto.Reference = db.Table <Meeting> ().Where(s => s.Id == MeetingId).FirstOrDefault().CaseDetentionId.ToString() ?? "";
         ImputedHome mdl = new ImputedHome();
         mdl.MeetingId = idMeeting;
         dto.JsonModel = JsonConvert.SerializeObject(mdl);
         var temp = new AddressUpsert {
             Model = dto
         };
         var pagestring = "nada que ver";
         pagestring = temp.GenerateString();
         webView.LoadHtmlString(pagestring);
         db.Close();
     }
 }
Exemplo n.º 29
0
        public Java.Lang.String upsertHearingFormat(Java.Lang.String modelJson)
        {
            var output = new Java.Lang.String("");

            Console.WriteLine("upsertHearingFormat json model-->" + modelJson);
            try {
                var convertable = modelJson.Replace(":null", ":''").Replace(":[]", ":null").ToString();
                var model       = JsonConvert.DeserializeObject <HearingFormatView> (convertable);
                using (var db = FactoryConn.GetConn()) {
                    var incompleteHf = db.Table <HearingFormat> ().Where(hef => hef.CaseDetention == model.idCase &&
                                                                         hef.IsFinished == false).OrderByDescending(hef => hef.Id).FirstOrDefault();
                    if (incompleteHf != null && incompleteHf.Id > 0 && incompleteHf.Id != model.idFormat)
                    {
                        output = new Java.Lang.String("Tiene un formato de audiencia anterior incompleto, debe terminarlo para poder agregar un nuevo formato de audiencia.");
                    }
                    else if (model.isFinished ?? false)
                    {
                        if (model.vincProcess != null && model.vincProcess == Constants.PROCESS_VINC_NO)
                        {
                            var renewCred = Crypto.HashPassword(model.credPass);
                            var loggedUsr = db.Table <User> ().FirstOrDefault();
                            if (loggedUsr == null || renewCred != loggedUsr.password)
                            {
                                output = new Java.Lang.String("La contraseña es incorrecta, verifique los datos.");
                            }
                        }
                    }
                    db.Close();
                }
                if (output.ToString() == "")
                {
                    HFDtoSave salve = new HFDtoSave();
                    salve = fillHearingFormatWithView(model);
                    salve.IsSubstracted = model.IsSubstracted;
                    output = new Java.Lang.String(hearingFormatServiceSave(salve));
                }
            } catch (Exception e) {
                Console.WriteLine("exception in upsertHearingFormat()");
                Console.WriteLine("Exception message :::>" + e.Message);
                output = new Java.Lang.String("Ha ocurrido un error, intente nuevamente");
            }
            return(output);
        }
Exemplo n.º 30
0
        public void  AddVerificationSource(int idCase)
        {
            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 && reviewer.Id > 0)
                    {
                        revId = reviewer.Id;
                    }

                    var casoId = int.Parse(idCase.ToString());
                    var caso   = db.Table <Case> ().Where(cs => cs.Id == casoId).FirstOrDefault();
//				var usuario = db.Table<User>().FirstOrDefault();
                    var verificacion = db.Table <Verification> ().Where(s => s.CaseDetentionId == casoId &&
                                                                        s.ReviewerId == revId).FirstOrDefault();
                    var dto = new ModelContainer();
                    dto.Reference = idCase.ToString();
                    SourceVerification mdl = new SourceVerification();
                    mdl.IdCase         = casoId;
                    mdl.IsAuthorized   = false;
                    mdl.Visible        = true;
                    mdl.VerificationId = verificacion.Id;
                    dto.JsonModel      = JsonConvert.SerializeObject(mdl);
                    var temp = new NewVerificationSource {
                        Model = dto
                    };
                    var pagestring = "nada que ver";
                    pagestring = temp.GenerateString();
                    webView.LoadHtmlString(pagestring);
                } catch (Exception e) {
                    db.Rollback();
                    Console.WriteLine("catched exception in MeetingController method PersonSocialNetwork");
                    Console.WriteLine("Exception message :::>" + e.Message);
                } finally {
                    db.Commit();
                }
                db.Close();
            }
        }