Example #1
0
        public List<ENT_Muestra> ListarEnProceso(int UsuarioID)
        {
            List<ENT_Muestra> oLista = new List<ENT_Muestra>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarEnProceso";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@UsuarioID", SqlDbType.Int).Value = UsuarioID;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();
                // Parametro,prioridad, resultado, fec_i,fech_f, estado, operdador
                while (DrSql.Read())
                {
                    ENT_Muestra oEnt_Muestra = new ENT_Muestra();
                    oEnt_Muestra.MuestraDetalleID = DrSql.GetInt32(DrSql.GetOrdinal("MuestraDetalleID"));
                    oEnt_Muestra.CodigoMuestra = DrSql.GetString(DrSql.GetOrdinal("CodigoMuestra"));
                    oEnt_Muestra.NomParametro = DrSql.GetString(DrSql.GetOrdinal("NomParametro"));
                    oEnt_Muestra.TipoParametroID = DrSql.GetInt32(DrSql.GetOrdinal("TipoParametroID"));
                    oEnt_Muestra.Formula = DrSql.GetString(DrSql.GetOrdinal("Formula"));
                    oEnt_Muestra.FechaFinEstimado = DrSql.GetDateTime(DrSql.GetOrdinal("FechaFinEstimado"));
                    oLista.Add(oEnt_Muestra);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarMuestrasPendientes", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #2
0
        public List<ENT_Laboratorio> ListarLaboratorio(int UsuarioID)
        {
            List<ENT_Laboratorio> oLista = new List<ENT_Laboratorio>(UsuarioID);

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarLaboratorio";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@UsuarioID", SqlDbType.Int).Value = UsuarioID;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_Laboratorio oEnt_Laboratorio = new ENT_Laboratorio();
                    oEnt_Laboratorio.NomLaboratorio = DrSql.GetString(DrSql.GetOrdinal("NomLaboratorio"));
                    oEnt_Laboratorio.LaboratorioID = DrSql.GetInt32(DrSql.GetOrdinal("LaboratorioID"));
                    oEnt_Laboratorio.LaboratorioCod = DrSql.GetString(DrSql.GetOrdinal("LaboratorioCod"));
                    oEnt_Laboratorio.Ubicacion  = DrSql.GetString(DrSql.GetOrdinal("Ubicacion"));
                    oEnt_Laboratorio.FechaRegistro = DrSql.GetDateTime(DrSql.GetOrdinal("FechaRegistro"));
                    oLista.Add(oEnt_Laboratorio);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarLaboratorio", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #3
0
        public List<ENT_Ciudad> ListarCiudad(int filtro)
        {
            List<ENT_Ciudad> oLista = new List<ENT_Ciudad>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarCiudad";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@filtro", SqlDbType.VarChar).Value = filtro;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_Ciudad oEnt_Ciudad = new ENT_Ciudad();
                    oEnt_Ciudad.NombreCiudad = DrSql.GetString(DrSql.GetOrdinal("NombreCiudad"));
                    oEnt_Ciudad.CiudadID = DrSql.GetInt32(DrSql.GetOrdinal("CiudadID"));
                    oLista.Add(oEnt_Ciudad);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListaCiudad", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #4
0
        public List<ENT_UnidadMedida> ListarUM()
        {
            List<ENT_UnidadMedida> oLista = new List<ENT_UnidadMedida>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarUM";
            connect.MyCmd.Parameters.Clear();

               // connect.MyCmd.Parameters.Add("@UsuarioID", SqlDbType.Int).Value = UsuarioID;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_UnidadMedida oEnt_UM = new ENT_UnidadMedida();
                    oEnt_UM.NombreUM = DrSql.GetString(DrSql.GetOrdinal("NombreUM"));
                    oEnt_UM.UnidadMedidaID = DrSql.GetInt32(DrSql.GetOrdinal("UnidadMedidaID"));
                    oLista.Add(oEnt_UM);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarUM", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #5
0
        public List<ENT_ProductoAtributo> ListarAtributoXLab(string ProdLabCod)
        {
            List<ENT_ProductoAtributo> oLista = new List<ENT_ProductoAtributo>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarAtributoXLab";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@ProdLabCod", SqlDbType.VarChar, 10).Value = ProdLabCod;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_ProductoAtributo oEnt_ProductoAtributo = new ENT_ProductoAtributo();
                    oEnt_ProductoAtributo.NomAtributo = DrSql.GetString(DrSql.GetOrdinal("NomAtributo"));
                    oLista.Add(oEnt_ProductoAtributo);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarProdPara", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #6
0
        //public List<ENT_Empresa> ListaA() {
        //    List<ENT_Empresa> oLista = new List<ENT_Empresa>();
        //    string strSQLconnection = "Data Source=dbServer;Initial Catalog=testDB;Integrated Security=True";
        //    SqlConnection sqlConnection = new SqlConnection(strSQLconnection);
        //    SqlCommand sqlCommand = new SqlCommand();
        //    sqlCommand.CommandType = CommandType.StoredProcedure;
        //    sqlCommand.CommandText = "Nombre_Procedimiento_Almacenado";
        //    sqlCommand.Parameters.Clear();
        //    sqlCommand.Parameters.Add("@Valor", SqlDbType.VarChar).Value = ruc;
        //    sqlConnection.Open();
        //    SqlDataReader DrSql = default(SqlDataReader);
        //    DrSql = sqlCommand.ExecuteReader();
        //    sqlConnection.Close();
        //    while (DrSql.Read())
        //    {
        //        ENT_Empresa oEnt_Empresa = new ENT_Empresa();
        //        oEnt_Empresa.RazonSocial = DrSql.GetString(DrSql.GetOrdinal("RazonSocial"));
        //        oEnt_Empresa.EmpresaCod = DrSql.GetString(DrSql.GetOrdinal("EmpresaCod"));
        //        oLista.Add(oEnt_Empresa);
        //    }
        //    DrSql.Close();
        //}
        public List<ENT_Empresa> ListarEmpresa(string ruc)
        {
            List<ENT_Empresa> oLista = new List<ENT_Empresa>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarEmpresa";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@RUC", SqlDbType.VarChar).Value = ruc;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_Empresa oEnt_Empresa = new ENT_Empresa();
                    oEnt_Empresa.RazonSocial = DrSql.GetString(DrSql.GetOrdinal("RazonSocial"));
                    oEnt_Empresa.EmpresaCod = DrSql.GetString(DrSql.GetOrdinal("EmpresaCod"));
                    oLista.Add(oEnt_Empresa);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarLaboratorio", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #7
0
        public List<ENT_Pais> ListarPais()
        {
            List<ENT_Pais> oLista = new List<ENT_Pais>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarPais";
            connect.MyCmd.Parameters.Clear();
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_Pais oEnt_Pais = new ENT_Pais();
                    oEnt_Pais.NombrePais = DrSql.GetString(DrSql.GetOrdinal("NombrePais"));
                    oEnt_Pais.PaisID = DrSql.GetInt32(DrSql.GetOrdinal("PaisID"));
                    oLista.Add(oEnt_Pais);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarPais", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #8
0
        public Dictionary<string, string> ObtenerEtiquetasPorIdioma(string codigoidioma)
        {
            Dictionary<string,string> iLista = new Dictionary<string,string>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarEtiquetas";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@Idioma", SqlDbType.VarChar).Value = codigoidioma;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    iLista.Add(DrSql.GetString(DrSql.GetOrdinal("coetiqueta")).ToString().Trim(), DrSql.GetString(DrSql.GetOrdinal("valor")).ToString().Trim());
                }

                DrSql.Close();

                TransSql.Commit();
                return iLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerEtiquetasPorIdioma", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #9
0
        public bool ActualizarUsuario(ENT_Usuario oEnt_Usuario, int Tipo)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ActualizarUsuario";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@UsuarioID", SqlDbType.Int).Value = oEnt_Usuario.UsuarioID;
            connect.MyCmd.Parameters.Add("@Nombre", SqlDbType.VarChar).Value = oEnt_Usuario.Nombre;
            connect.MyCmd.Parameters.Add("@PerfilUsuarioID", SqlDbType.Int).Value = oEnt_Usuario.PerfilUsuarioID;
            connect.MyCmd.Parameters.Add("@LaboratorioID", SqlDbType.Int).Value = oEnt_Usuario.LaboratorioID;
            connect.MyCmd.Parameters.Add("@Correo", SqlDbType.VarChar).Value = oEnt_Usuario.Correo;
            connect.MyCmd.Parameters.Add("@Estado", SqlDbType.Int).Value = oEnt_Usuario.Estado;
            connect.MyCmd.Parameters.Add("@Clave", SqlDbType.VarChar).Value = oEnt_Usuario.Clave;
            connect.MyCmd.Parameters.Add("@Tipo", SqlDbType.Int).Value = Tipo;
            connect.MyCmd.Parameters.Add("@RestriccionIP", SqlDbType.Int).Value = oEnt_Usuario.RestriccionIP;

            //connect.MyCmd.Parameters.Add("@existe", SqlDbType.Int).Direction = ParameterDirection.Output;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.ExecuteNonQuery();
                // resultado = Convert.ToInt32(connect.MyCmd.Parameters["@existe"].Value);
                TransSql.Commit();

                return true;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ActualizarUsuario", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();
                return false;
            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }
Example #10
0
        public bool AgregarCalibracion(int EquipoID
                                            , string FecProgramada
                                            , string Operador
                                            , string ISO)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_InsertarCalibracion";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@EquipoID", SqlDbType.Int).Value = EquipoID;
            connect.MyCmd.Parameters.Add("@ISO", SqlDbType.VarChar).Value = ISO;
            connect.MyCmd.Parameters.Add("@FecProgramada", SqlDbType.DateTime).Value = DateTime.Parse(FecProgramada);
            connect.MyCmd.Parameters.Add("@Operador", SqlDbType.VarChar).Value = Operador;

            //connect.MyCmd.Parameters.Add("@existe", SqlDbType.Int).Direction = ParameterDirection.Output;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.ExecuteNonQuery();
                //resultado = Convert.ToInt32(connect.MyCmd.Parameters["@existe"].Value);
                TransSql.Commit();

                return true;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "AgregarMantenimiento", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();
                return false;
            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }
        public int storePaymentTwocheckout(ENT_PagosTwocheckout twocheckout, int userId, int plan, ref int process)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "LAPA_SP_GrabarPagoTwoCheckOut";

            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@LicenciaID", SqlDbType.Int).Value = twocheckout.invoiceId;
            connect.MyCmd.Parameters.Add("@Cantidad", SqlDbType.Int).Value = twocheckout.quantity;
            connect.MyCmd.Parameters.Add("@importe", SqlDbType.Decimal).Value = twocheckout.amount;
            connect.MyCmd.Parameters.Add("@NumberOrder", SqlDbType.BigInt).Value = twocheckout.numberOrder;
            connect.MyCmd.Parameters.Add("@CodPaquete", SqlDbType.VarChar, 100).Value = twocheckout.packageCod;
            connect.MyCmd.Parameters.Add("@Descripcion", SqlDbType.VarChar, 100).Value = twocheckout.description;
            connect.MyCmd.Parameters.Add("@usuarioID", SqlDbType.Int).Value = userId;
            connect.MyCmd.Parameters.Add("@paquete", SqlDbType.Int).Value = plan;
            connect.MyCmd.Parameters.Add("@process", SqlDbType.Int).Direction = ParameterDirection.Output;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();

                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.ExecuteNonQuery();

                string p = connect.MyCmd.Parameters["@process"].Value.ToString();
                process = Int32.Parse(p);
                TransSql.Commit();
                return process;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "GuardarPago", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();
                return -1;
            }
            finally
            {
                TransSql.Dispose();
            }
        }
Example #12
0
        public bool ActualizarEquipo(ENT_Equipos oENT_Equipo)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ActualizandoEquipo";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@Nombre", SqlDbType.VarChar).Value = oENT_Equipo.Nombre;
            connect.MyCmd.Parameters.Add("@SerialNumber", SqlDbType.VarChar).Value = oENT_Equipo.SerialNumber;
            connect.MyCmd.Parameters.Add("@Marca", SqlDbType.VarChar).Value = oENT_Equipo.Marca;
            connect.MyCmd.Parameters.Add("@Modelo", SqlDbType.VarChar).Value = oENT_Equipo.Modelo;
            connect.MyCmd.Parameters.Add("@Proveedor", SqlDbType.VarChar).Value = oENT_Equipo.Proveedor;
            connect.MyCmd.Parameters.Add("@Estado", SqlDbType.Int).Value = oENT_Equipo.Estado;
            connect.MyCmd.Parameters.Add("@EquipoID", SqlDbType.Int).Value = oENT_Equipo.EquipoID;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.ExecuteNonQuery();
                //resultado = Convert.ToInt32(connect.MyCmd.Parameters["@existe"].Value);
                TransSql.Commit();

                return true;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ActualizarEquipo", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();
                return false;
            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }
Example #13
0
        public bool ActualizarContacto(string cadenaXML, int ClienteID)
        {
            {
                SqlTransaction TransSql = default(SqlTransaction);
                connect.MyConn = new SqlConnection(connect.strCxn());
                connect.MyCmd.CommandType = CommandType.StoredProcedure;
                connect.MyCmd.CommandText = "SLW_SP_ActualizarContacto";
                connect.MyCmd.Parameters.Clear();
                connect.MyCmd.Parameters.Add("@cadenaXML", SqlDbType.VarChar).Value = cadenaXML;
                connect.MyCmd.Parameters.Add("@ClienteID", SqlDbType.Int).Value = ClienteID;

                try
                {
                    if (connect.MyConn.State == ConnectionState.Closed)
                        connect.MyConn.Open();
                    connect.MyCmd.Connection = connect.MyConn;
                    TransSql = connect.MyConn.BeginTransaction();
                    connect.MyCmd.Transaction = TransSql;
                    connect.MyCmd.ExecuteNonQuery();
                    TransSql.Commit();

                    return true;
                }
                catch (Exception ex)
                {
                    enterror = new ENT_Error(ex.Message, "ActualizarContacto", "Web");
                    enterror.RegisterLog();
                    TransSql.Rollback();
                    return false;
                }
                finally
                {
                    TransSql.Dispose();
                    connect.MyCmd.Dispose();
                    if (connect.MyConn.State == ConnectionState.Open)
                        connect.MyConn.Close();
                    connect.MyConn.Dispose();
                }

            }
        }
Example #14
0
        public bool ActualizarParametro(ENT_Parametro oEnt_Parametro)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ActualizarParametro";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@ParametroID", SqlDbType.Int).Value = oEnt_Parametro.ParametroID;
            connect.MyCmd.Parameters.Add("@NomParametro", SqlDbType.VarChar).Value = oEnt_Parametro.NomParametro;
            connect.MyCmd.Parameters.Add("@Metodologia", SqlDbType.VarChar).Value = oEnt_Parametro.Metodologia;
            connect.MyCmd.Parameters.Add("@Descripcion", SqlDbType.VarChar).Value = oEnt_Parametro.Descripcion;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.ExecuteNonQuery();
                TransSql.Commit();

                return true;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ActualizarParametro", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();
                return false;
            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }
Example #15
0
        public bool EliminarMuestraCabecera(int MuestraID)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_EliminarMuestraCabecera";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@MuestraID", SqlDbType.Int).Value = MuestraID;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;

                connect.MyCmd.ExecuteNonQuery();
                TransSql.Commit();
                return true;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "EliminarMuestraCabecera", "Web");
                enterror.RegisterLog();
                //   mensajeError = ex.Message.ToString();
                return false;
            }
            finally
            {
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }
Example #16
0
 public bool ActualizarLogoEmpresa(ENT_Empresa oEnt_Empresa)
 {
     SqlTransaction TransSql = default(SqlTransaction);
     connect.MyConn = new SqlConnection(connect.strCxn());
     connect.MyCmd.CommandType = CommandType.StoredProcedure;
     connect.MyCmd.CommandText = "SLW_SP_ActualizarLogoEmpresa";
     connect.MyCmd.Parameters.Clear();
     connect.MyCmd.Parameters.Add("@Ruc", SqlDbType.VarChar).Value = oEnt_Empresa.Ruc;
     connect.MyCmd.Parameters.Add("@PathLogo", SqlDbType.VarChar).Value = oEnt_Empresa.PathLogo;
     try
     {
         if (connect.MyConn.State == ConnectionState.Closed)
             connect.MyConn.Open();
         connect.MyCmd.Connection = connect.MyConn;
         TransSql = connect.MyConn.BeginTransaction();
         connect.MyCmd.Transaction = TransSql;
         connect.MyCmd.ExecuteNonQuery();
         TransSql.Commit();
         return true;
     }
     catch (Exception ex)
     {
         enterror = new ENT_Error(ex.Message, "ActualizarLogoEmpresa", "Web");
         enterror.RegisterLog();
         TransSql.Rollback();
         return false;
     }
     finally
     {
         TransSql.Dispose();
         connect.MyCmd.Dispose();
         if (connect.MyConn.State == ConnectionState.Open)
             connect.MyConn.Close();
         connect.MyConn.Dispose();
     }
 }
Example #17
0
        public List<ENT_Muestra> ObtenerMuestrasAttr(int MuestraID)
        {
            List<ENT_Muestra> oLista = new List<ENT_Muestra>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ObtenerMuestrasAttr";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@MuestraID", SqlDbType.VarChar, 10).Value = MuestraID;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();
                // Parametro,prioridad, resultado, fec_i,fech_f, estado, operdador
                while (DrSql.Read())
                {
                    ENT_Muestra oEnt_Muestra = new ENT_Muestra();
                    oEnt_Muestra.MuestraID = MuestraID;
                    oEnt_Muestra.MuestraDetalleID = DrSql.GetInt32(DrSql.GetOrdinal("MuestraDetalleID"));
                    oEnt_Muestra.NomParametro = DrSql.GetString(DrSql.GetOrdinal("NomAtributo"));
                    oEnt_Muestra.Prioridad = DrSql.GetString(DrSql.GetOrdinal("Prioridad"));
                    oEnt_Muestra.ResultadoAux = DrSql.GetString(DrSql.GetOrdinal("Resultado"));
                    oEnt_Muestra.FechaInicio = (DrSql.GetValue(DrSql.GetOrdinal("FechaInicio")).Equals(DBNull.Value) ||
                        DrSql.GetValue(DrSql.GetOrdinal("FechaInicio")).Equals(null)) ? oEnt_Muestra.FechaTerminado = "" :
                        oEnt_Muestra.FechaTerminado = DrSql.GetDateTime(DrSql.GetOrdinal("FechaInicio")).
                        ToString("dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                    oEnt_Muestra.FechaFin = (DrSql.GetValue(DrSql.GetOrdinal("FechaFin")).Equals(DBNull.Value) ||
                        DrSql.GetValue(DrSql.GetOrdinal("FechaFin")).Equals(null)) ? oEnt_Muestra.FechaTerminado = "" :
                        oEnt_Muestra.FechaTerminado = DrSql.GetDateTime(DrSql.GetOrdinal("FechaFin")).
                        ToString("dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                    oEnt_Muestra.NomEstado = DrSql.GetString(DrSql.GetOrdinal("NomEstado"));
                    oEnt_Muestra.Nombre = DrSql.GetString(DrSql.GetOrdinal("NomUsuario"));
                    oEnt_Muestra.UnidadMedida = DrSql.GetString(DrSql.GetOrdinal("UnidadMedida"));

                    oLista.Add(oEnt_Muestra);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerMuestrasAttr", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #18
0
        public ENT_Atributo ListarOpciones(int MuestraDetalleID)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarOpciones";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@MuestraDetalleID", SqlDbType.Int).Value = MuestraDetalleID;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();
                // Parametro,prioridad, resultado, fec_i,fech_f, estado, operdador
                ENT_Atributo oEnt_Atributo = new ENT_Atributo();
                while (DrSql.Read())
                {

                    oEnt_Atributo.Opciones = DrSql.GetString(DrSql.GetOrdinal("Opciones"));

                }

                DrSql.Close();

                TransSql.Commit();
                return oEnt_Atributo;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarOpciones", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #19
0
        public bool ValidarUsuario(ENT_Usuario oEnt_Usuario
                                    , ref int resultado
                                    , ref int perfil
                                    , ref string nombrecompleto
                                    , ref int usuarioid
                                    , ref int PerfilUsuarioID
                                    , ref int habilitado
                                    , ref bool servicio
                                    , ref string ruc
                                    , ref int paquete
                                    , ref int downgrade
                                    , ref int restriccionip
                                    , ref string ip
                                    , ref string idioma
            
            )
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ValidarUsuario";
            connect.MyCmd.Parameters.Clear();
            //connect.MyCmd.Parameters.Add("@Ruc", SqlDbType.VarChar).Value = oEnt_Usuario.Ruc;
            connect.MyCmd.Parameters.Add("@Correo", SqlDbType.VarChar).Value = oEnt_Usuario.Correo;
            connect.MyCmd.Parameters.Add("@Clave", SqlDbType.VarChar).Value = oEnt_Usuario.Clave;
            connect.MyCmd.Parameters.Add("@resultado", SqlDbType.Int).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@perfil", SqlDbType.Int).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@nombrecompleto", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@usuarioid", SqlDbType.Int).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@PerfilUsuarioID", SqlDbType.Int).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@Habilitado", SqlDbType.Int).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@Servicio", SqlDbType.Bit).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@Rucc", SqlDbType.VarChar,50).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@paquete", SqlDbType.Int).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@downgrade", SqlDbType.Int).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@restriccionip", SqlDbType.Int).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@ip", SqlDbType.VarChar, 20).Direction = ParameterDirection.Output;
            connect.MyCmd.Parameters.Add("@idioma", SqlDbType.VarChar, 20).Direction = ParameterDirection.Output;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.ExecuteNonQuery();
                resultado = Convert.ToInt32(connect.MyCmd.Parameters["@resultado"].Value);
                //perfil = (connect.MyCmd.Parameters["@perfil"].SqlValue SqlDbType.Equals(DBNull.Value)) ? 5000 : Convert.ToInt32(connect.MyCmd.Parameters["@perfil"].Value);
                perfil = (connect.MyCmd.Parameters["@perfil"].Value.Equals(DBNull.Value)) ? 5000 : Convert.ToInt32(connect.MyCmd.Parameters["@perfil"].Value);
                nombrecompleto = (connect.MyCmd.Parameters["@nombrecompleto"].Value.Equals(DBNull.Value)) ? "" : Convert.ToString(connect.MyCmd.Parameters["@nombrecompleto"].Value);
                usuarioid = (connect.MyCmd.Parameters["@usuarioid"].Value.Equals(DBNull.Value)) ? 0 : Convert.ToInt32(connect.MyCmd.Parameters["@usuarioid"].Value);
                PerfilUsuarioID = (connect.MyCmd.Parameters["@PerfilUsuarioID"].Value.Equals(DBNull.Value)) ? 0 : Convert.ToInt32(connect.MyCmd.Parameters["@PerfilUsuarioID"].Value);
                habilitado = (connect.MyCmd.Parameters["@Habilitado"].Value.Equals(DBNull.Value)) ? 0 : Convert.ToInt32(connect.MyCmd.Parameters["@Habilitado"].Value);
                servicio = (connect.MyCmd.Parameters["@Servicio"].Value.Equals(DBNull.Value)) ? false : Convert.ToBoolean(connect.MyCmd.Parameters["@Servicio"].Value);
                ruc = (connect.MyCmd.Parameters["@Rucc"].Value.Equals(DBNull.Value)) ? "" : Convert.ToString(connect.MyCmd.Parameters["@Rucc"].Value);
                paquete = (connect.MyCmd.Parameters["@paquete"].Value.Equals(DBNull.Value)) ? 50000 : Convert.ToInt32(connect.MyCmd.Parameters["@paquete"].Value);
                downgrade = (connect.MyCmd.Parameters["@downgrade"].Value.Equals(DBNull.Value)) ? 50000 : Convert.ToInt32(connect.MyCmd.Parameters["@downgrade"].Value);
                restriccionip = (connect.MyCmd.Parameters["@restriccionip"].Value.Equals(DBNull.Value)) ? 50000 : Convert.ToInt32(connect.MyCmd.Parameters["@restriccionip"].Value);
                ip = (connect.MyCmd.Parameters["@ip"].Value.Equals(DBNull.Value)) ? "" : Convert.ToString(connect.MyCmd.Parameters["@ip"].Value);
                idioma = (connect.MyCmd.Parameters["@idioma"].Value.Equals(DBNull.Value)) ? "" : Convert.ToString(connect.MyCmd.Parameters["@idioma"].Value);
                TransSql.Commit();

                return true;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ValidarUsuario", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();
                return false;
            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }
Example #20
0
        public List<ENT_Muestra> ListarMuestras(string ProdLabCod)
        {
            List<ENT_Muestra> oLista = new List<ENT_Muestra>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarMuestras";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@ProdLabCod", SqlDbType.VarChar, 10).Value = ProdLabCod;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    var val = DrSql.GetValue(DrSql.GetOrdinal("FechaTerminado"));
                    var val2 = "";
                    ENT_Muestra oEnt_Muestra = new ENT_Muestra();
                    oEnt_Muestra.MuestraID = DrSql.GetInt32(DrSql.GetOrdinal("MuestraID"));
                    oEnt_Muestra.CodigoMuestra = DrSql.GetString(DrSql.GetOrdinal("CodigoMuestra"));
                    oEnt_Muestra.FechaRegistro = DrSql.GetDateTime(DrSql.GetOrdinal("FechaRegistro"));
                    oEnt_Muestra.NomEstado = DrSql.GetString(DrSql.GetOrdinal("EstadoMuestra"));
                    oEnt_Muestra.CreadoPor = DrSql.GetString(DrSql.GetOrdinal("CreadoPor"));
                    oEnt_Muestra.FechaTerminado = (DrSql.GetValue(DrSql.GetOrdinal("FechaTerminado")).Equals(DBNull.Value) ||
                        DrSql.GetValue(DrSql.GetOrdinal("FechaTerminado")).Equals(null)) ? oEnt_Muestra.FechaTerminado = "" :
                        oEnt_Muestra.FechaTerminado = DrSql.GetDateTime(DrSql.GetOrdinal("FechaTerminado")).
                        ToString("dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                    oLista.Add(oEnt_Muestra);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerMuestras", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #21
0
        public List<ENT_Usuario> ListarUsuario(int UsuarioID, int PerfilUsuario)
        {
            List<ENT_Usuario> oLista = new List<ENT_Usuario>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarUsuario";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@UsuarioID", SqlDbType.Int).Value = UsuarioID;
            connect.MyCmd.Parameters.Add("@PerfilUsuario", SqlDbType.Int).Value = PerfilUsuario;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                        ENT_Usuario oEnt_Usuario = new ENT_Usuario();
                    oEnt_Usuario.UsuarioID= DrSql.GetInt32(DrSql.GetOrdinal("UsuarioID"));
                    oEnt_Usuario.Nombre = DrSql.GetString(DrSql.GetOrdinal("Nombre"));
                    oEnt_Usuario.PerfilUsuario = DrSql.GetString(DrSql.GetOrdinal("PerfilUsuario"));
                    oEnt_Usuario.PerfilUsuarioID = DrSql.GetInt32(DrSql.GetOrdinal("PerfilUsuarioID"));
                    oEnt_Usuario.Laboratorio = DrSql.GetString(DrSql.GetOrdinal("Laboratorio"));
                    oEnt_Usuario.Correo = DrSql.GetString(DrSql.GetOrdinal("Correo"));

                    if (DrSql.GetInt32(DrSql.GetOrdinal("EstadoID")) == 2)
                    {
                        oEnt_Usuario.NomEstado = "Deshabilitado";
                    }
                    else if (DrSql.GetInt32(DrSql.GetOrdinal("EstadoID")) == 1)
                    {
                        oEnt_Usuario.NomEstado = "Habilitado";
                    }

                    if (DrSql.GetInt32(DrSql.GetOrdinal("RestriccionIP")) == 0)
                    {
                        oEnt_Usuario.NomRestriccion = "No";
                    }
                    else if (DrSql.GetInt32(DrSql.GetOrdinal("RestriccionIP")) == 1)
                    {
                        oEnt_Usuario.NomRestriccion = "Si";
                    }

                    oLista.Add(oEnt_Usuario);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarUsuario", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #22
0
        public List<ENT_Calibracion> ListarCalibracionesXEquipo(int EquipoID)
        {
            List<ENT_Calibracion> oLista = new List<ENT_Calibracion>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarCalibracionesXEquipo"; //no existe sp
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@EquipoID", SqlDbType.VarChar).Value = EquipoID;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_Calibracion oEnt_Calibracion = new ENT_Calibracion();
                    //oEnt_Calibracion.EquipoID = DrSql.GetInt32(DrSql.GetOrdinal("EquipoID"));
                    //oEnt_Calibracion.NombreEquipo = DrSql.GetString(DrSql.GetOrdinal("NombreEquipo"));
                    //oEnt_Calibracion.EstadoID = DrSql.GetInt32(DrSql.GetOrdinal("EstadoID"));
                    //oEnt_Calibracion.NomEstado = DrSql.GetString(DrSql.GetOrdinal("NomEstado"));
                    //oEnt_Calibracion.FechaProgramacionAux = DrSql.GetString(DrSql.GetOrdinal("FechaProgramacion"));
                    //oEnt_Calibracion.FechaRealizadoAux = DrSql.GetString(DrSql.GetOrdinal("FechaRealizado"));
                    //oEnt_Calibracion.Operador = DrSql.GetString(DrSql.GetOrdinal("Operador"));
                    //oEnt_Calibracion.Observacion = DrSql.GetString(DrSql.GetOrdinal("Observacion"));
                    oLista.Add(oEnt_Calibracion);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarCalibracionesXEquipo", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #23
0
        public List<ENT_Mantenimiento> ListarMantenimientos(int Tipo,string LaboratorioCod)
        {
            List<ENT_Mantenimiento> oLista = new List<ENT_Mantenimiento>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarMantenimientos";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@LaboratorioCod", SqlDbType.VarChar).Value = LaboratorioCod;
            connect.MyCmd.Parameters.Add("@Tipo", SqlDbType.Int).Value = Tipo;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_Mantenimiento oEnt_Mantenimiento = new ENT_Mantenimiento();

                    oEnt_Mantenimiento.MantenimientoID = DrSql.GetInt32(DrSql.GetOrdinal("MantenimientoID"));
                    oEnt_Mantenimiento.EquipoID = DrSql.GetInt32(DrSql.GetOrdinal("EquipoID"));
                    oEnt_Mantenimiento.NombreEquipo = DrSql.GetString(DrSql.GetOrdinal("NombreEquipo"));
                    oEnt_Mantenimiento.EstadoID = DrSql.GetInt32(DrSql.GetOrdinal("EstadoID"));
                    oEnt_Mantenimiento.NomEstado = DrSql.GetString(DrSql.GetOrdinal("NomEstado"));
                    oEnt_Mantenimiento.FechaProgramacionAux = DrSql.GetString(DrSql.GetOrdinal("FechaProgramacion"));
                    oEnt_Mantenimiento.FechaRealizadoAux = DrSql.GetString(DrSql.GetOrdinal("FechaRealizado"));
                    oEnt_Mantenimiento.Operador = DrSql.GetString(DrSql.GetOrdinal("Operador"));
                    oEnt_Mantenimiento.Observacion = DrSql.GetString(DrSql.GetOrdinal("Observacion"));
                    oLista.Add(oEnt_Mantenimiento);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListaMantenimientos", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #24
0
        public List<ENT_Cliente> ListarDatosCliente(int ClienteID)
        {
            List<ENT_Cliente> oLista = new List<ENT_Cliente>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarDatosCliente";
            connect.MyCmd.Parameters.Clear();

            connect.MyCmd.Parameters.Add("@ClienteID", SqlDbType.Int).Value = ClienteID;

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();

                while (DrSql.Read())
                {
                    ENT_Cliente oEnt_Cliente = new ENT_Cliente();
                    oEnt_Cliente.NombreCliente = DrSql.GetString(DrSql.GetOrdinal("NombreCliente"));
                    oEnt_Cliente.Ruc = DrSql.GetString(DrSql.GetOrdinal("Ruc"));
                    oEnt_Cliente.RazonSocial = DrSql.GetString(DrSql.GetOrdinal("RazonSocial"));
                    oEnt_Cliente.Pais = DrSql.GetString(DrSql.GetOrdinal("Pais"));
                    oEnt_Cliente.Ciudad = DrSql.GetString(DrSql.GetOrdinal("Ciudad"));
                    oEnt_Cliente.Direccion = DrSql.GetString(DrSql.GetOrdinal("Direccion"));
                    oEnt_Cliente.Contacto = DrSql.GetString(DrSql.GetOrdinal("Contacto"));

                    oLista.Add(oEnt_Cliente);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ListarDatosCliente", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #25
0
        public bool InsertarLab(string lab, string ubicacion, string ruc, int usuarioID)
        {
            {
                SqlTransaction TransSql = default(SqlTransaction);
                connect.MyConn = new SqlConnection(connect.strCxn());
                connect.MyCmd.CommandType = CommandType.StoredProcedure;
                connect.MyCmd.CommandText = "SLW_SP_InsertarLab";
                connect.MyCmd.Parameters.Clear();
                connect.MyCmd.Parameters.Add("@NomLaboratorio", SqlDbType.VarChar).Value = lab;
                connect.MyCmd.Parameters.Add("@Ubicacion", SqlDbType.VarChar).Value = ubicacion;
                connect.MyCmd.Parameters.Add("@Ruc", SqlDbType.VarChar).Value = ruc;
                connect.MyCmd.Parameters.Add("@UsuarioID", SqlDbType.Int).Value = usuarioID;

                try
                {
                    if (connect.MyConn.State == ConnectionState.Closed)
                        connect.MyConn.Open();
                    connect.MyCmd.Connection = connect.MyConn;
                    TransSql = connect.MyConn.BeginTransaction();
                    connect.MyCmd.Transaction = TransSql;
                    connect.MyCmd.ExecuteNonQuery();
                    TransSql.Commit();

                    return true;
                }
                catch (Exception ex)
                {
                    enterror = new ENT_Error(ex.Message, "InsertarLab", "Web");
                    enterror.RegisterLog();
                    TransSql.Rollback();
                    return false;
                }
                finally
                {
                    TransSql.Dispose();
                    connect.MyCmd.Dispose();
                    if (connect.MyConn.State == ConnectionState.Open)
                        connect.MyConn.Close();
                    connect.MyConn.Dispose();
                }

            }
        }
Example #26
0
        public bool InsertarNuevaEmpresa(ENT_Empresa oEnt_Empresa, ENT_Usuario oEnt_Usuario, ref int resultado)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_InsertarNuevaEmpresa";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@Ruc", SqlDbType.VarChar).Value = oEnt_Empresa.Ruc;
            connect.MyCmd.Parameters.Add("@RazonSocial", SqlDbType.VarChar).Value = oEnt_Empresa.RazonSocial;
            connect.MyCmd.Parameters.Add("@PaisID", SqlDbType.VarChar).Value = oEnt_Empresa.PaisID;
            connect.MyCmd.Parameters.Add("@CiudadID", SqlDbType.VarChar).Value = oEnt_Empresa.CiudadID;
            connect.MyCmd.Parameters.Add("@Direccion", SqlDbType.VarChar).Value = oEnt_Empresa.Direccion;
            connect.MyCmd.Parameters.Add("@RubroID", SqlDbType.VarChar).Value = oEnt_Empresa.RubroID;
            connect.MyCmd.Parameters.Add("@Segmento", SqlDbType.VarChar).Value = oEnt_Empresa.segmento;
            connect.MyCmd.Parameters.Add("@Dominio", SqlDbType.VarChar).Value = oEnt_Empresa.Dominio;
            connect.MyCmd.Parameters.Add("@Servicio", SqlDbType.Bit).Value = oEnt_Usuario.Servicio;
            connect.MyCmd.Parameters.Add("@Correo", SqlDbType.VarChar).Value = oEnt_Empresa.Correo;
            connect.MyCmd.Parameters.Add("@nomLab", SqlDbType.VarChar).Value = oEnt_Empresa.nomLab;
            connect.MyCmd.Parameters.Add("@ubicacion", SqlDbType.VarChar).Value = oEnt_Empresa.ubicacion;
            connect.MyCmd.Parameters.Add("@idioma", SqlDbType.VarChar).Value = oEnt_Empresa.Idioma;

            connect.MyCmd.Parameters.Add("@Nombre", SqlDbType.VarChar).Value = oEnt_Usuario.Nombre;
            connect.MyCmd.Parameters.Add("@CorreoE", SqlDbType.VarChar).Value = oEnt_Usuario.Correo;
            connect.MyCmd.Parameters.Add("@Clave", SqlDbType.VarChar).Value = oEnt_Usuario.Clave;

            connect.MyCmd.Parameters.Add("@existe", SqlDbType.Int).Direction = ParameterDirection.Output;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.ExecuteNonQuery();
                resultado = Convert.ToInt32(connect.MyCmd.Parameters["@existe"].Value);
                TransSql.Commit();

                return true;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "InsertarRegistroTemporal", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();
                return false;
            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }
Example #27
0
        public ENT_Laboratorio ObtenerLab(string ProdLabCod)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ObtenerLab";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@ProdLabCod", SqlDbType.VarChar).Value = ProdLabCod;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();
                ENT_Laboratorio oEnt_Laboratorio = new ENT_Laboratorio();
                while (DrSql.Read())
                {
                    oEnt_Laboratorio.NomLaboratorio = DrSql.GetString(DrSql.GetOrdinal("NomLaboratorio"));
                }

                DrSql.Close();

                TransSql.Commit();
                return oEnt_Laboratorio;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerLab", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #28
0
        public string ObtenerSupervisor(int labID)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ObtenerSupervisor";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@LaboratorioID", SqlDbType.Int).Value = labID;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();
                string nomSupervisor = string.Empty;
                while (DrSql.Read())
                {
                    nomSupervisor = DrSql.GetString(DrSql.GetOrdinal("Nombre"));
                }

                DrSql.Close();

                TransSql.Commit();
                return nomSupervisor;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerSupervisor", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;

            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();

            }
        }
Example #29
0
        public ENT_Equipos ObtenerDetalle(int EquipoID)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ObtenerDetalle";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@EquipoID", SqlDbType.Int).Value = EquipoID;
            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;
                connect.MyCmd.Connection = connect.MyConn;
                SqlDataReader DrSql = default(SqlDataReader);
                DrSql = connect.MyCmd.ExecuteReader();
                ENT_Equipos oEnt_Equipos = new ENT_Equipos();

                while (DrSql.Read())
                {
                    oEnt_Equipos.Nombre = DrSql.GetString(DrSql.GetOrdinal("Nombre"));
                    oEnt_Equipos.SerialNumber = DrSql.GetString(DrSql.GetOrdinal("SerialNumber"));
                    oEnt_Equipos.Marca = DrSql.GetString(DrSql.GetOrdinal("Marca"));
                    oEnt_Equipos.Modelo = DrSql.GetString(DrSql.GetOrdinal("Modelo"));
                    oEnt_Equipos.Estado = DrSql.GetInt32(DrSql.GetOrdinal("Estado"));
                    oEnt_Equipos.Proveedor = DrSql.GetString(DrSql.GetOrdinal("Proveedor"));
                }

                DrSql.Close();

                TransSql.Commit();
                return oEnt_Equipos;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerDetalle_Equipos", "Web");
                enterror.RegisterLog();
                TransSql.Rollback();

                return null;
            }
            finally
            {
                TransSql.Dispose();
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }
Example #30
0
        public bool InsertarMuestra(int UsuarioID, string CodigoMuestra, string ProdLabCod, List<ENT_Muestra> oLista_Muestra, List<ENT_Muestra> oLista_MuestraAttr)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_InsertarMuestra";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@UsuarioID", SqlDbType.Int).Value = UsuarioID;
            connect.MyCmd.Parameters.Add("@CodigoMuestra", SqlDbType.VarChar, 200).Value = CodigoMuestra;
            connect.MyCmd.Parameters.Add("@ProdLabCod", SqlDbType.VarChar, 10).Value = ProdLabCod;

            MemoryStream objMS = new MemoryStream();
            using (XmlWriter XmlWriter = XmlWriter.Create(objMS))
            {
                XmlWriter.WriteStartElement("r");
                XmlWriter.WriteStartElement("dc");
                if (oLista_Muestra != null)
                {
                    foreach (ENT_Muestra ENT_TxD in oLista_Muestra)
                    {
                        XmlWriter.WriteStartElement("d");
                        XmlWriter.WriteAttributeString("pp", ENT_TxD.NomParametro.ToString());
                        XmlWriter.WriteAttributeString("pr", ENT_TxD.Prioridad.ToString());
                        XmlWriter.WriteEndElement();
                    }
                    XmlWriter.WriteEndElement();
                    XmlWriter.WriteEndElement();
                    XmlWriter.Close();
                    objMS.Position = 0;
                }
            }

            connect.MyCmd.Parameters.Add("@doc", SqlDbType.Xml).Value = new SqlXml(objMS);

            MemoryStream objMSAttr = new MemoryStream();
            using (XmlWriter XmlWriter = XmlWriter.Create(objMSAttr))
            {
                XmlWriter.WriteStartElement("r");
                XmlWriter.WriteStartElement("dc");
                if (oLista_Muestra != null)
                {
                    foreach (ENT_Muestra ENT_TxD in oLista_MuestraAttr)
                    {
                        XmlWriter.WriteStartElement("d");
                        XmlWriter.WriteAttributeString("pp", ENT_TxD.NomParametro.ToString());
                        XmlWriter.WriteAttributeString("pr", ENT_TxD.Prioridad.ToString());
                        XmlWriter.WriteEndElement();
                    }
                    XmlWriter.WriteEndElement();
                    XmlWriter.WriteEndElement();
                    XmlWriter.Close();
                    objMS.Position = 0;
                }
            }

            connect.MyCmd.Parameters.Add("@docAttr", SqlDbType.Xml).Value = new SqlXml(objMSAttr);

            try
            {
                if (connect.MyConn.State == ConnectionState.Closed)
                    connect.MyConn.Open();
                connect.MyCmd.Connection = connect.MyConn;
                TransSql = connect.MyConn.BeginTransaction();
                connect.MyCmd.Transaction = TransSql;

                connect.MyCmd.ExecuteNonQuery();
                TransSql.Commit();
                return true;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "InsertarMuestra", "Web");
                enterror.RegisterLog();
                //   mensajeError = ex.Message.ToString();
                return false;
            }
            finally
            {
                connect.MyCmd.Dispose();
                if (connect.MyConn.State == ConnectionState.Open)
                    connect.MyConn.Close();
                connect.MyConn.Dispose();
            }
        }