Exemplo n.º 1
0
    protected void btnUpdateExchange_Documents_Click(object sender, EventArgs e)
    {
        try
        {
            lblMessage.Text = "";
            util.GetActionMenu(mpMenu.SelectedItem.Value);
            CamposRequeridos();
            var ect    = HeaderReq();
            var ectNow = new ExchangeCompositeType();
            var em     = new ExchangeManager();
            ect         = em.getExchangeById(int.Parse(lblIdExchange.Text.Trim()));
            ect.iStatus = 2;
            em.UpdateExchange(ect, ((RadButton)sender).ID);
            ectNow             = em.getExchangeByPreFolioUnique(ect.sFolioPre);
            lblIdExchange.Text = ectNow.iIdExchange.ToString();

            if (ddlExchange.SelectedItem.Text.Contains("Cambio"))
            {
                var adm = new AffectationDocumentsManager();
                if (adm.GetCountAffectationDocumentsByIdExchange(int.Parse(lblIdExchange.Text.ToString())) > 0)
                {
                    adm.UpdateAffectationDocuments(Afectacion());
                }
                else
                {
                    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);
        }
    }
Exemplo n.º 2
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);
        }
    }
Exemplo n.º 3
0
 private void AddDocumentosAfectados()
 {
     if (ddlExchange.SelectedItem.Text.Contains("Cambio"))
     {
         var adct = new affectationDocumentsCompositeType();
         var adm  = new AffectationDocumentsManager();
         adct.bAMEF            = chkAMEF.Checked;
         adct.bCost            = chkCost.Checked;
         adct.bDevices         = chkDevices.Checked;
         adct.bDrawing         = chkDrawing.Checked;
         adct.bEspecifications = chkEspecification.Checked;
         adct.bHOE             = chkHOE.Checked;
         adct.bMedia           = chkMedia.Checked;
         adct.bMold            = chkMold.Checked;
         adct.bOthers          = chkOthers.Checked;
         adct.bPlan            = chkPlan.Checked;
         adct.bSAP             = chkSAP.Checked;
         adct.bSingOff         = chkSing.Checked;
         adct.iIdExchange      = int.Parse(lblIdExchange.Text.ToString());
         try
         {
             if (adm.GetCountAffectationDocumentsByIdExchange(adct.iIdExchange) > 0)
             {
                 adm.UpdateAffectationDocuments(adct);
             }
             else
             {
                 adm.AddAffectationDocuments(adct);
             }
         }
         catch (Exception ex)
         {
             throw new Exception(ex.Message);
         }
     }
 }