Exemplo n.º 1
0
        protected void btnAddMotivoBaja_Click(object sender, EventArgs e)
        {
            try
            {
                MotivosBaja oMotivosBaja = null;

                if (!string.IsNullOrEmpty(this.lblMotivoBajaId.Text))
                {
                    oMotivosBaja = new Auxiliar().GetMotivoBaja(int.Parse(this.lblMotivoBajaId.Text));
                    oMotivosBaja.Descripcion = this.txtDesc.Text;

                    new Auxiliar().UpdateMotivoBaja(oMotivosBaja);
                }
                else
                {
                    oMotivosBaja = new MotivosBaja();

                    oMotivosBaja.Descripcion = this.txtDesc.Text;

                    new Auxiliar().AddMotivoBaja(oMotivosBaja);
                }

                this.FillGridMotivoBaja();
            }
            catch (Exception ex)
            {
                this.lblErrorMotivoBaja.Text = ex.Message;
            }
        }
Exemplo n.º 2
0
        private void FixupMotivosBaja(MotivosBaja previousValue)
        {
            if (previousValue != null && previousValue.Socios.Contains(this))
            {
                previousValue.Socios.Remove(this);
            }

            if (MotivosBaja != null)
            {
                if (!MotivosBaja.Socios.Contains(this))
                {
                    MotivosBaja.Socios.Add(this);
                }
                if (MotivoBajaId != MotivosBaja.MotivoBajaId)
                {
                    MotivoBajaId = MotivosBaja.MotivoBajaId;
                }
            }
            else if (!_settingFK)
            {
                MotivoBajaId = null;
            }
        }