Beispiel #1
0
        public DataTable ListarCotizacionesPorProyecto(int id_proyecto)
        {
            DataSet dts = new DataSet();

            try {
                con.ConnectionString = conection.GetCon();
                cmd.Connection       = con;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "DOCUMENTO.ListarCotizacionesPorProyecto";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@id_proyecto", id_proyecto);

                SqlDataAdapter adapter;
                adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dts, "Cotizaciones");
                return(dts.Tables["Cotizaciones"]);
            } catch (SqlException ex) {
                throw new Exception("Error mostrando las Cotizaciones: " + ex.Message);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
        }
Beispiel #2
0
        public int NewId()
        {
            int newid;

            try {
                con.ConnectionString = conection.GetCon();
                cmd.Connection       = con;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "DOCUMENTO.NewDocument";

                var returnParameter = cmd.Parameters.Add("@NewId", SqlDbType.Int);
                returnParameter.Direction = ParameterDirection.Output;

                con.Open();
                cmd.ExecuteNonQuery();

                newid = (int)cmd.Parameters["@NewId"].Value;;
            } catch (Exception ex) {
                throw new Exception("Error generando nuevo Id de documento: " + ex.Message);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(newid);
        }
Beispiel #3
0
        public Boolean FichaMarketingNew(FichaMarketingBE fmbe)
        {
            con.ConnectionString = conection.GetCon();
            cmd.Connection       = con;
            cmd.CommandType      = CommandType.StoredProcedure;
            cmd.CommandText      = "MARKETING.FichaMarketingNew";

            try {
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@id_ficha_marketing", fmbe.Id_ficha_marketing);
                cmd.Parameters.AddWithValue("@id_persona_fuente", fmbe.Id_persona_fuente);
                cmd.Parameters.AddWithValue("@forma_contacto_inical", fmbe.Forma_contacto_inical);
                cmd.Parameters.AddWithValue("@primer_interes", fmbe.Primer_interes);
                cmd.Parameters.AddWithValue("@fecha_primer_contacto", fmbe.Fecha_primer_contacto);
                cmd.Parameters.AddWithValue("@fecha_ultimo_contacto", fmbe.Fecha_ultimo_contacto);

                con.Open();
                cmd.ExecuteNonQuery();

                success = true;
            } catch (SqlException x) {
                success = false;
                throw new Exception(x.Message);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                cmd.Parameters.Clear();
            }
            return(success);
        }
Beispiel #4
0
        public AuthBE CredentialSelect(string username)
        {
            AuthBE authBE = new AuthBE();

            try {
                con.ConnectionString = conection.GetCon();
                cmd.Connection       = con;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "PERSONA.CredentialSelect";

                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@usuario", username);

                con.Open();
                SqlDataReader dtr = cmd.ExecuteReader();

                if (dtr.HasRows == true)
                {
                    dtr.Read();
                    authBE.Id_usuario = int.Parse(dtr["id_usuario"].ToString());
                    authBE.Empleado   = int.Parse(dtr["empleado"].ToString());
                    authBE.Password   = dtr["password"].ToString();
                    authBE.Usuario    = dtr["usuario"].ToString();
                    authBE.Salt       = dtr["salt"].ToString();
                    authBE.Active     = bool.Parse(dtr["active"].ToString());
                }
                else
                {
                    throw new Exception("El usuario no Existe");
                }
                dtr.Close();
            } catch (Exception ex) {
                throw new Exception("El usuario no existe: " + ex.Message);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                cmd.Parameters.Clear();
            }
            return(authBE);
        }
Beispiel #5
0
        public DataTable ListarPlanosFull()
        {
            DataSet dts = new DataSet();

            try {
                con.ConnectionString = conection.GetCon();
                cmd.Connection       = con;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "DOCUMENTO.ListarPlanosFull";
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dts, "Planos");
            } catch (Exception ex) {
                throw new Exception("Error mostrando los Planos: " + ex.Message);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(dts.Tables["Planos"]);
        }
Beispiel #6
0
        public DataTable ListarTelefonos()
        {
            DataSet dts = new DataSet();

            try {
                con.ConnectionString = conection.GetCon();
                cmd.Connection       = con;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "PERSONA.ListarTelefonos";
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dts, "Teléfonos");
            } catch (Exception ex) {
                throw new Exception("Error mostrando los teléfonos: " + ex.Message);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                cmd.Parameters.Clear();
            }
            return(dts.Tables["Teléfonos"]);
        }
        public DataTable ListarContactoInicial()
        {
            DataSet dts = new DataSet();

            try {
                con.ConnectionString = conection.GetCon();
                cmd.Connection       = con;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "MARKETING.ListarContactoInicial";
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dts, "ContactoInicial");
            } catch (Exception ex) {
                throw new Exception("Error mostrando los tipos de Contactos: " + ex.Message);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(dts.Tables["ContactoInicial"]);
        }
Beispiel #8
0
        public DataTable ListarEmpleados()
        {
            DataSet dts = new DataSet();

            try {
                con.ConnectionString = conection.GetCon();
                cmd.Connection       = con;
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.CommandText      = "PERSONA.ListarEmpleados";
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dts, "Fuente");
            } catch (Exception ex) {
                throw new Exception("Error mostrando las personas fuente: " + ex.Message);
            } finally {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(dts.Tables["Fuente"]);
        }