Example #1
0
    private void AutorizacionIngenieria(int iIdExchange)
    {
        var eam   = new ExchangeAutorizationManager();
        var infor = eam.GetInforAutorizacionIng(iIdExchange);

        lblGerenteIngenieria.ToolTip   = infor[1];
        lblEngenerAutorization.ToolTip = infor[0];
        var eact = eam.getExchangeAutorizationById(iIdExchange);

        if (eact.iIdExchangeAutorization > 0)
        {
            if (ddlAdminAutorization.Items.FindItemByValue(eact.iIdReviewTypeAdm.ToString()) != null)
            {
                ddlAdminAutorization.SelectedValue = eact.iIdReviewTypeAdm.ToString();
            }
            if (ddlEngenerAutorization.Items.FindItemByValue(eact.iIdReviewTypeEng.ToString()) != null)
            {
                ddlEngenerAutorization.SelectedValue = eact.iIdReviewTypeEng.ToString();
            }
            txtObsEngProduct.Text           = eact.sEngObsevations;
            txtObsEngManager.Text           = eact.sObsevations;
            txtObsEngManager.ReadOnly       = true;
            txtObsEngProduct.ReadOnly       = true;
            btnExchangeAutorization.Visible = false;
            btnUpdateAutorization.Visible   = true;
        }
        else
        {
            ConfigAutorization(eact);
            btnExchangeAutorization.Visible = true;
            btnUpdateAutorization.Visible   = false;
        }
    }
Example #2
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         util.GetActionMenu(mpMenu.SelectedItem.Value);
         var eam  = new ExchangeAutorizationManager();
         var eact = eam.getExchangeAutorizationById(int.Parse(lblIdExchange.Text));
         ConfigAutorization(eact);
         btnUpdateAutorization.Visible   = false;
         btnExchangeAutorization.Visible = true;
     }
     catch (AccessViolationException ave)
     {
         Alert.Permisos(this.Page);
     }
 }
Example #3
0
    protected void btnExchangeAutorization_Click(object sender, EventArgs e)
    {
        try
        {
            util.GetActionMenu(mpMenu.SelectedItem.Value);
            var eam   = new ExchangeAutorizationManager();
            int vUser = util.GetUserId();
            var eact  = eam.getExchangeAutorizationById(int.Parse(lblIdExchange.Text));
            int caso  = ConfigAutorization(eact);
            switch (caso)
            {
            case 0:
                throw new AccessViolationException();

            case 1:
                if (string.IsNullOrEmpty(txtObsEngManager.Text.Trim()) || string.IsNullOrEmpty(txtObsEngProduct.Text.Trim()))
                {
                    throw new ArgumentException("Las observaciones son requeridas.");
                }
                else
                {
                    eact.iIdReviewTypeAdm = int.Parse(ddlAdminAutorization.SelectedValue);
                    eact.sObsevations     = txtObsEngManager.Text.Trim();
                    eact.iIngenieroSup    = vUser;
                    eact.iIdReviewTypeEng = int.Parse(ddlEngenerAutorization.SelectedValue);
                    eact.sEngObsevations  = txtObsEngProduct.Text.Trim();
                    eact.iIngeniero       = vUser;
                }
                break;

            case 2:
                Util.isRequired(txtObsEngManager.Text, "Observaciones del Gerente de Ingenieria");
                eact.iIdReviewTypeAdm = int.Parse(ddlAdminAutorization.SelectedValue);
                eact.sObsevations     = txtObsEngManager.Text.Trim();
                eact.iIngenieroSup    = vUser;
                break;

            case 3:
                Util.isRequired(txtObsEngProduct.Text, "Observaciones del Ingeniero de Producto");
                eact.iIdReviewTypeEng = int.Parse(ddlEngenerAutorization.SelectedValue);
                eact.sEngObsevations  = txtObsEngProduct.Text.Trim();
                eact.iIngeniero       = vUser;
                break;
            }
            if (eact.iIdExchangeAutorization > 0)
            {
                eam.UpdateExchangeAutorization(eact);
            }
            else
            {
                eam.AddExchangeAutorization(eact);
            }
            btnExchangeAutorization.Visible = false;
            btnUpdateAutorization.Visible   = true;
            util.ErroDisplay(5, string.Empty, ref lblMessage);
        }
        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);
        }
    }