Example #1
0
        public DataSet SCTREmitirIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        {
            SqlConnection CnDatos = new SqlConnection(connectionString);
            DataSet       DSTmp;

            CnDatos.Open();
            List <ENDatosError> oListaError = new List <ENDatosError>();

            try
            {
                if (CnDatos.State == ConnectionState.Open)
                {
                    SqlDataAdapter DATmp = new SqlDataAdapter("ws_Ctz_PerCotizacionEmitirIndividual", CnDatos);
                    DATmp.SelectCommand.CommandType = CommandType.StoredProcedure;
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@NumeroCotizacion", SqlDbType.VarChar, 50, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.NumeroCotizacion));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C01", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C01));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C02", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C02));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C03", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C03));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C04", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C04));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C05", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C05));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C06", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C06));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C07", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C07));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C08", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C08));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C09", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C09));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C10", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C10));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C11", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C11));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C12", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C12));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C13", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C13));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C14", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C14));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C15", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C15));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C16", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C16));
                    DSTmp = new DataSet();
                    DATmp.Fill(DSTmp);
                    CnDatos.Close();
                    DATmp   = null;
                    CnDatos = null;
                    return(DSTmp);
                }
                else
                {
                    DSTmp = null /* TODO Change to default(_) if this is not a reference type */;
                    CnDatos.Close();
                    CnDatos = null /* TODO Change to default(_) if this is not a reference type */;
                    return(DSTmp);
                }
            }
            catch (Exception ex)
            {
                string str = ex.Message;
                DSTmp = null;
                return(DSTmp);
            }
            finally
            {
                CnDatos.Close();
            }
        }
        //public List<ENDatosError> SCTREmisionIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        //{
        //    DbCommand oCommand = null;
        //    List<ENDatosError> oListaError = new List<ENDatosError>();
        //    try
        //    {
        //        oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "ws_Ctz_PerCotizacionEmitirIndividual");
        //        GenericDataAccess.AgregarParametro(oCommand, "@NumeroCotizacion", oENSCTR_EmisionTemporal.NumeroCotizacion, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C01", oENSCTR_EmisionTemporal.C01, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C02", oENSCTR_EmisionTemporal.C02, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C03", oENSCTR_EmisionTemporal.C03, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C04", oENSCTR_EmisionTemporal.C04, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C05", oENSCTR_EmisionTemporal.C05, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C06", oENSCTR_EmisionTemporal.C06, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C07", oENSCTR_EmisionTemporal.C07, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C08", oENSCTR_EmisionTemporal.C08, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C09", oENSCTR_EmisionTemporal.C09, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C10", oENSCTR_EmisionTemporal.C10, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C11", oENSCTR_EmisionTemporal.C11, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C12", oENSCTR_EmisionTemporal.C12, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C13", oENSCTR_EmisionTemporal.C13, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C14", oENSCTR_EmisionTemporal.C14, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C15", oENSCTR_EmisionTemporal.C15, TipoParametro.STR, Direccion.INPUT);
        //        //GenericDataAccess.AgregarParametro(oCommand, "@C16", oENSCTR_EmisionTemporal.C16, TipoParametro.STR, Direccion.INPUT);

        //        DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
        //        //DataTable schemaTable = oDataReader.GetSchemaTable();
        //        //foreach (DataRow row in schemaTable.Rows)
        //        //{
        //        //    foreach (DataColumn column in schemaTable.Columns)
        //        //    {
        //        //        Console.WriteLine(String.Format("{0} = {1}",
        //        //           column.ColumnName, row[column]));
        //        //    }
        //        //}

        //        //ENDatosError oEnListaDatosError = new ENDatosError();
        //        //while (oDataReader.Read())
        //        //{

        //        //    int v_Resultado = 0;
        //        //    v_Resultado = Convert.ToInt32(oDataReader["Resultado"]);
        //        //    //oEnListaDatosError.CodigoError = Convert.ToInt32(oDataReader["ProcesoResultado"]);
        //        //    //oEnListaDatosError.DescripcionError = oDataReader["ProcesoMensaje"].ToString();
        //        //    //oListaError.Add(oEnListaDatosError);

        //        //    if (oDataReader.NextResult())
        //        //    {
        //        //        while (oDataReader.Read())
        //        //        {

        //        //            //v2 = oDataReader["ProcesoMensaje"];

        //        //            oEnListaDatosError.CodigoError = Convert.ToInt32(oDataReader["ProcesoResultado"]);
        //        //            oEnListaDatosError.DescripcionError = oDataReader["ProcesoMensaje"].ToString();
        //        //            oListaError.Add(oEnListaDatosError);
        //        //        }
        //        //    }
        //        //}
        //        return oListaError;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new MyExcepcion(ex.Message);
        //    }
        //    //finally
        //    //{
        //    //    GenericDataAccess.CerrarConexion(oCommand, null);
        //    //}
        //}


        public bool Actualizar(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        {
            DbCommand oCommand = null;

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSCTR_EmisionTemporal_upd");
                GenericDataAccess.AgregarParametro(oCommand, "@argC01", oENSCTR_EmisionTemporal.C01, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC02", oENSCTR_EmisionTemporal.C02, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC03", oENSCTR_EmisionTemporal.C03, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC04", oENSCTR_EmisionTemporal.C04, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC05", oENSCTR_EmisionTemporal.C05, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC06", oENSCTR_EmisionTemporal.C06, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC07", oENSCTR_EmisionTemporal.C07, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC08", oENSCTR_EmisionTemporal.C08, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC09", oENSCTR_EmisionTemporal.C09, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC10", oENSCTR_EmisionTemporal.C10, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC11", oENSCTR_EmisionTemporal.C11, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC12", oENSCTR_EmisionTemporal.C12, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC13", oENSCTR_EmisionTemporal.C13, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC14", oENSCTR_EmisionTemporal.C14, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC15", oENSCTR_EmisionTemporal.C15, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argC16", oENSCTR_EmisionTemporal.C16, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argID", oENSCTR_EmisionTemporal.ID, TipoParametro.INT, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argIDGrupo", oENSCTR_EmisionTemporal.IDGrupo, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argNumeroCotizacion", oENSCTR_EmisionTemporal.NumeroCotizacion, TipoParametro.STR, Direccion.INPUT);

                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT);
                if (GenericDataAccess.ExecuteNonQuery(oCommand) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw new Excepciones.ManejoExcepciones(ex);
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
        public List <ENSCTR_EmisionTemporal> ObtenerTodos()
        {
            DbCommand oCommand = null;
            List <ENSCTR_EmisionTemporal> oListaSCTR_EmisionTemporal = new List <ENSCTR_EmisionTemporal>();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSCTR_EmisionTemporal_sel");
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    ENSCTR_EmisionTemporal oEnListaSCTR_EmisionTemporal = new ENSCTR_EmisionTemporal();
                    oEnListaSCTR_EmisionTemporal.C01              = oDataReader["C01"].ToString();
                    oEnListaSCTR_EmisionTemporal.C02              = oDataReader["C02"].ToString();
                    oEnListaSCTR_EmisionTemporal.C03              = oDataReader["C03"].ToString();
                    oEnListaSCTR_EmisionTemporal.C04              = oDataReader["C04"].ToString();
                    oEnListaSCTR_EmisionTemporal.C05              = oDataReader["C05"].ToString();
                    oEnListaSCTR_EmisionTemporal.C06              = oDataReader["C06"].ToString();
                    oEnListaSCTR_EmisionTemporal.C07              = oDataReader["C07"].ToString();
                    oEnListaSCTR_EmisionTemporal.C08              = oDataReader["C08"].ToString();
                    oEnListaSCTR_EmisionTemporal.C09              = oDataReader["C09"].ToString();
                    oEnListaSCTR_EmisionTemporal.C10              = oDataReader["C10"].ToString();
                    oEnListaSCTR_EmisionTemporal.C11              = oDataReader["C11"].ToString();
                    oEnListaSCTR_EmisionTemporal.C12              = oDataReader["C12"].ToString();
                    oEnListaSCTR_EmisionTemporal.C13              = oDataReader["C13"].ToString();
                    oEnListaSCTR_EmisionTemporal.C14              = oDataReader["C14"].ToString();
                    oEnListaSCTR_EmisionTemporal.C15              = oDataReader["C15"].ToString();
                    oEnListaSCTR_EmisionTemporal.C16              = oDataReader["C16"].ToString();
                    oEnListaSCTR_EmisionTemporal.ID               = Convert.ToInt32(oDataReader["ID"]);
                    oEnListaSCTR_EmisionTemporal.IDGrupo          = oDataReader["IDGrupo"].ToString();
                    oEnListaSCTR_EmisionTemporal.NumeroCotizacion = oDataReader["NumeroCotizacion"].ToString();
                    oListaSCTR_EmisionTemporal.Add(oEnListaSCTR_EmisionTemporal);
                }
                return(oListaSCTR_EmisionTemporal);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
Example #4
0
        public List <ENDatosError> XSCTREmitirIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        {
            //Employees = new List<Employee>();
            //Employees.Add(new Employee() { Name = "Nombre 1", Designation = "Des1", Location = "Aqp", ImportePrima = "150" });
            //Employees.Add(new Employee() { Name = "Nombre 2", Designation = "Des2", Location = "Lim", ImportePrima = "250" });

            ENDatosErrores = new List <ENDatosError>();
            ENDatosErrores.Add(new ENDatosError()
            {
                CodigoError = 1, DescripcionError = "Descripcion 1"
            });
            ENDatosErrores.Add(new ENDatosError()
            {
                CodigoError = 2, DescripcionError = "Descripcion 2"
            });
            ENDatosErrores.Add(new ENDatosError()
            {
                CodigoError = 3, DescripcionError = "Descripcion 3"
            });

            SqlConnection CnDatos = new SqlConnection(connectionString);
            DataSet       DSTmp;

            CnDatos.Open();

            try
            {
                if (CnDatos.State == ConnectionState.Open)
                {
                    SqlDataAdapter DATmp = new SqlDataAdapter("ws_Ctz_PerCotizacionEmitirIndividual", CnDatos);
                    DATmp.SelectCommand.CommandType = CommandType.StoredProcedure;
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@NumeroCotizacion", SqlDbType.VarChar, 50, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.NumeroCotizacion));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C01", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C01));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C02", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C02));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C03", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C03));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C04", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C04));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C05", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C05));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C06", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C06));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C07", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C07));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C08", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C08));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C09", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C09));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C10", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C10));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C11", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C11));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C12", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C12));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C13", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C13));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C14", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C14));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C15", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C15));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C16", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C16));
                    DSTmp = new DataSet();
                    DATmp.Fill(DSTmp);
                    CnDatos.Close();
                    DATmp   = null;
                    CnDatos = null;
                    //return listDSTmp;
                    return(ENDatosErrores);
                }
                else
                {
                    DSTmp = null /* TODO Change to default(_) if this is not a reference type */;
                    CnDatos.Close();
                    CnDatos = null /* TODO Change to default(_) if this is not a reference type */;
                    //return DSTmp;
                    return(ENDatosErrores);
                }
            }
            catch (Exception ex)
            {
                string str = ex.Message;
                DSTmp = null;
                //return DSTmp;
                return(ENDatosErrores);
            }
            finally
            {
                CnDatos.Close();
            }
        }
Example #5
0
        public List <ENDatosError> YSCTREmisionIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        {
            List <ENDatosError> oListaError = new List <ENDatosError>();

            return(oListaError);
        }
        //public static List<ENDatosError> SCTREmisionIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        //{
        //    return new ADSCTR_EmisionTemporal().SCTREmisionIndividual(oENSCTR_EmisionTemporal);
        //}

        //public DataSet DSETEmitirIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        //{
        //    return new ADCommon().SCTREmitirIndividual(oENSCTR_EmisionTemporal);
        //}

        public static List <ENDatosError> ListaSCTREmitirIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        {
            return(new ADCommon().ListaSCTREmitirIndividual(oENSCTR_EmisionTemporal));
        }
 public static bool Actualizar(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
 {
     return((new ADSCTR_EmisionTemporal()).Actualizar(oENSCTR_EmisionTemporal));
 }
 public static bool Insertar(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
 {
     return((new ADSCTR_EmisionTemporal()).Insertar(oENSCTR_EmisionTemporal));
 }
Example #9
0
        public List <ENDatosError> ListaSCTREmitirIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        {
            SqlConnection CnDatos = new SqlConnection(connectionString);
            DataSet       DSTmp;

            CnDatos.Open();
            List <ENDatosError> oListaError  = new List <ENDatosError>();
            DataTable           dtResultado0 = new DataTable();
            DataTable           dtResultado1 = new DataTable();
            DataTable           dtResultado2 = new DataTable();
            string sProcesoResultado         = "";
            string sProcesoMensaje           = "";

            try
            {
                if (CnDatos.State == ConnectionState.Open)
                {
                    SqlDataAdapter DATmp = new SqlDataAdapter("ws_Ctz_PerCotizacionEmitirIndividual", CnDatos);
                    DATmp.SelectCommand.CommandType = CommandType.StoredProcedure;
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@NumeroCotizacion", SqlDbType.VarChar, 50, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.NumeroCotizacion));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C01", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C01));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C02", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C02));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C03", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C03));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C04", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C04));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C05", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C05));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C06", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C06));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C07", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C07));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C08", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C08));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C09", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C09));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C10", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C10));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C11", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C11));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C12", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C12));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C13", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C13));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C14", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C14));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C15", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C15));
                    DATmp.SelectCommand.Parameters.Add(new SqlParameter("@C16", SqlDbType.VarChar, 200, ParameterDirection.Input, false, System.Convert.ToByte(0), System.Convert.ToByte(0), "", DataRowVersion.Current, oENSCTR_EmisionTemporal.C16));
                    DSTmp = new DataSet();
                    DATmp.Fill(DSTmp);
                    dtResultado0 = DSTmp.Tables[0];
                    dtResultado1 = DSTmp.Tables[1];
                    dtResultado2 = DSTmp.Tables[2];
                    // El store de Emisión Invoca otra store de Afiliación que puede producir errores
                    if (dtResultado0.Rows.Count != 0)
                    {
                        if (dtResultado0.Rows[0][0].ToString() == "-1")  // Error en store de Afiliación , se toma los valores de error de ese store
                        {
                            sProcesoResultado = dtResultado1.Rows[0][0].ToString();
                            sProcesoMensaje   = dtResultado1.Rows[0][1].ToString();
                        }
                        else // Sino se valida el segundo datatable
                        {
                            if (dtResultado1.Rows[0][0].ToString() == "1") // Si no hay error , se toma los códigos de Error de Emisión (dtResultado2)
                            {
                                sProcesoResultado = dtResultado2.Rows[0][0].ToString();
                                sProcesoMensaje   = dtResultado2.Rows[0][1].ToString();
                            }
                            else // error de store de Afiliación
                            {
                                sProcesoResultado = dtResultado1.Rows[0][0].ToString();
                                sProcesoMensaje   = dtResultado1.Rows[0][1].ToString();
                            }
                        }
                    }
                    ENDatosError oEnListaDatosError = new ENDatosError();
                    oEnListaDatosError.CodigoError      = Convert.ToInt32(sProcesoResultado);
                    oEnListaDatosError.DescripcionError = sProcesoMensaje;
                    oListaError.Add(oEnListaDatosError);
                    CnDatos.Close();
                    DATmp   = null;
                    CnDatos = null;
                    return(oListaError);
                }
                else
                {
                    DSTmp = null /* TODO Change to default(_) if this is not a reference type */;
                    CnDatos.Close();
                    CnDatos = null /* TODO Change to default(_) if this is not a reference type */;
                    return(oListaError);
                }
            }
            catch (Exception ex)
            {
                string str = ex.Message;
                DSTmp = null;
                CnDatos.Close();
                return(oListaError);
            }
        }
Example #10
0
        public ActionResult ProcesaEmision()
        {
            string[]            ArExcel = new string[21];
            DataRow             dr;
            DataTable           dtEmision   = new DataTable();
            bool                sErrFila    = false;
            List <ENDatosError> oListaError = new List <ENDatosError>();

            if (ModelState.IsValid)
            {
                dtEmision                = (DataTable)System.Web.HttpContext.Current.Cache.Get(System.Web.HttpContext.Current.Session.SessionID.ToString() + "dtEmiteSCTR");
                v_codigocentrocosto      = System.Web.HttpContext.Current.Session["codigocentrocosto"].ToString();
                v_descripcioncentrocosto = System.Web.HttpContext.Current.Session["descripcioncentrocosto"].ToString();
                v_codigocotizacion       = System.Web.HttpContext.Current.Session["codigocotizacion"].ToString();
                //



                //

                for (int i = 0; i < dtEmision.Rows.Count - 1; i++)
                {
                    dr = dtEmision.Rows[i];

                    if (dtEmision.Columns.Count > 0)
                    {
                        ArExcel[0]  = dtEmision.Rows[i]["Nombres"].ToString();
                        ArExcel[1]  = dtEmision.Rows[i]["Paterno"].ToString();
                        ArExcel[2]  = dtEmision.Rows[i]["Materno"].ToString();
                        ArExcel[3]  = dtEmision.Rows[i]["TipoTrab"].ToString();
                        ArExcel[4]  = dtEmision.Rows[i]["TipoDoc"].ToString();
                        ArExcel[5]  = dtEmision.Rows[i]["NroDoc"].ToString();
                        ArExcel[6]  = dtEmision.Rows[i]["Sexo"].ToString();
                        ArExcel[7]  = dtEmision.Rows[i]["EstadoCivil"].ToString();
                        ArExcel[8]  = dtEmision.Rows[i]["Direccion"].ToString();
                        ArExcel[9]  = dtEmision.Rows[i]["Telefono"].ToString();
                        ArExcel[10] = dtEmision.Rows[i]["FechaNac"].ToString();
                        ArExcel[11] = dtEmision.Rows[i]["Correo"].ToString();
                        ArExcel[12] = dtEmision.Rows[i]["Moneda"].ToString();
                        ArExcel[13] = dtEmision.Rows[i]["Sueldo"].ToString();
                        if (sErrFila)
                        {
                            ArExcel[14] = "E";
                        }
                        else
                        {
                            ArExcel[14] = " ";
                        }
                        ArExcel[15] = v_codigocentrocosto + "-" + v_descripcioncentrocosto;
                        ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal = null;
                        oENSCTR_EmisionTemporal = new ENSCTR_EmisionTemporal();
                        oENSCTR_EmisionTemporal.NumeroCotizacion = v_codigocotizacion;
                        oENSCTR_EmisionTemporal.C01 = dtEmision.Rows[i]["Nombres"].ToString();
                        oENSCTR_EmisionTemporal.C02 = dtEmision.Rows[i]["Paterno"].ToString();
                        oENSCTR_EmisionTemporal.C03 = dtEmision.Rows[i]["Materno"].ToString();
                        oENSCTR_EmisionTemporal.C04 = dtEmision.Rows[i]["TipoTrab"].ToString();
                        oENSCTR_EmisionTemporal.C05 = dtEmision.Rows[i]["TipoDoc"].ToString();
                        oENSCTR_EmisionTemporal.C06 = dtEmision.Rows[i]["NroDoc"].ToString();
                        oENSCTR_EmisionTemporal.C07 = dtEmision.Rows[i]["Sexo"].ToString();
                        oENSCTR_EmisionTemporal.C08 = dtEmision.Rows[i]["EstadoCivil"].ToString();
                        oENSCTR_EmisionTemporal.C09 = dtEmision.Rows[i]["Direccion"].ToString();
                        oENSCTR_EmisionTemporal.C10 = dtEmision.Rows[i]["Telefono"].ToString();
                        oENSCTR_EmisionTemporal.C11 = dtEmision.Rows[i]["FechaNac"].ToString();
                        oENSCTR_EmisionTemporal.C12 = dtEmision.Rows[i]["Correo"].ToString();
                        oENSCTR_EmisionTemporal.C13 = dtEmision.Rows[i]["Moneda"].ToString();
                        oENSCTR_EmisionTemporal.C14 = dtEmision.Rows[i]["Sueldo"].ToString();
                        oENSCTR_EmisionTemporal.C15 = ArExcel[14];
                        oENSCTR_EmisionTemporal.C16 = ArExcel[15];
                        //var listaResultado = LNSCTR_EmisionTemporal.ListaSCTREmitirIndividual(oENSCTR_EmisionTemporal).ToList();
                        oListaError = LNSCTR_EmisionTemporal.ListaSCTREmitirIndividual(oENSCTR_EmisionTemporal).ToList();
                    }
                }
            }

            v_codigocotizacion              = System.Web.HttpContext.Current.Session["codigocotizacion"].ToString();
            v_empresanombre                 = System.Web.HttpContext.Current.Session["empresanombre"].ToString();
            v_empresaruc                    = System.Web.HttpContext.Current.Session["empresaruc"].ToString();
            v_codigocliente                 = System.Web.HttpContext.Current.Session["codigocliente"].ToString();
            v_detmontoplanillaadm           = Convert.ToDouble(System.Web.HttpContext.Current.Session["detmontoplanillaadm"]);
            v_detmontoplanillaope           = Convert.ToDouble(System.Web.HttpContext.Current.Session["detmontoplanillaope"]);
            v_codigocentrocosto             = System.Web.HttpContext.Current.Session["codigocentrocosto"].ToString();
            v_descripcioncentrocosto        = System.Web.HttpContext.Current.Session["descripcioncentrocosto"].ToString();
            ViewData["txtEmpresaRUC"]       = v_empresaruc;
            ViewData["txtEmpresaNombre"]    = v_empresanombre;
            ViewData["txtCodigoCotizacion"] = v_codigocotizacion;
            ViewData["txtCodigoCliente"]    = v_codigocliente;
            ViewData["txtPlanillaMensual"]  = v_detmontoplanillaadm + v_detmontoplanillaope;
            ViewBag.CodigoCentroCosto       = new SelectList(LNSaludCentroCostos.ObtenerTodos(v_codigocliente).ToList(), "CodigoCentroCosto", "DescripcionCentroCosto", v_codigocentrocosto);
            ViewBag.Message                 = "Registros Procesados Correctamente";
            //return Json(new { success = true, message = "Grabado Correctamente" }, JsonRequestBehavior.AllowGet);
            return(PartialView("Upload"));
        }
Example #11
0
        //Declaracion Funcion


        #region Consultas Base de  Datos

        //public List<ENDatosError> dsEmitirIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        //{
        //    return new ADCommon().YSCTREmisionIndividual(oENSCTR_EmisionTemporal);

        //}


        public DataSet DSETEmitirIndividual(ENSCTR_EmisionTemporal oENSCTR_EmisionTemporal)
        {
            return(new ADCommon().SCTREmitirIndividual(oENSCTR_EmisionTemporal));
        }