Ejemplo n.º 1
0
        private void AddCharacteristicsMarriageStatus(MarriageStatus MS)
        {
            string        ms      = MS.ToString();
            List <Gender> genders = new List <Gender>()
            {
                Gender.male, Gender.female
            };

            for (int g = 0; g < genders.Count; g++)
            {
                for (int a = 2; a < 8; a++)
                {
                    Predicate <Person> pred = new Predicate <Person>(x => x.gender == genders[g] && x.age >= a * 10 && x.age <= a * 10 + 9 && x.RelationshipStatus == MS && x.state == State.resident);

                    int value = citizens.FindAll(pred).Count;
                    if (MS == MarriageStatus.married && g == 0)
                    {
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    string key = GenerateKeyforCharasteristicsDictionary(genders[g], a * 10, a * 10 + 9, MS);
                    Characteristics.Add(key, value);
                }
                Predicate <Person> predFinal = new Predicate <Person>(x => x.gender == genders[g] && x.age >= 80 && x.RelationshipStatus == MS && x.state == State.resident);
                int valueFinal = citizens.FindAll(predFinal).Count;
                Characteristics.Add(GenerateKeyforCharasteristicsDictionary(genders[g], 80, MS), valueFinal);
                if (MS == MarriageStatus.married && g == 0)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.ForegroundColor = ConsoleColor.White;
                }
            }
        }
Ejemplo n.º 2
0
 public void Marry(Person spouse)
 {
     if (partner == null)
     {
         partner                    = spouse;
         RelationshipStatus         = MarriageStatus.married;
         partner.partner            = this;
         partner.RelationshipStatus = MarriageStatus.married;
     }
 }
Ejemplo n.º 3
0
    private void UpdateRecordingActParty(RecordingActParty rap) {
      rap.Notes = txtNotes.Value;
      rap.PartyAddress = txtAddress.Value;
      if (!String.IsNullOrEmpty(Request.Form[cboAddressPlace.Name])) {
        rap.PartyAddressPlace = GeographicRegionItem.Parse(int.Parse(Request.Form[cboAddressPlace.Name]));
      } else {
        rap.PartyAddressPlace = GeographicRegionItem.Unknown;
      }
      rap.PartyMarriageStatus = MarriageStatus.Parse(int.Parse(cboMarriageStatus.Value));
      rap.PartyOccupation = Occupation.Parse(int.Parse(cboOccupation.Value));

      rap.Save();
    }
Ejemplo n.º 4
0
 public void Devorce()
 {
     if (partner != null)
     {
         RelationshipStatus = MarriageStatus.divorced;
         try
         {
             partner.RelationshipStatus = MarriageStatus.divorced;
             partner.partner            = null;
             partner = null;
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 5
0
    private void LoadMainCombos() {
      HtmlSelectContent.LoadCombo(this.cboOccupation, Occupation.GetList(), "Id", "Name",
                                  "( Seleccionar )", String.Empty, "No consta");

      HtmlSelectContent.LoadCombo(this.cboMarriageStatus, MarriageStatus.GetList(), "Id", "Name",
                                  "( ? )", String.Empty, "No consta");

      HtmlSelectContent.LoadCombo(cboBornLocation, "( Seleccionar lugar de nacimiento )",
                                  String.Empty, GeographicRegionItem.Unknown.Name);

      HtmlSelectContent.LoadCombo(cboAddressPlace, "( Seleccionar lugar de residencia )",
                                  String.Empty, GeographicRegionItem.Unknown.Name);

      ObjectList<RecordingActParty> parties = RecordingActParty.GetInvolvedDomainParties(this.recordingAct);

      LoadRolesCombo(parties);
      LoadFirstPartyInRoleCombo(parties);
    }
Ejemplo n.º 6
0
 public void SetRelationshipStatus(double MarriedChance, double WidowedChance, double DivorcedChance, Person spouse)
 {
     if (Randomizer.GetRandom(WidowedChance))
     {
         RelationshipStatus = MarriageStatus.widowed;
         return;
     }
     if (Randomizer.GetRandom(DivorcedChance))
     {
         RelationshipStatus        = MarriageStatus.divorced;
         spouse.RelationshipStatus = MarriageStatus.divorced;
         return;
     }
     if (Randomizer.GetRandom(MarriedChance))
     {
         Marry(spouse);
         return;
     }
 }
Ejemplo n.º 7
0
 private void FillPartyData(RecordingActParty rap) {
   if (this.party is HumanParty) {
     rap.Notes = txtNotes.Value;
     rap.PartyAddress = txtAddress.Value;
     if (!String.IsNullOrEmpty(Request.Form[cboAddressPlace.Name])) {
       rap.PartyAddressPlace = GeographicRegionItem.Parse(int.Parse(Request.Form[cboAddressPlace.Name]));
     } else {
       rap.PartyAddressPlace = GeographicRegionItem.Unknown;
     }
     if (!String.IsNullOrEmpty(Request.Form[cboMarriageStatus.Name])) {
       rap.PartyMarriageStatus = MarriageStatus.Parse(int.Parse(Request.Form[cboMarriageStatus.Name]));
     } else {
       rap.PartyMarriageStatus = MarriageStatus.Unknown;
     }
     if (!String.IsNullOrEmpty(Request.Form[cboOccupation.Name])) {
       rap.PartyOccupation = Occupation.Parse(int.Parse(Request.Form[cboOccupation.Name]));
     } else {
       rap.PartyOccupation = Occupation.Unknown;
     }
   }
 }
Ejemplo n.º 8
0
 public static string GenerateKeyforCharasteristicsDictionary(Gender gender, int startAge, MarriageStatus ms)
 {
     return(gender + "(" + startAge + "+)" + ms);
 }
Ejemplo n.º 9
0
 private void SpouceDied()
 {
     partner            = null;
     RelationshipStatus = MarriageStatus.widowed;
 }
Ejemplo n.º 10
0
        private void ExecuteShowReport()
        {
            if (SelectedResidenceColumns.Count == 0)
            {
                MessageBox.Show("No Columns selected");
                Result       = null;
                SearchStatus = String.Empty;
                return;
            }
            Result = new FlowDocument();
            List <Residence> input = null;

            using (UnitOfWork unitOfWork = new UnitOfWork(new MahalluDBContext())) {
                input = unitOfWork.Residences.GetAll().ToList();
                String[] temp = null;
                if (!String.IsNullOrEmpty(Area))
                {
                    if (Area.Contains(";"))
                    {
                        temp = Area.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = Area;
                    }
                    if (temp != null)
                    {
                        input = input.Where(x => temp.Contains(x.Area, new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(HouseName))
                {
                    temp = null;
                    if (HouseName.Contains(";"))
                    {
                        temp = HouseName.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = HouseName;
                    }
                    if (temp != null)
                    {
                        input = input.Where(x => temp.Contains(x.Name, new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(HouseNumber))
                {
                    temp = null;
                    if (HouseNumber.Contains(";"))
                    {
                        temp = HouseNumber.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = HouseNumber;
                    }
                    if (temp != null)
                    {
                        input = input.Where(x => temp.Contains(x.Number, new ContainsComparer())).ToList();
                    }
                }
            }

            List <ResidenceMember> members = null;

            using (UnitOfWork unitOfWork = new UnitOfWork(new MahalluDBContext())) {
                members = unitOfWork.ResidenceMembers.GetAll().ToList();
                String[] temp = null;
                if (!String.IsNullOrEmpty(MarriageStatus))
                {
                    if (MarriageStatus.Contains(";"))
                    {
                        temp = MarriageStatus.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = MarriageStatus;
                    }
                    if (temp != null)
                    {
                        members = members.Where(x => temp.Contains(x.MarriageStatus, new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(Country))
                {
                    temp = null;
                    if (Country.Contains(";"))
                    {
                        temp = Country.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = Country;
                    }
                    if (temp != null)
                    {
                        members = members.Where(x => temp.Contains(x.Country, new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(Qualification))
                {
                    temp = null;
                    if (Qualification.Contains(";"))
                    {
                        temp = Qualification.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = Qualification;
                    }
                    if (temp != null)
                    {
                        members = members.Where(x => temp.Contains(x.Qualification, new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(Gender))
                {
                    temp = null;
                    if (Gender.Contains(";"))
                    {
                        temp = Gender.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = Gender;
                    }
                    if (temp != null)
                    {
                        members = members.Where(x => temp.Contains(x.Gender, new ContainsComparer())).ToList();
                    }
                }
            }

            if (ValidateReportParameters())
            {
                BuildReport(input, members);
            }
        }
Ejemplo n.º 11
0
        public static CommonReturn <MarriageStatus> LocalMarriageSearch(string id, string name)
        {
            Console.WriteLine("LocalMarriageSearch started..." + DateTime.Now);
            var ret = new CommonReturn <MarriageStatus> {
                milliseconds = "7", dataid = dataid.hunyi, ok = true, remote = false, message = string.Empty, title = "婚姻登记信息", na = true, datalist = new List <MarriageStatus>()
            };

            if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(name))
            {
                Console.WriteLine("LocalMarriageSearch end for not suit conditions");
                return(ret);
            }
            else
            {
                ret.na = false;
            }

            var stop = new Stopwatch();

            stop.Start();

            try
            {
                using (var connection = new OracleConnection(dbsource))
                {
                    connection.Open();
                    using (var command = new OracleCommand("SELECT cert_no,op_date,id_card,name from hun_yin_deng_ji_xin_xi where id_card= :a or name=:b", connection))
                    {
                        command.Parameters.Add("a", id);
                        command.Parameters.Add("b", name);
                        using (var reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var one = new MarriageStatus();
                                one.cert_no = reader.GetString(0);
                                one.op_date = reader.GetString(1);
                                one.id_card = reader.GetString(2);
                                one.name    = reader.GetString(3);
                                ret.datalist.Add(one);
                            }
                        }
                    }
                    var newadd = new List <MarriageStatus>();
                    foreach (var a in ret.datalist)
                    {
                        using (var command = new OracleCommand("SELECT cert_no,op_date,id_card,name from hun_yin_deng_ji_xin_xi where cert_no like :b", connection))
                        {
                            command.Parameters.Add("b", "%" + a.cert_no.Trim() + "%");
                            using (var reader = command.ExecuteReader())
                            {
                                while (reader.Read())
                                {
                                    var one = new MarriageStatus();
                                    one.cert_no = reader.GetString(0);
                                    one.op_date = reader.GetString(1);
                                    one.id_card = reader.GetString(2);
                                    one.name    = reader.GetString(3);
                                    newadd.Add(one);
                                }
                            }
                        }
                    }
                    ret.datalist.AddRange(newadd);
                }
            }
            catch (Exception ex)
            {
                ret.ok      = false;
                ret.message = ex.Message;
            }
            stop.Stop();
            ret.milliseconds = stop.ElapsedMilliseconds.ToString();
            if (ret.datalist.Count < 1)
            {
                ret.message += ",没有记录";
                ret.ok       = false;
            }
            Console.WriteLine("LocalMarriageSearch ended");
            return(ret);
        }