Exemple #1
0
 /// <summary>
 /// Busca los datos para ser eliminados y manda a
 /// llamar el metodo de limpiar los controles
 /// </summary>
 private void Command()
 {
     if (rdoSearch.Checked)
     {
         List <GetAirLineAgreements> list = GetAirLineAgreementsBL.GetAirLineAgreements(txtAgreementCode.Text);
         if (list.Count > 0)
         {
             txtAgreementCode.Text          = list[0].IDAlCode;
             txtDomesticComission.Text      = list[0].DomesticComission;
             txtInternationalComission.Text = list[0].InternationalComission;
             txtOSI.Text      = list[0].OSI;
             txtTourCode.Text = list[0].TourCode;
         }
         else
         {
             ClearControls(string.Empty);
             txtAgreementCode.Focus();
         }
     }
     else if (rdoDelete.Checked)
     {
         DeleteAlAgreementsBL.DeleteAlAgreements(txtAgreementCode.Text);
         MessageBox.Show("BAJA DE ACUERDO DE AEROLINEA EXITOSA", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
         ClearControls(string.Empty);
         txtAgreementCode.Focus();
     }
 }
        /// <summary>
        /// Busca los datos para ser modificados y manda a
        /// llamar el metodo de limpiar los controles
        /// </summary>
        private void Command()
        {
            if (rdoSearch.Checked)
            {
                List <GetAirLineAgreements> list = GetAirLineAgreementsBL.GetAirLineAgreements(txtAgreementCode.Text);
                if (list.Count > 0)
                {
                    txtAgreementCode.Text          = list[0].IDAlCode;
                    txtDomesticComission.Text      = list[0].DomesticComission;
                    txtInternationalComission.Text = list[0].InternationalComission;
                    txtOSI.Text      = list[0].OSI;
                    txtTourCode.Text = list[0].TourCode;
                }
                else
                {
                    ClearControls(string.Empty);
                    txtAgreementCode.Focus();
                }
            }
            else if (rdoUpdate.Checked)
            {
                string tourcode = string.Empty;
                string osi      = string.Empty;

                if (!string.IsNullOrEmpty(txtOSI.Text))
                {
                    osi = txtOSI.Text;
                }
                else
                {
                    osi = null;
                }
                if (!string.IsNullOrEmpty(txtTourCode.Text))
                {
                    tourcode = txtTourCode.Text;
                }
                else
                {
                    tourcode = null;
                }
                UpdateAlAgreementsBL.UpdateAlAgreements(txtAgreementCode.Text, txtInternationalComission.Text, txtDomesticComission.Text, tourcode, osi);
                MessageBox.Show("MODIFICACIÓN DE ACUERDO DE AEROLINEA EXITOSA", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearControls(string.Empty);
                txtAgreementCode.Focus();
            }
        }
        /// <summary>
        /// Verifica si existe la AirLineAgreements y manda a llamar los metodos
        /// de validación y envio de comando
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAccept_Click(object sender, EventArgs e)
        {
            List <GetAirLineAgreements> list = GetAirLineAgreementsBL.GetAirLineAgreements(txtAgreementCode.Text);

            if (list.Count > 0)
            {
                exist = true;
            }
            else
            {
                exist = false;
            }

            if (IsValidBussinessRules)
            {
                Command();
            }
        }