protected void ListarProyecto()
    {
        BL_CJI3   obj         = new BL_CJI3();
        DataTable dtResultado = new DataTable();

        dtResultado = obj.ListarProyecto_CJI3(Convert.ToInt32(ddlAnio.SelectedValue), Convert.ToInt32(ddlMes.SelectedValue));

        if (dtResultado.Rows.Count > 0)
        {
            txtCustomer.Visible           = true;
            PnlCust.Visible               = true;
            CheckProyectos.Visible        = true;
            CheckProyectos.DataSource     = dtResultado;
            CheckProyectos.DataTextField  = dtResultado.Columns["DES_PROYECTO"].ToString();
            CheckProyectos.DataValueField = dtResultado.Columns["IDPROYECTO"].ToString();
            CheckProyectos.DataBind();

            btnConsultar.Visible = true;
            btnResumen.Visible   = true;
        }
        else
        {
            CheckProyectos.DataSource = null;
            CheckProyectos.DataBind();
            btnConsultar.Visible   = false;
            btnResumen.Visible     = false;
            txtCustomer.Visible    = false;
            CheckProyectos.Visible = false;
            PnlCust.Visible        = false;

            string cleanMessage = "No existen registro, verificar filtros";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
    }
Ejemplo n.º 2
0
    protected void ListarTC()
    {
        BL_CJI3   obj         = new BL_CJI3();
        DataTable dtResultado = new DataTable();

        dtResultado = obj.ListarTipodeCambio();
        if (dtResultado.Rows.Count > 0)
        {
            GridTc.DataSource = dtResultado;
            GridTc.DataBind();
        }
    }
    protected void ListarAnio()
    {
        BL_CJI3   obj         = new BL_CJI3();
        DataTable dtResultado = new DataTable();

        dtResultado = obj.Listar_anio();

        if (dtResultado.Rows.Count > 0)
        {
            ddlAnio.DataSource     = dtResultado;
            ddlAnio.DataTextField  = dtResultado.Columns["ANIO"].ToString();
            ddlAnio.DataValueField = dtResultado.Columns["INT_EJERCICIO"].ToString();
            ddlAnio.DataBind();
        }
    }
Ejemplo n.º 4
0
    protected void Seleccionar(object sender, ImageClickEventArgs e)
    {
        BL_CJI3     obj         = new BL_CJI3();
        ImageButton btnEditar   = ((ImageButton)sender);
        DataTable   dtResultado = new DataTable();

        dtResultado = obj.Listar_CJI3_TC(Convert.ToInt32(btnEditar.CommandArgument));
        if (dtResultado.Rows.Count > 0)
        {
            hdIdTc.Value           = dtResultado.Rows[0]["ID_TC"].ToString();
            txtTc.Text             = dtResultado.Rows[0]["DEC_TC"].ToString();
            ddlAnio2.SelectedValue = dtResultado.Rows[0]["INT_ANIO"].ToString();
            ddlMes2.SelectedValue  = dtResultado.Rows[0]["INT_MES"].ToString();
            //Meses();
        }
    }
    protected void proyectos()
    {
        BL_CJI3   obj         = new BL_CJI3();
        DataTable dtResultado = new DataTable();

        dtResultado = obj.uspSEL_CJI3_CENTROS_X_EMPRESA(ddlEmpresas.SelectedValue.ToString());

        if (dtResultado.Rows.Count > 0)
        {
            ddlProyectos.DataSource     = dtResultado;
            ddlProyectos.DataTextField  = dtResultado.Columns["DES_PROYECTO"].ToString();
            ddlProyectos.DataValueField = dtResultado.Columns["COD_CENTRO"].ToString();
            ddlProyectos.DataBind();
        }
        else
        {
            ddlProyectos.Items.Clear();
        }
    }
Ejemplo n.º 6
0
    protected void GrabarTC()
    {
        BL_CJI3   obj         = new BL_CJI3();
        DataTable dtResultado = new DataTable();
        int       id          = Convert.ToInt32(string.IsNullOrEmpty(hdIdTc.Value) ? "0" : hdIdTc.Value);

        dtResultado = obj.Registrar_CJI3_TC(id, Convert.ToDecimal(txtTc.Text), Convert.ToInt32(ddlAnio2.SelectedValue), Convert.ToInt32(ddlMes2.SelectedValue));
        if (dtResultado.Rows.Count > 0)
        {
            ListarTC();


            txtTc.Text   = string.Empty;
            hdIdTc.Value = string.Empty;

            string cleanMessage = "Registro Satisfactorio";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
    }
Ejemplo n.º 7
0
    protected void btnEliminar_Click(object sender, EventArgs e)
    {
        BL_CJI3      obj         = new BL_CJI3();
        BL_Seguridad objSeg      = new BL_Seguridad();
        DataTable    dtResultado = new DataTable();

        dtResultado = obj.eliminar_periodo(Convert.ToInt32(ddlAnio.SelectedValue), Convert.ToInt32(ddlMes.SelectedValue));
        string estado = dtResultado.Rows[0]["ESTADO"].ToString();

        if (estado == "1")
        {
            objSeg.auditoria_procesos("CJI3", Session["IDE_USUARIO"].ToString(), "");

            UC_MessageBox.Show(Page, this.GetType(), "Periodo eliminado satisfactoriamente");
        }
        else
        {
            UC_MessageBox.Show(Page, this.GetType(), "No existen registros ha eliminar");
            return;
        }
    }
    protected void Bulk_Insert()
    {
        string fileName         = Path.GetFileName(FileUpload1.PostedFile.FileName);
        string fileExtension    = Path.GetExtension(FileUpload1.PostedFile.FileName);
        string connectionString = string.Empty;


        fileName = fileName.Replace(".XLSX", ".XLS");

        string fullPath = Path.Combine(Server.MapPath("~/File/TEST/"), fileName);

        if (System.IO.File.Exists(fullPath))
        {
            File.Delete(fullPath);
        }


        FileUpload1.SaveAs(fullPath);

        if (fileExtension.ToUpper() == ".XLS")
        {
            connectionString = (Convert.ToString("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=") + fullPath) + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";
        }
        else if (fileExtension.ToUpper() == ".XLSX")
        {
            connectionString = (Convert.ToString("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=") + fullPath) + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
        }

        OleDbConnection con = new OleDbConnection(connectionString);
        OleDbCommand    cmd = new OleDbCommand();

        cmd.CommandType = System.Data.CommandType.Text;
        cmd.Connection  = con;
        OleDbDataAdapter dAdapter       = new OleDbDataAdapter(cmd);
        DataTable        dtExcelRecords = new DataTable();

        con.Open();
        DataTable dtExcelSheetName  = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
        string    getExcelSheetName = dtExcelSheetName.Rows[0]["Table_Name"].ToString();

        cmd.CommandText        = (Convert.ToString("SELECT * FROM [") + getExcelSheetName) + "]";
        dAdapter.SelectCommand = cmd;
        dAdapter.Fill(dtExcelRecords);
        con.Close();


        if (dtExcelRecords.Rows.Count > 0)
        {
            string consString = ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString;
            using (SqlConnection conx = new SqlConnection(consString))
            {
                conx.Open();
                // Get a reference to a single row in the table.
                DataRow[] rowArray = dtExcelRecords.Select();

                using (SqlBulkCopy bulkCopy = new SqlBulkCopy(conx))
                {
                    bulkCopy.DestinationTableName = "dbo.TMP_CJI3";

                    try
                    {
                        // Write the array of rows to the destination.
                        //bulkCopy.NotifyAfter = 15000;
                        bulkCopy.BulkCopyTimeout = 5000;
                        bulkCopy.BatchSize       = 50000;
                        bulkCopy.WriteToServer(rowArray);

                        BL_CJI3   obj         = new BL_CJI3();
                        DataTable dtResultado = new DataTable();
                        dtResultado = obj.Registrar_CJI3(Convert.ToInt32(ddlAnio.SelectedValue), Convert.ToInt32(ddlMes.SelectedValue));
                        if (dtResultado.Rows.Count > 0)
                        {
                            string estado = dtResultado.Rows[0]["PROCESADO"].ToString();
                            if (estado == "1")
                            {
                                string cleanMessage = "Proceso Satisfactorio : " + Convert.ToString(dtExcelRecords.Rows.Count).ToString() + " registros procesados";
                                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                            }
                            else
                            {
                                string cleanMessage = "El archivo ya se encuentra procesado";
                                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        string cleanMessage = "Error en archivo : " + ex.Message;
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                    }
                }
            }//using
        }
    }