コード例 #1
0
    protected void btnSave_Click(object sender, ImageClickEventArgs e)
    {
        Requ_Numero      = Request.QueryString["Requ_Numero"].ToString();
        Reqd_CodLinea    = Request.QueryString["Reqd_CodLinea"].ToString();
        Reqs_Correlativo = Request.QueryString["Reqs_Correlativo"].ToString();
        idValor          = Request.QueryString["idValor"].ToString();
        Proyecto         = Request.QueryString["Proyecto"].ToString();

        string cleanMessage = string.Empty;


        string CODIGO = string.IsNullOrEmpty(idValor) ? "0" : idValor;
        string PRECIO = string.IsNullOrEmpty(txtPrecio.Text) ? "0" : txtPrecio.Text;

        if (txtPrecio.Text.Trim() == string.Empty)
        {
            cleanMessage = "Ingresar tarifa";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            ScriptManager.RegisterStartupScript(this, typeof(Page), "myScript", "gridviewScroll();", true);
        }
        else
        {
            //verificamos fecha de registro
            BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle();
            DataTable dt = new DataTable();
            dt = obj.USP_TBL_VALORIZACION_FECHA_TARIFA(Requ_Numero,
                                                       Reqd_CodLinea,
                                                       Reqs_Correlativo,
                                                       txtInicio.Text.Trim());
            if (dt.Rows[0]["ESTADO"].ToString() == "0")
            {
                cleanMessage = dt.Rows[0]["MSG"].ToString();
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
            else
            {
                DataTable dtResultado = new DataTable();

                dtResultado = obj.uspINS_valorizar_ValorPeriodo(
                    Convert.ToInt32(CODIGO),
                    Requ_Numero,
                    Reqd_CodLinea,
                    Reqs_Correlativo,
                    txtInicio.Text.Trim(),
                    PRECIO,
                    Session["IDE_USUARIO"].ToString(),
                    Proyecto

                    );
                if (dtResultado.Rows.Count > 0)
                {
                    txtInicio.Text = string.Empty;
                    Listar();
                    cleanMessage = "Registro satisfactorio";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                }
            }
        }
    }