Пример #1
0
    protected void btnGenetate_Click(object sender, EventArgs e)
    {
        try
        {
            util.GetActionMenu(mpMenu.SelectedItem.Value);
            lblMessage.Text = "";
            Util.validateDatesHomeEnd(calLimite.SelectedDate.ToString(), "Fecha Limite");
            CamposRequeridos();
            var em  = new ExchangeManager();
            var ect = HeaderReq();
            ect.iStatus   = 1;
            ect.sFolio    = "0";
            ect.sFolioPre = DateTime.Now.Year.ToString() + String.Format("{0:00}", int.Parse(DateTime.Now.Month.ToString())) + String.Format("{0:0000}", em.GetNumberPrefolio());

            em.AddExchange(ect, false);
            var ectNow = em.getExchangeByPreFolioUnique(ect.sFolioPre);
            lblIdExchange.Text = ectNow.iIdExchange.ToString();

            if (ddlExchange.SelectedItem.Text.Contains("Cambio"))
            {
                var adm = new AffectationDocumentsManager();
                adm.AddAffectationDocuments(Afectacion());
            }
            BlockControls();
            btnClean.Visible                    = true;
            btnGenetate.Visible                 = false;
            lblPrefolio.Visible                 = true;
            lblPrefolioTitle.Visible            = true;
            btnUpdateExchange_Documents.Visible = false;
            btnExchangeUpdate.Visible           = true;
            lblPrefolio.Text                    = ectNow.sFolioPre;
            txtSrchPreFol.Text                  = ectNow.sFolioPre;
            gvExchange.DataBind();
        }
        catch (AccessViolationException ave)
        {
            Alert.Permisos(this.Page);
        }
        catch (ArgumentException ae)
        {
            util.ErroDisplay(3, ae.Message, ref lblMessage);
        }
        catch (Exception ex)
        {
            util.ErroDisplay(1, ex.Message, ref lblMessage);
        }
    }