public void UpdateEntitledFromInformix(Entitle entitledDataBase, EntitleSipeInformation entitledInformix, RegimenInformation regimenInformation)
        {
            entitledDataBase.Age              = entitledInformix.Age;
            entitledDataBase.Birthdate        = entitledInformix.BirthDate;
            entitledDataBase.Birthplace       = entitledInformix.EntityBirth.Trim();
            entitledDataBase.City             = entitledInformix.Population.Trim();
            entitledDataBase.Colony           = entitledInformix.Colony.Trim();
            entitledDataBase.CURP             = entitledInformix.Curp.Trim();
            entitledDataBase.Gender           = entitledInformix.Genger.Trim();
            entitledDataBase.MaritalStatus    = entitledInformix.MaritalStatus.Trim();
            entitledDataBase.MaternalLastName = entitledInformix.SecondSurname.Trim();
            entitledDataBase.Name             = entitledInformix.Name.Trim();
            entitledDataBase.NoISSSTE         = entitledInformix.NumIssste.Trim();
            entitledDataBase.NumExt           = entitledInformix.ExteriorNumber.Trim();
            entitledDataBase.NumInt           = entitledInformix.InteriorNumber.Trim();
            entitledDataBase.PaternalLastName = entitledInformix.FirstSurname.Trim();
            entitledDataBase.RegimeType       = (regimenInformation != null && !string.IsNullOrEmpty(regimenInformation.RegimenKey)) ? regimenInformation.RegimenKey.Trim() : string.Empty;
            entitledDataBase.RFC              = entitledInformix.Rfc.Trim();
            entitledDataBase.Street           = entitledInformix.Street.Trim();
            entitledDataBase.ZipCode          = entitledInformix.PostalCode.Trim();
            entitledDataBase.IsActive         = sipeAvServiceAgent.GetStateEntitle(entitledInformix);

            db.UpdateEntitle(entitledDataBase);
        }
        public Entitle GetEntitle(string noIssste)
        {
            Entitle entitledInfo = null;
            EntitleSipeInformation entitledInformix = sipeAvServiceAgent.GetEntitleByNoIssste(noIssste);
            RegimenInformation     entitledRegimen  = sipeAvServiceAgent.GetRegimenByNoIssste(noIssste);
            bool isActive = sipeAvServiceAgent.GetStateEntitle(entitledInformix);

            if (entitledInformix != null)
            {
                entitledInfo = new Entitle()
                {
                    Age              = entitledInformix.Age,
                    Birthdate        = entitledInformix.BirthDate,
                    Birthplace       = entitledInformix.EntityBirth.Trim(),
                    City             = entitledInformix.Population.Trim(),
                    Colony           = entitledInformix.Colony.Trim(),
                    CURP             = entitledInformix.Curp.Trim(),
                    Gender           = entitledInformix.Genger.Trim(),
                    MaritalStatus    = entitledInformix.MaritalStatus.Trim().ToUpper(),
                    MaternalLastName = entitledInformix.SecondSurname.Trim(),
                    Name             = entitledInformix.Name.Trim(),
                    NoISSSTE         = entitledInformix.NumIssste.Trim(),
                    NumExt           = entitledInformix.ExteriorNumber.Trim(),
                    NumInt           = entitledInformix.InteriorNumber.Trim(),
                    PaternalLastName = entitledInformix.FirstSurname.Trim(),
                    RegimeType       = (entitledRegimen != null && !string.IsNullOrEmpty(entitledRegimen.RegimenKey)) ? entitledRegimen.RegimenKey.Trim() : string.Empty,
                    RFC              = entitledInformix.Rfc.Trim(),
                    Street           = entitledInformix.Street.Trim(),
                    ZipCode          = entitledInformix.PostalCode.Trim(),
                    EntitleId        = entitledInformix.Curp.Trim(),
                    IsActive         = isActive,
                    State            = entitledInformix.State
                };


                Entitle existingEntitled = commonDomainService.GetEntitledByCURP(entitledInformix.Curp);
                if (existingEntitled != null && !string.IsNullOrEmpty(existingEntitled.CURP))
                {
                    commonDomainService.UpdateEntitledFromInformix(existingEntitled, entitledInformix, entitledRegimen);
                }
                else
                {
                    commonDomainService.SaveEntitledFromInformix(entitledInfo);
                }

                entitledInfo = commonDomainService.GetEntitledByCURP(entitledInformix.Curp);
            }

            if (entitledInformix.State == "")
            {
                entitledInfo.State = "BAJA";
            }
            else if (entitledInformix.State == "F")
            {
                entitledInfo.State = "FINADO";
            }
            else
            {
                entitledInfo.State = "ACTIVO";
            }

            return(entitledInfo);
        }