Example #1
0
        public void SendParish(DataGridView datagrid)
        {
            frmActivities       FA  = new frmActivities();
            frmDataParishioners frm = new frmDataParishioners("ModifyParish", this, FA);

            selectedParish = Convert.ToInt32(datagrid.CurrentRow.Index.ToString());
            DataGridViewRow dgv = datagrid.Rows[selectedParish];

            frm.parishId          = Convert.ToInt32(dgv.Cells["clmId"].Value);
            frm.txtName.Text      = dgv.Cells["Nombre"].Value.ToString();
            frm.txtSurname.Text   = dgv.Cells["Apellido"].Value.ToString();
            frm.txtDocumento.Text = dgv.Cells["clmDocumento"].Value.ToString();
            if (dgv.Cells["FechaNac"].Value?.ToString() != "")
            {
                frm.chbDateTime.Checked = true;
                frm.dtBornDate.Value    = DateTime.Parse(dgv.Cells["FechaNac"].Value.ToString());
            }
            else
            {
                frm.chbDateTime.Checked = false;
                frm.dtBornDate.Enabled  = false;
                frm.dtBornDate.Value    = DateTime.Today;
            }
            frm.txtTelephone.Text   = dgv.Cells["Telephone"].Value.ToString();
            frm.txtAddress.Text     = dgv.Cells["Address"].Value.ToString();
            frm.txtMail.Text        = dgv.Cells["Mail"].Value.ToString();
            frm.txtObservation.Text = dgv.Cells["clmObservation"].Value.ToString();
            frm.telephoneId         = Convert.ToInt32(dgv.Cells["clmParishionerPhoneId"].Value);
            frm.addressId           = Convert.ToInt32(dgv.Cells["clmParishionerAddressId"].Value);
            frm.mailId = Convert.ToInt32(dgv.Cells["clmParishionerMailId"].Value);
            frm.ShowDialog();
        }
Example #2
0
        private void BtnNew_Click(object sender, EventArgs e)
        {
            frmActivities       FA  = new frmActivities();
            frmDataParishioners FDP = new frmDataParishioners("NewParish", this, FA);

            FDP.ShowDialog();
        }
Example #3
0
 public frmNewActivity(frmActivities _owner)
 {
     InitializeComponent();
     A     = new Activity();
     PBA   = new ParishionerByActivity();
     L     = new Log();
     owner = _owner;
     flag  = 0;
 }
Example #4
0
        private void BtnAccept_Click(object sender, EventArgs e)
        {
            flag = 0;

            if (txtName.Text.Trim() == "")
            {
                Error.SetError(txtName, "Debe ingresar un nombre para registrar la actividad");
                flag = 1;
            }
            if (flag == 0)
            {
                validActivity = A.FindActivity(txtName.Text);
                if (validActivity == true)
                {
                    MessageBox.Show("Ya existe una actividad con el nombre " + "'" + txtName.Text + "'.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtName.Clear();
                    txtName.Focus();
                    flag = 1;
                }
            }

            if (flag == 0)
            {
                A.Name        = txtName.Text.Trim();
                A.Observation = txtDescription.Text.Trim();
                A.NewActivity(A);
                Combo.Combo2Campos(owner.cbActivity, "Id", "Name", "Activity");
                owner.BtnDelete.Enabled = true;
                owner.CargarGrilla();
                L.Action     = "El usuario " + Users.CacheUser.Nick + " registró una nueva actividad: " + txtName.Text.ToString();
                L.ActionDate = DateTime.Now;
                L._users.Id  = Users.CacheUser.Id;
                L.WriteLog(L);
                DialogResult answ = MessageBox.Show("Se ha guardado la actividad exitosamente." + "\n ¿Desea agregar feligreses a la actividad?", "Ok", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (answ == DialogResult.Yes)
                {
                    this.Dispose();
                    this.Close();
                    frmActivities     FA  = new frmActivities();
                    frmModifyActivity FMA = new frmModifyActivity(A.GetLastId(), FA);
                    FMA.txtName.Text        = A.GetActivityName(A.GetLastId());
                    FMA.txtDescription.Text = A.GetActivityObservation(A.GetLastId());
                    FMA.ShowDialog();
                }
                else
                {
                    txtName.Clear();
                    txtDescription.Clear();
                    Combo.Combo2Campos(owner.cbActivity, "Id", "Name", "Activity");
                    owner.CargarGrilla();
                    owner.CheckComboItems();
                }
            }
        }
 public frmModifyActivity(int _activityId, frmActivities _owner)
 {
     InitializeComponent();
     activityId     = _activityId;
     selectedParish = 0;
     PBA            = new ParishionerByActivity();
     L           = new Log();
     A           = new Activity();
     owner       = _owner;
     flag        = 0;
     oldCategory = "";
 }
 public frmDataParishioners(string action, frmParishioners owner, frmActivities owner2)
 {
     InitializeComponent();
     flag        = 0;
     flag2       = 0;
     P           = new Parishioner();
     PD          = new ParishionerData();
     L           = new Log();
     Action      = action;
     parishId    = 0;
     telephoneId = 0;
     addressId   = 0;
     mailId      = 0;
     _owner      = owner;
     _owner2     = owner2;
 }