Ejemplo n.º 1
0
    protected void btnConsultar_Click(object sender, EventArgs e)
    {
        try
        {
            lblMessageSuccess.Text = "";
            lblMessageError.Text   = "";
            lblDocNum.Text         = "";

            ComplementosController complementoController = new ComplementosController();
            SessionInfoModel       session = new SessionInfoModel();

            session = (SessionInfoModel)Session["SessionInfo"];
            IEnumerable <PagosModel> pagos;
            pagos = complementoController.GetPagosEfectuados(session.cardcode, Convert.ToDateTime(txtDate1.Text), Convert.ToDateTime(txtDate2.Text));

            if (pagos != null)
            {
                RadGrid1.DataSource = pagos;
                RadGrid1.DataBind();
            }
            else
            {
                RadGrid1.DataSource = null;
                RadGrid1.DataBind();
            }
        }
        catch (Exception ex)
        {
            lblMessageError.Text = ex.Message;
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblMessageError.Text = "";

        if (IsPostBack)
        {
            return;
        }

        try
        {
            ComplementosController complementoController = new ComplementosController();
            SessionInfoModel       session = new SessionInfoModel();

            if (Session["SessionInfo"] == null || Session["SessionInfo"].ToString() == "")
            {
                Response.Redirect("../Identity/Account/Login/Default.aspx", false);
            }
            else
            {
                txtDate1.Text = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01").ToShortDateString();
                txtDate2.Text = Convert.ToDateTime(DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month).ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString()).ToShortDateString();

                session = (SessionInfoModel)Session["SessionInfo"];
                IEnumerable <PagosModel> pagos;
                pagos = complementoController.GetPagosEfectuados(session.cardcode, Convert.ToDateTime(txtDate1.Text), Convert.ToDateTime(txtDate2.Text));

                if (pagos != null)
                {
                    RadGrid1.DataSource = pagos;
                    RadGrid1.DataBind();
                }
                else
                {
                    RadGrid1.DataSource = null;
                    RadGrid1.DataBind();
                }

                Panel1.Visible        = true;
                Panel2.Visible        = false;
                btnPaso1Tab.BackColor = System.Drawing.Color.FromArgb(180, 192, 216);
                btnProcesar.Enabled   = false;
                AlertXMLError.Visible = false;
                AlertSuccess.Visible  = false;

                lblHidePathXML.Visible = false;
                lblHideUUIDXML.Visible = false;
            }
        }
        catch (Exception ex)
        {
            lblMessageError.Text = ex.Message;
        }
    }
Ejemplo n.º 3
0
    protected void btnProcesar_Click(object sender, EventArgs e)
    {
        try
        {
            AlertSuccess.Visible   = false;
            lblMessageCreate.Text  = "";
            lblMessageSuccess.Text = "";
            lblMessageError.Text   = "";

            int docEntry = 0;
            foreach (Telerik.Web.UI.GridDataItem dataitem in RadGrid1.Items)
            {
                if ((dataitem.FindControl("CheckBox1") as CheckBox).Checked == true)
                {
                    docEntry = int.Parse(dataitem["DocEntry"].Text);
                }
            }

            SessionInfoModel       session      = new SessionInfoModel();
            ComplementosController complementos = new ComplementosController();

            session = (SessionInfoModel)Session["SessionInfo"];

            PagosModel pagos = new PagosModel
            {
                CardCode    = session.cardcode,
                CardName    = session.cardname,
                DocCurr     = "",
                DocDate     = "",
                DocEntry    = docEntry,
                DocNum      = int.Parse(lblDocNum.Text),
                DocTotal    = 0,
                lmUUID      = lblHideUUIDXML.Text,
                lmAttachXML = lblHidePathXML.Text
            };

            SAPB1Result result1 = complementos.UpdateOvpm(pagos);
            if (result1 != null)
            {
                if (result1.Status == "Error")
                {
                    lblMessageError.Text = result1.Messages;
                }
                else
                {
                    lblMessageSuccess.Text = result1.Messages;
                    lblMessageCreate.Text  = result1.Messages;
                    AlertSuccess.Visible   = true;

                    btnPaso1Tab.Enabled = false;
                    btnPaso2Tab.Enabled = false;

                    btnValidar.Enabled  = false;
                    btnProcesar.Enabled = false;
                }
            }
            else
            {
                lblMessageSuccess.Text = "Ocurrio un problema al intentar procesar el archivo XML.";
            }
            complementos = null;
        }
        catch (Exception ex)
        {
            lblMessageError.Text = ex.Message;
        }
    }