Пример #1
0
        internal static void SaveIndividualsBasicInformation(string Name, string Age, string Sex, string SpokenLanguage, string WrittenLanguage, string Nationality, string Ethnicity, Image image)
        {
            Utils.Utils utils = new Utils.Utils();
            Damocles2Entities de = new Damocles2Entities();
            FaceARC farc = new FaceARC();
            Face face = new Face();

            // Possible Return Values = X, A, R, C, String.Empty
            var pr = GetProcessingResultById(CurrentInternalReport.ReportNumber);
            if (pr != null)
            {
                if (pr.CSrcResultId != null)    // Theoretically the most common result
                    farc.CId = pr.CSrcResultId;

                if (pr.RSrcResultId != null)
                    farc.RId = pr.RSrcResultId;

                if (pr.ASrcResultId != null) // Theoretically the least common result
                    farc.AId = pr.ASrcResultId;

                farc.FaceId = face.id;
                face.FaceData = utils.BytesToString(utils.imageToByteArray(image));
                face.CreatedOn = DateTime.UtcNow;
                face.UpdatedOn = DateTime.UtcNow;
                face.CreatedBy = CurrentUser.UserId;
                if (!string.IsNullOrEmpty(Name))
                    face.Name = Name;
                if (!string.IsNullOrEmpty(Age))
                    face.Age = Convert.ToInt32(Age);
                if (!string.IsNullOrEmpty(Sex))
                    face.Sex = Sex;
                if (!string.IsNullOrEmpty(SpokenLanguage))
                    face.SpokenLanguage = SpokenLanguage;
                if (!string.IsNullOrEmpty(WrittenLanguage))
                    face.WrittenLanguage = WrittenLanguage;
                if (!string.IsNullOrEmpty(Nationality))
                    face.Nationality = Nationality;
                if (!string.IsNullOrEmpty(Ethnicity))
                    face.Ethnicity = Ethnicity;

                de.Faces.Add(face);
                de.FaceARCs.Add(farc);
                de.SaveChanges();
            }
            else
            {
                // Need to save the Profile results before trying to get them from ProcessingResults.
            }
        }
Пример #2
0
        internal static void SaveIndividualsBasicInformation(string Name, string Age, string Sex, string SpokenLanguage, string WrittenLanguage, string Nationality, string Ethnicity, Image image)
        {
            Utils.Utils       utils = new Utils.Utils();
            Damocles2Entities de    = new Damocles2Entities();
            FaceARC           farc  = new FaceARC();
            Face face = new Face();

            // Possible Return Values = X, A, R, C, String.Empty
            var pr = GetProcessingResultById(CurrentInternalReport.ReportNumber);

            if (pr != null)
            {
                if (pr.CSrcResultId != null)    // Theoretically the most common result
                {
                    farc.CId = pr.CSrcResultId;
                }

                if (pr.RSrcResultId != null)
                {
                    farc.RId = pr.RSrcResultId;
                }

                if (pr.ASrcResultId != null) // Theoretically the least common result
                {
                    farc.AId = pr.ASrcResultId;
                }

                farc.FaceId    = face.id;
                face.FaceData  = utils.BytesToString(utils.imageToByteArray(image));
                face.CreatedOn = DateTime.UtcNow;
                face.UpdatedOn = DateTime.UtcNow;
                face.CreatedBy = CurrentUser.UserId;
                if (!string.IsNullOrEmpty(Name))
                {
                    face.Name = Name;
                }
                if (!string.IsNullOrEmpty(Age))
                {
                    face.Age = Convert.ToInt32(Age);
                }
                if (!string.IsNullOrEmpty(Sex))
                {
                    face.Sex = Sex;
                }
                if (!string.IsNullOrEmpty(SpokenLanguage))
                {
                    face.SpokenLanguage = SpokenLanguage;
                }
                if (!string.IsNullOrEmpty(WrittenLanguage))
                {
                    face.WrittenLanguage = WrittenLanguage;
                }
                if (!string.IsNullOrEmpty(Nationality))
                {
                    face.Nationality = Nationality;
                }
                if (!string.IsNullOrEmpty(Ethnicity))
                {
                    face.Ethnicity = Ethnicity;
                }

                de.Faces.Add(face);
                de.FaceARCs.Add(farc);
                de.SaveChanges();
            }
            else
            {
                // Need to save the Profile results before trying to get them from ProcessingResults.
            }
        }