Exemplo n.º 1
0
 private void AddCitizenForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (editMade)
     {
         Onsave?.Invoke(this, null);
     }
 }
Exemplo n.º 2
0
        void saveCitizen()
        {
            using (var eb = new EBarangayEntities())
            {
                var c = eb.Citizens.FirstOrDefault(x => x.ID == citizen.ID);

                var a = eb.Areas.FirstOrDefault(x => x.Name == area.Text);
                c.Area    = a;
                c.Picture = Class.ImageConverter.imageToByteArray(picBox.Image);

                c.IdNumber   = Id.Text;
                c.FirstName  = firstName.Text;
                c.MiddleName = middleName.Text;
                c.LastName   = lastName.Text;
                c.Extension  = extensionName.Text;

                c.Address     = address.Text;
                c.Birthday    = birthdate.Value;
                c.Gender      = sex.Text;
                c.ContactInfo = contact.Text;
                c.CivilStatus = civilStatus.Text;

                c.SpouseName  = !string.IsNullOrEmpty(spouseName.Text) ? spouseName.Text : null;
                c.FathersName = !string.IsNullOrEmpty(fathersName.Text) ? fathersName.Text : null;
                c.MothersName = !string.IsNullOrEmpty(mothersName.Text) ? mothersName.Text : null;

                c.Indigent      = indigent.Checked;
                c.Student       = student.Checked;
                c.PWD           = pwd.Checked;
                c.SeniorCitizen = senior.Checked;

                c.SSS            = !string.IsNullOrEmpty(sss.Text) ? sss.Text : null;
                c.Philhealth     = !string.IsNullOrEmpty(philhealth.Text) ? philhealth.Text : null;
                c.PagIbig        = !string.IsNullOrEmpty(pagibig.Text) ? pagibig.Text : null;
                c.VoterID        = !string.IsNullOrEmpty(votersId.Text) ? votersId.Text : null;
                c.PrecinctNumber = !string.IsNullOrEmpty(precinctNumber.Text) ? precinctNumber.Text : null;

                eb.SaveChanges();
                Onsave?.Invoke(this, null);
            }
        }
 private void AddProductForm_Disposed(object sender, EventArgs e)
 {
     Onsave?.Invoke(this, null);
 }