Exemple #1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            ENT_Parametro oEnt_Parametro = new ENT_Parametro();

            oEnt_Parametro.NomParametro= txtNombreParametro.Text.Trim();
            oEnt_Parametro.Metodologia= txtMetodologia.Text.Trim();
            oEnt_Parametro.Descripcion = txtDescripcion.Text.Trim();
            oEnt_Parametro.UsuarioID =Int32.Parse(Session["UsuarioID"].ToString());

            if (txtParametroID.Text.Length == 0)
            {
                oLN_Parametro.InsertarParametro(oEnt_Parametro);
             //   Response.Write("<script>alert('Producto creado correctamente');</script>");
            }
            else
            {
                oEnt_Parametro.ParametroID = Int32.Parse(txtParametroID.Text.Trim());
                oLN_Parametro.ActualizarParametro(oEnt_Parametro);
             //   Response.Write("<script>alert('Parametro actualizado correctamente');</script>");
            }

            oList_Parametro = oLN_Parametro.ListarParametro(Int32.Parse(Session["UsuarioID"].ToString()));
            gvParametros.DataSource = oList_Parametro;
            gvParametros.DataBind();
        }
Exemple #2
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();
            }
        }
        public void Select_Change(Object sender, EventArgs e)
        {
            string Nivel = tvEstructura.SelectedNode.Value;
            try
            {

                Nivel = Nivel.Substring(0, 3);
            }
            catch {
                Nivel = "CLI";
            }

                //   lblNombreCompleto.Text = Nivel;

            switch (Nivel) {
                case "EMP": Session["EmpresaCod"] = tvEstructura.SelectedNode.Value;
                    Response.Redirect("~/iSupervisor/Inicio.aspx");
                    break;
                case "LAB": Session["LaboratorioCod"] = tvEstructura.SelectedNode.Value;
                            Session["NomLaboratorio"] = tvEstructura.SelectedNode.Text;
                            Response.Redirect("~/iSupervisor/AsociarProducto.aspx");
                    break;
                case "PRO": Session["ProdLabCod"] = tvEstructura.SelectedNode.Value;
                                Session["NomProducto"] = tvEstructura.SelectedNode.Text;
                            ENT_Laboratorio oEnt = new ENT_Laboratorio();
                            oEnt = oLN_Laboratorio.ObtenerLab(tvEstructura.SelectedNode.Value);
                            Session["NomLaboratorio"] = oEnt.NomLaboratorio.ToString();
                            Response.Redirect("~/iAdministradors/Historial.aspx");
                    break;
                case "PAR": Session["ProdParaCod"] = tvEstructura.SelectedNode.Value;
                            Session["NomParametro"] = tvEstructura.SelectedNode.Text;
                            ENT_Parametro oEntidad = new ENT_Parametro();
                            oEntidad = oLN_Parametro.ObtenerLab(tvEstructura.SelectedNode.Value);

                            Session["NomLaboratorio"] = oEntidad.NomLaboratorio.ToString();
                            Session["NomProducto"] = oEntidad.NomProducto.ToString();

                            Response.Redirect("~/iAdministradors/EditarParametro.aspx");
                    break;

                case "CLI": Session["ClienteID"] = tvEstructura.SelectedNode.Value;
                            Session["NomCliente"] = tvEstructura.SelectedNode.Text;
                            //ENT_Cliente oEnt_Cli = new ENT_Cliente();

                            //oEntidad = oLN_Parametro.ObtenerLab(tvEstructura.SelectedNode.Value);

                            //Session["NomLaboratorio"] = oEntidad.NomLaboratorio.ToString();
                            //Session["NomProducto"] = oEntidad.NomProducto.ToString();

                            //Response.Redirect("~/iAdministrador/Cliente.aspx");
                            break;

            }
               // Session["LaboratorioCod"] = tvEstructura.SelectedNode.Value;
        }
Exemple #4
0
 public bool InsertarParametro(ENT_Parametro oEnt_Parametro)
 {
     return dataTx.InsertarParametro(oEnt_Parametro);
 }
Exemple #5
0
 public bool ActualizarParametro(ENT_Parametro oEnt_Parametro)
 {
     return dataTx.ActualizarParametro(oEnt_Parametro);
 }
Exemple #6
0
        public ENT_Parametro ObtenerLab(string ProdParaCod)
        {
            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ObtenerHerenciaParametro";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@ProdParaCod", SqlDbType.VarChar).Value = ProdParaCod;
            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_Parametro oEnt_Laboratorio = new ENT_Parametro();
                while (DrSql.Read())
                {
                    oEnt_Laboratorio.NomProducto = DrSql.GetString(DrSql.GetOrdinal("NomProducto"));
                    oEnt_Laboratorio.NomLaboratorio = DrSql.GetString(DrSql.GetOrdinal("NomLaboratorio"));
                }

                DrSql.Close();

                TransSql.Commit();
                return oEnt_Laboratorio;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerHerenciaParametro", "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();

            }
        }
Exemple #7
0
        public List<ENT_Parametro> ObtenerDatosMuestraParametro(string ProdParaCod)
        {
            List<ENT_Parametro> oLista = new List<ENT_Parametro>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ObtenerDatosMuestraParametro";
            connect.MyCmd.Parameters.Clear();
            connect.MyCmd.Parameters.Add("@ProdParaCod", SqlDbType.VarChar).Value = ProdParaCod;
            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_Parametro oEnt_Parametro = new ENT_Parametro();
                    oEnt_Parametro.CodigoMuestra = DrSql.GetString(DrSql.GetOrdinal("CodigoMuestra"));
                    string resultadoStr = DrSql.GetString(DrSql.GetOrdinal("Resultado"));
                    var separator = new NumberFormatInfo();
                    separator.NumberDecimalSeparator = ".";
                    oEnt_Parametro.Resultado = decimal.Parse(resultadoStr, separator);
                    oEnt_Parametro.MaxAdvertencia = DrSql.GetDecimal(DrSql.GetOrdinal("MaxAdvertencia"));
                    oEnt_Parametro.MaxAccion = DrSql.GetDecimal(DrSql.GetOrdinal("MaxAccion"));
                    oEnt_Parametro.Promedio = DrSql.GetDecimal(DrSql.GetOrdinal("Promedio"));
                    oEnt_Parametro.MinAdvertencia = DrSql.GetDecimal(DrSql.GetOrdinal("MinAdvertencia"));
                    oEnt_Parametro.MinAccion = DrSql.GetDecimal(DrSql.GetOrdinal("MinAccion"));
                    //      oEnt_Parametro.Valor = 20;
                    oLista.Add(oEnt_Parametro);
                }

                DrSql.Close();

                TransSql.Commit();
                return oLista;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerDatosParametro", "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();

            }
        }
Exemple #8
0
        public List<ENT_Parametro> ListarParametroXEquipo(int EquipoID)
        {
            List<ENT_Parametro> oListaa = new List<ENT_Parametro>();

            SqlTransaction TransSql = default(SqlTransaction);
            connect.MyConn = new SqlConnection(connect.strCxn());
            connect.MyCmd.CommandType = CommandType.StoredProcedure;
            connect.MyCmd.CommandText = "SLW_SP_ListarParametroXEquipo";
            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();
                int posNomParametro = DrSql.GetOrdinal("NomParametro");
                int posNomParEqpID = DrSql.GetOrdinal("ParEqpID");

                while (DrSql.Read())
                {
                    ENT_Parametro oEnt_Parametro = new ENT_Parametro();
                    oEnt_Parametro.NomParametro = DrSql.GetString(posNomParametro);
                    oEnt_Parametro.ParEqpID = DrSql.GetInt32(posNomParEqpID);

                    oListaa.Add(oEnt_Parametro);
                }

                DrSql.Close();

                TransSql.Commit();
                return oListaa;
            }
            catch (Exception ex)
            {
                enterror = new ENT_Error(ex.Message, "ObtenerDatosParametro", "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();

            }
        }