Esempio n. 1
0
        public static ResultadoTransaccion ListarOportunidadesPorCliente(Int64 IdCliente)
        {
            ResultadoTransaccion res = new ResultadoTransaccion();
            IList<clsOportunidad> ListaOportunidades = new List<clsOportunidad>();
            try
            {
                //Abrir Conexion
                conn = BaseDatos.Conexion();

                //Consultar Asuntos x Tipo Actividad
                objParams = SqlHelperParameterCache.GetSpParameterSet(conn, "sp_c_ventas_oportunidad_cliente");
                objParams[0].Value = IdCliente;

                SqlCommand command = new SqlCommand("sp_c_ventas_oportunidad_cliente", conn);

                command.Transaction = transaction;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader = command.ExecuteReader();

                while (dreader.Read())
                {
                    clsOportunidad ObjOportunidad = new clsOportunidad();
                    ObjOportunidad.Id32 = Convert.ToInt32(dreader[0]);
                    ObjOportunidad.Codigo = dreader[1].ToString();
                    ObjOportunidad.Tema = dreader[2].ToString();
                    ObjOportunidad.IdVendedor = Convert.ToInt16(dreader[3]);
                    ObjOportunidad.IdCustomer = Convert.ToInt16(dreader[4]);
                    ObjOportunidad.Descripcion = dreader[5].ToString();

                    ListaOportunidades.Add(ObjOportunidad);
                }
                res.Accion = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = ListaOportunidades;
            }
            catch (Exception ex)
            {
                Log.EscribirLog(ex.Message);

                resTransaccion.Descripcion = ex.Message;
                resTransaccion.ArchivoError = "clsOportunidadAdo.cs";
                resTransaccion.MetodoError = "Listar Oportunidades Por Cliente";
            }
            finally
            {
                conn.Close();
            }
            return res;
        }
Esempio n. 2
0
        public static ResultadoTransaccion ListarOportunidadesActividad(long IdActividad, int IdTipoActividad)
        {
            ResultadoTransaccion res = new ResultadoTransaccion();
            IList<clsOportunidad> ListaOportunidades = new List<clsOportunidad>();
            try
            {
                //Abrir Conexion
                conn = BaseDatos.Conexion();

                //Consultar Asuntos x Tipo Actividad
                objParams = SqlHelperParameterCache.GetSpParameterSet(conn, "sp_c_ventas_oportunidades_actividad");
                objParams[0].Value = IdActividad;
                objParams[1].Value = IdTipoActividad;

                SqlCommand command = new SqlCommand("sp_c_ventas_oportunidades_actividad", conn);

                command.Transaction = transaction;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader = command.ExecuteReader();

                while (dreader.Read())
                {
                    clsOportunidad ObjOportunidad = new clsOportunidad();

                    ObjOportunidad.Id = Convert.ToInt32(dreader[0]);

                    ListaOportunidades.Add(ObjOportunidad);
                }
                res.Accion = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = ListaOportunidades;
            }
            catch (Exception ex)
            {
                Log.EscribirLog(ex.Message);

                res.Descripcion = ex.Message;
                res.ArchivoError = "clsOportunidadAdo.cs";
                res.MetodoError = "Listar Oportunidades Actividad";
            }
            finally
            {
                conn.Close();
            }
            return res;
        }