コード例 #1
0
        public void SaveMeetingDatosPersonales([Bind] MeetingDatosPersonalesDto model)
        {
            using (var db = FactoryConn.GetConn()) {
                var imputado = db.Get <Imputed> (model.ImputedId);
                imputado.Name               = model.Name;
                imputado.LastNameP          = model.LastNameP;
                imputado.LastNameM          = model.LastNameM;
                imputado.FoneticString      = services.getFoneticByName(model.Name, model.LastNameP, model.LastNameM);
                imputado.Gender             = model.Gender;
                imputado.CelPhone           = model.CelPhone;
                imputado.YearsMaritalStatus = model.YearsMaritalStatus;
                imputado.MaritalStatusId    = model.MaritalStatusId;
                //			imputado.MaritalStatus = db.Get<MaritalStatus>(model.MaritalStatusId);
                imputado.Boys              = model.Boys;
                imputado.DependentBoys     = model.DependentBoys;
                imputado.BirthCountry      = model.BirthCountry;
                imputado.BirthMunicipality = model.BirthMunicipality;
                imputado.BirthState        = model.BirthState;
                imputado.BirthLocation     = model.BirthLocation;
                imputado.Nickname          = model.Nickname;
                imputado.LocationId        = model.LocationId;
                imputado.BirthInfo         = model.BirthInfoId;
                db.Update(imputado);
                string output = JsonConvert.SerializeObject(model);
                model.JsonMeeting      = output;
                model.JsonCountrys     = this.jsonCountrys;
                model.JsonStates       = this.jsonStates;
                model.JsonMunycipality = this.jsonMunycipality;
                model.JsonElection     = this.jsonElection;

                var temp = new MeetingDatosPersonales {
                    Model = model
                };
                var pagestring = "nada que ver";
                pagestring = temp.GenerateString();
                webView.LoadHtmlString(pagestring);
                db.Close();
            }
        }
コード例 #2
0
        public void  MeetingDatosPersonales(int idCase)
        {
            using (var db = FactoryConn.GetConn()) {
                if (idCase == 0)
                {
                    idCase = db.Table <Case> ().FirstOrDefault().Id;
                }

//			var result = new MeetingDatosPersonalesDto ();
//			var resAux = db.Table<Case> ().Where (csAux=>csAux.Id == idCase).FirstOrDefault ();
//			if (resAux != null) {
//				var ent = db.Table<Meeting> ().Where (mtAux=> mtAux.CaseDetentionId == resAux.Id ).FirstOrDefault ();
//				if (ent != null ) {
//					var imputado = db.Table<Imputed> ().Where (datosimp => datosimp.MeetingId == ent.Id).FirstOrDefault ();
//					MeetingDatosPersonalesDto found = new MeetingDatosPersonalesDto ();
//					found.IdFolder = resAux.IdFolder;
//					found.ImputedId = imputado.Id;
//					found.LastNameM = imputado.LastNameM;
//					found.LastNameP = imputado.LastNameP;
//					found.Name = imputado.Name;
//					found.FoneticString = imputado.FoneticString;
//					found.CelPhone = imputado.CelPhone;
//					found.YearsMaritalStatus = imputado.YearsMaritalStatus;
//					found.MaritalStatusId = imputado.MaritalStatusId;
//					found.Boys = imputado.Boys;
//					found.DependentBoys = imputado.DependentBoys;
//					found.BirthCountry = imputado.BirthCountry;
//					found.BirthMunicipality = imputado.BirthMunicipality;
//					found.BirthState = imputado.BirthState;
//					found.BirthLocation = imputado.BirthLocation;
//					found.Nickname = imputado.Nickname;
//					found.LocationId = imputado.LocationId;
//
//					found.MeetingId = ent.Id;
//					found.ReviewerId = ent.ReviewerId;
//					found.StatusMeetingId = ent.StatusMeetingId;
//					found.CommentReference = ent.CommentReference;
//					found.CommentJob = ent.CommentJob;
//					found.CommentSchool = ent.CommentSchool;
//					found.CommentCountry = ent.CommentCountry;
//					found.CommentHome = ent.CommentHome;
//					found.CommentDrug = ent.CommentDrug;
//					found.DateCreate = ent.DateCreate;
//					found.DateTerminate = ent.DateTerminate;
//
//					found.CaseId = resAux.Id;
//					found.BirthDate = imputado.BirthDate;
//					found.Gender = imputado.Gender;
//					result=found;
//				}
//			}

                var result = db.Query <MeetingDatosPersonalesDto> (
                    "SELECT cs.id_folder as 'IdFolder', im.id_imputed as 'ImputedId',im.name as 'Name',im.lastname_p as 'LastNameP',im.lastname_m as 'LastNameM'"
                    + " ,im.birth_date as 'BirthDate', im.gender as 'Gender'"
                    + " ,im.fonetic_string as 'FoneticString', im.cel_phone as 'CelPhone'"
                    + " ,im.years_marital_status as 'YearsMaritalStatus', im.id_marital_status as 'MaritalStatusId'"
                    + " ,im.boys as 'Boys', im.dependent_boys as 'DependentBoys'"
                    + " ,im.id_country as 'BirthCountry', im.birth_municipality as 'BirthMunicipality'"
                    + " ,im.birth_state as 'BirthState', im.birth_location as 'BirthLocation'"
                    + " ,im.nickname as 'Nickname', im.id_location as 'LocationId'"
                    + " ,im.id_birth_info_availability as 'BirthInfoId'"
                    + " ,me.id_meeting as 'MeetingId'"
                    + " ,me.id_reviewer as 'ReviewerId', me.id_status as 'StatusMeetingId'"
                    + " ,me.comment_refernce as 'CommentReference', me.comment_job as 'CommentJob'"
                    + " ,me.comment_school as 'CommentSchool', me.comment_country as 'CommentCountry'"
                    + " ,me.comment_home as 'CommentHome', me.comment_drug as 'CommentDrug'"
                    + " ,me.date_create as 'DateCreate', me.date_terminate as 'DateTerminate'"
                    //				+", 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 "
                    //				+" and me.id_reviewer = 2 "
                    + " where cs.id_case = ? and cs.has_negation = 0; ", idCase).FirstOrDefault();
                result.CaseId = idCase;

                result.ageString = services.calculateAge(result.BirthDate);

                var domiciliosImputado = db.Table <ImputedHome> ().Where(im => im.MeetingId == result.MeetingId).ToList();
                if (domiciliosImputado != null)
                {
                    result.JsonDomicilios = domiciliosImputado;
                }


                var SE = db.Table <SocialEnvironment> ().Where(s => s.MeetingId == result.MeetingId).FirstOrDefault();
                if (SE != null)
                {
                    result.PhysicalCondition = SE.physicalCondition;
                    result.comment           = SE.comment;
                    var ActList = db.Table <RelActivity> ().Where(s => s.SocialEnvironmentId == SE.Id).ToList();
                    if (ActList != null && ActList.Count > 0)
                    {
                        result.Activities = JsonConvert.SerializeObject(ActList);
                    }
                }
                //socialNetworkComment
                var socialNetComent = db.Table <SocialNetwork> ().Where(s => s.MeetingId == result.MeetingId).FirstOrDefault();
                if (socialNetComent != null)
                {
                    result.CommentSocialNetwork = socialNetComent.Comment;
                }
                else
                {
                    socialNetComent           = new SocialNetwork();
                    socialNetComent.Comment   = "";
                    socialNetComent.MeetingId = result.MeetingId ?? 0;
                    db.Insert(socialNetComent);
                }

                //PersonSocialNetwork
                var personsSocNet = db.Table <PersonSocialNetwork> ().Where(sn => sn.SocialNetworkId == socialNetComent.Id).ToList();
                if (personsSocNet != null)
                {
                    result.JsonPersonSN = personsSocNet;
                }
                else
                {
                    result.JsonPersonSN = null;
                }

                //Reference
                var references = db.Table <Reference> ().Where(sn => sn.MeetingId == result.MeetingId).ToList();
                if (references != null)
                {
                    result.JsonReferences = references;
                }
                else
                {
                    result.JsonReferences = null;
                }

                //Laboral History
                var trabajos = db.Table <Job> ().Where(sn => sn.MeetingId == result.MeetingId).ToList();
                if (trabajos != null)
                {
                    result.JsonJobs = trabajos;
                }
                else
                {
                    result.JsonJobs = null;
                }

                //school history
                var escuelaUtlActual = db.Table <School> ().Where(sc => sc.MeetingId == result.MeetingId).FirstOrDefault();
                if (escuelaUtlActual != null)
                {
                    result.SchoolAddress       = escuelaUtlActual.Address;
                    result.SchoolBlock         = escuelaUtlActual.block;
                    result.SchoolDegreeId      = escuelaUtlActual.DegreeId.GetValueOrDefault();
                    result.SchoolName          = escuelaUtlActual.Name;
                    result.SchoolPhone         = escuelaUtlActual.Phone;
                    result.SchoolSpecification = escuelaUtlActual.Specification;
                }


                //DROGAS
                var drogas = db.Table <Drug> ().Where(sn => sn.MeetingId == result.MeetingId).ToList();
                if (drogas != null)
                {
                    result.JsonDrugs = drogas;
                }
                else
                {
                    result.JsonDrugs = null;
                }


                if (escuelaUtlActual != null)
                {
                    var schedule = db.Table <Schedule> ().Where(sc => sc.SchoolId == escuelaUtlActual.Id).ToList();
                    if (schedule != null)
                    {
                        result.ScheduleSchool = JsonConvert.SerializeObject(schedule);
                    }
                }

                //leave country
                var leaveActual = db.Table <LeaveCountry> ().Where(lv => lv.MeetingId == result.MeetingId).FirstOrDefault();
                if (leaveActual != null)
                {
                    result.OfficialDocumentationId = leaveActual.OfficialDocumentationId;
                    result.LivedCountryId          = leaveActual.LivedCountryId;
                    result.timeAgo = leaveActual.timeAgo;
                    result.Reason  = leaveActual.Reason;
                    result.FamilyAnotherCountryId = leaveActual.FamilyAnotherCountryId;
                    result.CountryId                 = leaveActual.CountryId;
                    result.State                     = leaveActual.State;
                    result.Media                     = leaveActual.Media;
                    result.Address                   = leaveActual.Address;
                    result.ImmigrationDocumentId     = leaveActual.ImmigrationDocumentId;
                    result.RelationshipId            = leaveActual.RelationshipId;
                    result.TimeResidence             = leaveActual.TimeResidence;
                    result.SpecficationImmigranDoc   = leaveActual.SpecficationImmigranDoc;
                    result.SpecificationRelationship = leaveActual.SpecificationRelationship;
                    result.CommunicationFamilyId     = leaveActual.CommunicationFamilyId;
                }
                //End leave country


                string output = JsonConvert.SerializeObject(result);
                result.JsonMeeting = output;


                result.JsonCountrys     = this.jsonCountrys;
                result.JsonStates       = this.jsonStates;
                result.JsonMunycipality = this.jsonMunycipality;
                result.JsonElection     = this.jsonElection;
                result.JsonActivities   = JsonConvert.SerializeObject(db.Table <ActivityCatalog> ().ToList());

                var temp = new MeetingDatosPersonales {
                    Model = result
                };
                //			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();
            }
        }