Bloquear un registro en el xbrowse

Bloquear un registro en el xbrowse

Postby Adolfredo Martinez » Tue Sep 07, 2021 9:38 pm

Hola Amigo del forum.


Como hago para bloquear un registro en un browse, y enviar un mensaje que ese registro esta ocupado, para que otras terminales no las tomen este el codigo:
Estoy usando FWH MySQL

Code: Select all  Expand view

#include "FiveWin.ch"


static norden1,oRsContribu,ordenarcontri,oCn,oError,oRsContribu_1

function Main()
local cServer     := "localhost"
local cDataBase   := "indfundacion"
local cUser       := "Adolfredo"
local cPassWord   := "19585287amf"
local nPort     := 3307
local nFlags    := 0,oProgFont,oBrwFont,oHeadFont,oFootFont
local oDlg, oBrw,cText := "",oapp,aClrCol


    if oCn == nil .or. oCn:Ping() = .F.
      MsgRun( "Connecting to Server", "CLOUD SERVER", ;
      { || oCn   := maria_Connect(  {cServer, cDataBase, cUser, cPassWord, nPort } ) } )    
    endif
   
    if oCn == nil
      ? "Failed to connect"
     return nil
      else
      cText += "Connection OK" + CRLF
      cText += "Host: " + cServer +CRLF
      cText += "Database: " +cDataBase + CRLF
      cText += "" + CRLF
      cText += ""
      msginfo( cText ,"Conexion Exitosa")
    ENDIF

   oCn:lShowErrors := .t.
   oRsContribu   :=oCn:RowSet( "SELECT * FROM contrib ORDER BY codigo")


    oProgFont  := TFont():New("TAHOMA",,-14,.F.,.F. ,,,,.F. )
    oBrwFont   := TFont():New("TAHOMA",,-12,.F.,.F.,,,,.F.)
    oHeadFont  := TFont():New("TAHOMA",,-14,.F.,.F.,,,,.F.)
    oFootFont  := TFont():New("TAHOMA",,-14,.F.,.F.,,,,.F.)


   DEFINE DIALOG oDlg SIZE 1000,600 PIXEL

   @ 50,10 XBROWSE oBrw   OBJECT oRsContribu SIZE -10,-10 PIXEL OF oDlg ;
       COLUMNS "NIT","RAZON","PROPIETA","DIRECC","INDENTIF","TELEFONO";
       HEADERS "Nit", "Razon Social", "Representante Legal", "Direccion", "Identificacion", "Telefono" CELL LINES AUTOSORT
 

   WITH OBJECT oBrw
      :bRecSeldata   := { || oBrw:KeyNo }
      :nRecSelWidth  := "999,999"
      :bRecSelFooter := { || oBrw:nLen }
        :nColDividerStyle      := LINESTYLE_LIGHTGRAY
        :nRowDividerStyle      := LINESTYLE_LIGHTGRAY
        :lColDividerComplete   := (.F.)
        :nHeaderHeight         := 25
        :nRowHeight            := 22
        :nHeaderLines            := 1
        :nDataLines            := 1
        :nFooterHeight         := 20
        :nFooterLines            := 1
        :lFooter               := (.T.)
        :lHScroll               := (.T.)

        :l2015            := .T.
        :bClrGrad         := { | lInvert | If( ! lInvert,{ { 0.50,16294002,15263976 }, { 0.50,15263976,16294002  } },{ { 0.50,8388608,15263976 },{ 0.50,15263976,8388608 } } ) }
        :bClrStd := { || aClrCol[ oBrw:KeyNo % 2 + 1 ] }
        :bClrSelFocus     := { || { 16777215,16288063 } }
        :bClrHeader       := { || { 0, 16288063 } }
        :bClrFooter       := { || { 0,16288063 } }
        :bClrSel          := { || { 16777215,16288063 } }
        :nRecSelColor := 16776960 //color de la columna activa primera
        :oFont            := oBrwFont
        :hRowPen := CreatePen( PS_SOLID,2,8388608 ) //el grueso de la fila
        :hColPen := CreatePen( PS_SOLID,2,8388608 ) // el grueso de la columna
        :nRowHeight := 20  //ancho de la celda
   
      :CreateFromCode()
   END
   aClrCol := { { 0, 16777215 }, { 0, 16579010 } } //color de la fila selecionado y color de la letra en la final

 BtnBar( oBrw,oDlg,oRsContribu )
 
   
   ACTIVATE DIALOG oDlg CENTERED


return nil


//-------------------------------------------------------------//
static function btnBar( oBrw,oDlg,oRsContribu  )
//-------------------------------------------------------------//
   local oBar1, oBtn

   DEFINE BUTTONBAR oBar1 OF oDlg SIZE 70, 70 2010

   DEFINE BUTTON OF oBar1 ACTION Nuevocontri(oBrw,.T.,oRsContribu );
      FILENAME "c:\PREDSANTANA13.01\bitmap\nuevo.bmp" PROMPT "Nuevo" TOOLTIP "Nuevo"

   DEFINE BUTTON OF oBar1 ACTION Nuevocontri(oBrw,.F.,oRsContribu );
      FILENAME "c:\PREDSANTANA13.01\bitmap\modificar.bmp" PROMPT "Editar" ;
      TOOLTIP "Editar"

   DEFINE BUTTON OF oBar1 ACTION Elimicontri(oBrw) GROUP ;
      FILENAME "c:\PREDSANTANA13.01\bitmap\borrar.bmp" PROMPT "Eliminar" TOOLTIP "Eliminar"

   DEFINE BUTTON OF oBar1  ACTION Buscontrib(oBrw,norden1);
      FILENAME "c:\PREDSANTANA13.01\bitmap\buscar.bmp" PROMPT "Buscar" TOOLTIP "Buscar Un Registro"


  DEFINE BUTTON OF oBar1 ACTION This:ShowPopUp() ;
    MENU ordenarcontri( oBrw ) ;
     MESSAGE "Ordenar la Base de Datos por Codigo, Apellidos o Direccion del Contribuente" ;
     FILENAME "c:\PREDSANTANA13.01\bitmap\index.bmp"  PROMPT "Ordenar Por" TOOLTIP { "Una Base Datos de Catastro", "Ordenar" }


  DEFINE BUTTON OF oBar1 action( oDlg:End()) ;
      FILENAME "c:\PREDSANTANA13.01\bitmap\salir.bmp" PROMPT "Salir" TOOLTIP "Salir de la Ventana"


return oBar1


 
Adolfredo Martinez
 
Posts: 96
Joined: Fri Feb 15, 2019 1:37 pm
Location: Aracataca-Colombia

Re: Bloquear un registro en el xbrowse

Postby nageswaragunupudi » Wed Sep 08, 2021 3:51 pm

Use this method for edit
Code: Select all  Expand view

EditBaseRecord( cFieldList, lNew, bEdit, oBrw, lLock )
 

and use .T. for the last parameter for lLock.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 43 guests