예제 #1
0
        public string ANULAR_ASIGNACION_SALA(D_ASIGNACION_SALA estado)
        {
            sqlconex = new SqlConnection();
            try
            {
                sqlconex.ConnectionString = Conexion.Conexion_bd;
                sqlconex.Open();
                sqlcmd            = new SqlCommand();
                sqlcmd.Connection = sqlconex;

                sqlcmd.CommandText = "[ASIGNACION_SALA_ANULAR]";
                sqlcmd.CommandType = CommandType.StoredProcedure;

                sqlcmd.Parameters.AddWithValue("@Codigo", estado._Codigo);
                sqlcmd.Parameters.AddWithValue("@Estado", estado._Estado);

                result = sqlcmd.ExecuteNonQuery() >= 1 ? "OK" : "No se cambio el estado";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            finally
            {
                if (sqlconex.State == ConnectionState.Open)
                {
                    sqlconex.Close();
                }
            }
            return(result);
        }
예제 #2
0
        public DataTable Consultar_Asignacion_Sala(D_ASIGNACION_SALA ID)
        {
            DataTable Dtresultado = new DataTable();

            sqlconex = new SqlConnection();
            try
            {
                sqlconex.ConnectionString = Conexion.Conexion_bd;
                sqlcmd             = new SqlCommand();
                sqlcmd.Connection  = sqlconex;
                sqlcmd.CommandText = "ASIGNACION_SALA_ID";
                sqlcmd.CommandType = CommandType.StoredProcedure;

                SqlParameter parid = new SqlParameter();
                parid.ParameterName = "@Codigo";
                parid.SqlDbType     = SqlDbType.Int;
                parid.Value         = ID._Codigo;
                sqlcmd.Parameters.Add(parid);

                SqlDataAdapter sqldate = new SqlDataAdapter(sqlcmd);
                sqldate.Fill(Dtresultado);
            }
            catch (Exception)
            {
                Dtresultado = null;
            }
            return(Dtresultado);
        }
예제 #3
0
        /// <summary>
        /// /ASIGNACION DE SALA
        /// </summary>
        /// <param name="lista"></param>
        /// <returns></returns>
        public string REGISTRAR_ASIGNACION_SALA(D_ASIGNACION_SALA lista)
        {
            try
            {
                sqlconex = new SqlConnection();
                sqlcmd   = new SqlCommand();
                sqlconex.ConnectionString = Conexion.Conexion_bd;
                sqlconex.Open();
                sqltrans = sqlconex.BeginTransaction();

                sqlcmd.Connection  = sqlconex;
                sqlcmd.Transaction = sqltrans;
                sqlcmd.CommandText = "ASIGNACION_SALA_REGISTRAR";
                sqlcmd.CommandType = CommandType.StoredProcedure;

                sqlcmd.Parameters.AddWithValue("@Fecha", lista._Fecha);
                sqlcmd.Parameters.AddWithValue("@Codigo_Sala", lista._CodigoSala);
                sqlcmd.Parameters.AddWithValue("@CodigoInternacion", lista._CodigoInternacion);
                sqlcmd.Parameters.AddWithValue("@Estado", lista._Estado);

                result = sqlcmd.ExecuteNonQuery() >= 1 ? "OK" : "No se puede registrar";
                if (result.Equals("OK"))
                {
                    sqltrans.Commit();
                }
                else
                {
                    sqltrans.Rollback();
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
            finally
            {
                if (sqlconex.State == ConnectionState.Open)
                {
                    sqlconex.Close();
                }
            }
            return(result);
        }