示例#1
0
        private static ResultadoTransaccion GuardaNuevaNaviera(PaperlessNaviera naviera, SqlConnection connparam, SqlTransaction tranparam)
        {
            Int64 idnaviera = 0;
            resTransaccion = new ResultadoTransaccion();
            try {

                objParams = SqlHelperParameterCache.GetSpParameterSet(connparam, "SP_N_PAPERLESS_NAVIERA");
                objParams[0].Value = naviera.Nombre;
                objParams[1].Value = naviera.Activo;

                SqlCommand command = new SqlCommand("SP_N_PAPERLESS_NAVIERA", connparam);
                command.Transaction = tranparam;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                idnaviera = Convert.ToInt64(command.ExecuteScalar());

                resTransaccion.Estado = Enums.EstadoTransaccion.Aceptada;
                resTransaccion.ObjetoTransaccion = idnaviera;

            } catch (Exception ex) {
                resTransaccion.Estado = Enums.EstadoTransaccion.Rechazada;
                resTransaccion.Descripcion = ex.Message;
                Log.EscribirLog(ex.Message);
            }
            return resTransaccion;
        }
示例#2
0
        //FIN TSC
        public static IList<PaperlessNaviera> ObtenerNavieras(Enums.Estado estado)
        {
            PaperlessNaviera naviera = null;
            IList<PaperlessNaviera> listNavieras = new List<PaperlessNaviera>();
            try {
                //Abrir Conexion
                conn = BaseDatos.NuevaConexion();
                objParams = SqlHelperParameterCache.GetSpParameterSet(conn, "SP_L_PAPERLESS_NAVIERA");
                objParams[0].Value = estado;
                SqlCommand command = new SqlCommand("SP_L_PAPERLESS_NAVIERA", conn);
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader = command.ExecuteReader();

                while (dreader.Read()) {
                    naviera = new PaperlessNaviera();
                    naviera.Id = Convert.ToInt64(dreader["Id"]);
                    naviera.Nombre = dreader["Descripcion"].ToString();
                    //naviera.Activo = (Entidades.Enums.Enums.Estado)(Convert.ToInt16(dreader["Activo"]));
                    listNavieras.Add(naviera);
                }
            } catch (Exception ex) {
                Base.Log.Log.EscribirLog(ex.Message);
            } finally {
                conn.Close();
            }

            return listNavieras;
        }