FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Codejock Calendar Samples?
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Codejock Calendar Samples?
Posted: Sun Jan 16, 2011 04:58 PM
Hi.

I've been asked by a few people for a short .prg that shows how to use codejock extreme calendar with dbfcdx.

Below is a single short .prg that syncs "events" on the calendar to a dbf/fpt/cdx. I'm trying to keep the sample short. Keep in mind that each event on the calendar may have as many fields as you'd like for things such as "recurring", "reminder", "send email alert", "email address", "medical record", etc... each of these fields would be kept on each event as a custom property. On this short sample I'm implementing only a single custom property "id" to keep the corresponding primary key on file for each event on the calendar.

I hope it helps, but if there are more questions; please feel free to ask, I'm more than willing to help.

Code (fw): Select all Collapse
/*----------------------------------------------------------------------------*/
#include "fivewin.ch"
//---------- theme constants
#define xtpCalendarThemeOffice2000聽 0
#define xtpCalendarThemeOfficeXP聽 聽 聽 聽 1
#define xtpCalendarThemeOffice2003聽 2
#define xtpCalendarThemeOffice2007聽 3

//----------- views
#define xtpCalendarDayView聽 聽 聽 0
#define xtpCalendarWorkWeekView 聽 聽 1
#define xtpCalendarWeekView 聽 聽 2
#define xtpCalendarMonthView 聽 聽3

static cAlias 

*--------------------------------------------------------------------------
function Main()

聽 聽 create_dbf()
聽 聽 
聽 聽 MpCal():New()

聽 聽 (cAlias)->( dbCloseArea() )
聽 聽 
return nil

//---------------------------------------------------//
static function create_dbf()

聽 聽 local astruc := { { "id", "C", 12, 0 },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 { "starttime"聽 聽, "C", 18, 0 },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 { "endtime"聽聽 聽 , "C", 18, 0 },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 { "subject"聽聽 聽 , "C", 50, 0 },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 { "body"聽 聽 聽 聽 聽 聽 , "M", 10, 0 } }
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 
聽 聽 cAlias := "Calendar" 
聽 聽 聽 聽 
聽 聽 if !file( "calendar.dbf")
聽 聽 聽 聽 
聽 聽 聽 聽 dbcreate( cAlias, aStruc, "DBFCDX", .t., cAlias )
聽 聽 
聽 聽 聽 聽 (cAlias)->( OrdCreate( cAlias, "id", "id" ) )
聽 聽 聽 聽 (cAlias)->( OrdCreate( cAlias, "starttime", "starttime" ) )
聽 聽 else
聽 聽 
聽 聽 聽 聽 dbuseArea( .t., "DBFCDX", cAlias, cAlias, .t. )
聽 聽 endif

聽 聽 (cAlias)->( OrdListAdd( cAlias ) )
聽 聽 聽 聽 
Return Nil
聽 聽 

//---------------------------------------------------//

CLASS MpCal

聽 聽DATA dCurrentDate AS DATE INIT Date()
聽 聽
聽 聽DATA oCalex, oCalexCapBar
聽 聽DATA oDtPick
聽 聽DATA oExBar 聽 
聽 聽DATA oPanelExplorer
聽 聽DATA oPanelCalex
聽 聽DATA oWnd
聽 聽
聽 聽METHOD New()

聽 聽METHOD BuildCalex()
聽 聽METHOD BuildDatePicker()
聽 聽METHOD BuildPanels()
聽 聽METHOD SetSize( nType, nWidth, nHeight )
聽 聽
聽 聽 METHOD xTrmCalTriggeredEvents( Event, Parms )聽 聽
聽 聽 METHOD RetrieveDayEvents( aParms )
聽 聽 METHOD InsertEvent( oEvent )
聽 聽 METHOD UpdateEvent( oEvent )
聽 聽 METHOD DeleteEvent( oEvent )

ENDCLASS

//---------------------------------------------------//

METHOD New() CLASS MpCal
聽 聽
聽 聽local oMenu
聽 聽local oSelf := Self
聽 聽
聽 聽MENU oMenu
聽 聽ENDMENU

聽 聽 DEFINE WINDOW ::oWnd MDI MENU oMenu Title "CodeJock Xtrme Calendar FWH Sample"

聽 聽::BuildPanels()聽 聽 聽 聽 聽 //two panels -left and right
聽 聽::BuildCalex()聽 聽聽 聽 聽 聽 聽 聽 //CodeJock calendar on the right
聽 聽::BuildDatePicker()聽 聽 聽 //CodeJock DatePicker on the left

聽 聽ACTIVATE WINDOW ::oWnd MAXIMIZED;
聽 聽 聽 聽 聽 聽 ON RESIZE oSelf:SetSize( nSizeType, nWidth, nHeight )
聽 聽 聽 聽 聽 聽 
RETURN Self

//-----------------------------------------------------------------------------------------------------//
METHOD xTrmCalTriggeredEvents( Event, aParms ) CLASS MpCal

聽 聽 if valType( Event ) == "C"

聽 聽 聽 聽 Do Case

聽 聽 聽 聽 Case Event == "DoRetrieveDayEvents"聽聽 聽 聽 聽 
聽 聽 聽 聽 聽 聽 ::RetrieveDayEvents( aParms )

聽 聽 聽 聽 case Event == "EventAddedEx"
聽 聽 聽 聽 聽 聽 ::InsertEvent( aParms[ 1 ] )

聽 聽 聽 聽 case Event == "EventChangedEx" .and. aParms[ 1 ]:CustomProperties:Property( "id" ) != Nil
聽 聽 聽 聽 聽 聽 ::UpdateEvent( aParms[ 1 ] )

聽 聽 聽 聽 case Event == "EventDeletedEx" .and. aParms[ 1 ]:CustomProperties:Property( "id" ) != Nil
聽 聽 聽 聽 聽 聽 ::DeleteEvent( aParms[ 1 ] )
聽 聽 聽 聽 聽 聽 
/*聽 聽 聽 other useful triggered events that may be catched.
聽 聽 聽 聽 Case Event == "DblClick"
聽 聽 聽 聽 Case Event == "MouseMove"
聽 聽 聽 聽 Case Event == "MouseDown" 
聽 聽 聽 聽 case Event == "KeyDown"
聽 聽 聽 聽 case Event == "IsEditOperationDisabled"
聽 聽 聽 聽 case Event == "IsEditOperationDisabledV"
聽 聽 聽 聽 case Event == "DoUpdateEvent"
聽 聽 聽 聽 case Event == "BeforeEditOperation"
聽 聽 聽 聽 聽 聽 Return ::BeforeEditOperation( aParms[ 1 ] )

聽 聽 聽 聽 otherwise
聽 聽 聽 聽 聽 聽 Logfile( "trace.log", { EventInfo( event, aParms ) } ) */
聽 聽 聽 聽 聽 聽 
聽 聽 聽 聽 End 

聽 聽 endif
聽 聽 
Return nil

//-----------------------------------------------------------------------------------------------------//
METHOD InsertEvent( oEvent ) CLASS MpCal

聽 聽 local cId := GetUniqueId()

聽 聽 (cAlias)->( dbappend() )
聽 聽 (cAlias)->( rLock() )
聽 聽 
聽 聽 (cAlias)->id聽 聽 聽 聽 聽 聽 := cId 
聽 聽 (cAlias)->Subject 聽 := oEvent:Subject()
聽 聽 (cAlias)->StartTime聽:= Left( TtoS( oEvent:StartTime() ), 14 )
聽 聽 (cAlias)->EndTime聽 聽聽 聽 := Left( TtoS( oEvent:EndTime() ), 14 )
聽 聽 (cAlias)->body聽 聽 聽 聽 聽 := oEvent:Body()

聽 聽 (cAlias)->( dbrUnlock() )

聽 聽 //load custom property for the newly created event with a unique id that will 
聽 聽 //match field "id" on calendar.dbf
聽 聽 oEvent:CustomProperties:Property( "id", cId )

聽 聽 //every time a new appointment is added on the calendar control
聽 聽 //you could expand appntmnt details with a custom form where you may pickup 
聽 聽 //other values.
聽 聽 //::EventDetails( oEvent )
聽 聽 聽 聽 
Return oEvent

//-----------------------------------------------------------------------------------------------------//
METHOD UpdateEvent( oEvent ) CLASS MpCal

聽 聽 local cid := oEvent:CustomProperties:Property( "id" )

聽 聽 (cAlias)->( OrdSetFocus( "id" ) )
聽 聽 (cAlias)->( dbseek( cId ) )
聽 聽
聽 聽 if (cAlias)->( found() ) .and. (cAlias)->( rLock() )
聽 聽 
聽 聽 聽 聽 (cAlias)->Subject := oEvent:Subject()
聽 聽 聽 聽 (cAlias)->StartTime := Left( TtoS( oEvent:StartTime() ),14 )
聽 聽 聽 聽 (cAlias)->EndTime := Left( TtoS( oEvent:EndTime() ), 14 )
聽 聽 聽 聽 (cAlias)->body := oEvent:body
聽 聽 聽 聽 
聽 聽 聽 聽 (cAlias)->( dbrUnlock() )
聽 聽 聽 聽 
聽 聽 endif

聽 聽 //if there is more data that's being pickedup as part of the calendar appointment聽 聽
聽 聽 //then call that screen to allow modification of those values also
聽 聽 //::EventDetails( oEvent )

return oEvent

//-----------------------------------------------------------------------------------------------------//
METHOD DeleteEvent( oEvent ) CLASS MpCal
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 
聽 聽 local cid := oEvent:CustomProperties:Property( "id" )

聽 聽 (cAlias)->( OrdSetFocus( "id" ) )
聽 聽 (cAlias)->( dbseek( cId ) )

聽 聽 if (cAlias)->( found() ) .and. (cAlias)->( rLock() )
聽 聽 聽 聽 (cAlias)->( delete() )
聽 聽 endif
聽 聽 
return oEvent

//-----------------------------------------------------------------------------------------------------//
//aParms[ 1 ] contains a datetime value. This function should return all the events found on 
//calendar.dbf for that date. 聽To extract only the date portion, we convert the datetime 
//value to string and then pullout the first 8 chars asin YYYYMMDD.
//keep in mind that the control calls this function each time the control changes dates,
//or changes views or just about any time the control feels it needs to load data from 
//file.  So it gets called a lot!

METHOD RetrieveDayEvents( aParms ) CLASS MpCal

聽 聽 local oEvents := aParms[ 2 ] 
聽 聽 local oEvent
聽 聽 local cDate 聽 聽 := Left( TtoS( aParms[ 1 ] ), 8 )

聽 聽 (cAlias)->( OrdSetFocus( "StartTime" ) )
聽 聽 (cAlias)->( dbSeek( cDate ) )

聽 聽 While !(cAlias)->( eof() ) .and. left( (cAlias)->StartTime, 8 ) == cDate
聽 聽 
聽 聽 聽 聽 oEvent := ::oCalex:DataProvider:CreateEvent()
聽 聽 聽 聽 
聽 聽 聽 聽 With Object oEvent
聽 聽 聽 聽 聽 聽 :Subject := (cAlias)->Subject
聽 聽 聽 聽 聽 聽 :StartTime := StoT( (cAlias)->StartTime )
聽 聽 聽 聽 聽 聽 :EndTime := StoT( (cAlias)->EndTime )
聽 聽 聽 聽 聽 聽 :body := (cAlias)->body

聽 聽 聽 聽 聽 聽 //custom property "id" will hold the contents of field "id" on calendar.dbf
聽 聽 聽 聽 聽 聽 //to help us match each event displayed on the calendar to a unique record 
聽 聽 聽 聽 聽 聽 //on the calendar table. 
聽 聽 聽 聽 聽 聽 :CustomProperties:Property( "id", (cAlias)->id )

聽 聽 聽 聽 End
聽 聽 
聽 聽 聽 聽 oEvents:add( oEvent )
聽 聽 聽 聽 (cAlias)->( dbSkip() )

聽 聽 end
聽 聽 
Retur Nil
聽 聽 聽 聽 聽 聽 聽 聽 
//---------------------------------------------------------------------------------------------------//
METHOD BuildCalex() CLASS MpCal
local oErr
local cIni聽 聽 聽 聽 聽 := "patients.ini"

聽 聽 TRY 聽 聽 
聽 聽 聽 聽 ::oCalex := tActiveX():New( ::oPanelCalex, "Codejock.CalendarControl.13.4.2" )
聽 聽 CATCH oErr
聽 聽 聽 聽 MsgStop( "Missing installation Components", "Aborting" )
聽 聽 聽 聽 Quit
聽 聽 END 
聽 聽 
聽 聽 with object ::oCalex
聽 聽 
聽 聽 聽 聽 :VisualTheme( xtpCalendarThemeOffice2007 )
聽 聽 聽 聽 :bOnEvent = { | event, aParms | ::xTrmCalTriggeredEvents( Event, aParms ) }
聽 聽 聽 聽 
聽 聽 聽 聽 :SetDataProvider( "Provider=custom" )
聽 聽 聽 聽 :DataProvider:open()

聽 聽 聽 聽 :ShowCaptionBar( .t. )
聽 聽 聽 聽 :ShowCaptionBarSwitchViewButtons( .t. )聽//switch from day, week, month view on capbar
聽 聽 
聽 聽 聽 聽 :ViewType( xtpCalendarDayView )

聽 聽 聽 聽 :DayView:TimeScaleMinTime( [8:00:00 AM] )
聽 聽 聽 聽 :DayView:TimeScaleMaxTime( [6:00:00 PM] )
聽 聽 聽 聽 :DayView:TimeScale( 15 )
聽 聽 聽 聽 :DayView:ScrollToWorkDayBegin()聽聽 聽 //scroll the view to the work day starting time

聽 聽 聽 聽 :Options:DayViewTimeScaleShowMinutes( .t. )

聽 聽 end

聽 聽::oPanelCalex:oClient = ::oCalex

Return Nil

//---------------------------------------------------//
METHOD BuildDatePicker() CLASS MpCal
local nTmp
local oPanel, oErr, oWnd

聽 聽 TRY
聽 聽 聽 聽 ::oDtPick := tActiveX():New( ::oPanelExplorer,"Codejock.DatePicker.13.4.2" )
聽 聽 聽 聽 
聽 聽 聽 聽 With Object ::oDtPick
聽 聽 聽 聽 聽 聽 :Enabled( .t. )
聽 聽 聽 聽 聽 聽 :ShowWeekNumbers( .t. )
聽 聽 聽 聽 聽 聽 :VisualTheme( xtpCalendarThemeOffice2007 )
聽 聽 聽 聽 聽 聽 :AttachToCalendar( TOleAuto():New( ActXPdisp( ::oCalex:hActiveX ) ) )
聽 聽 聽 聽 End 
聽 聽 聽 聽 
聽 聽 聽 聽 ::oPanelExplorer:oClient := ::oDtPick

聽 聽 CATCH oErr
聽 聽 
聽 聽 END 
聽 聽 
RETURN nil

//---------------------------------------------------//

METHOD BuildPanels() CLASS MpCal
local oBrush
local nHeight := ::oWnd:nHeight

聽 聽::oPanelCalex 聽 聽= TPanel():New( 0, 175, nHeight, ::oWnd:nWidth, ::oWnd:oWndClient )
聽 聽::oPanelExplorer = TPanel():New( 0, 0, nHeight, ::oPanelCalex:nLeft, ::oWnd:oWndClient )
聽 聽
RETURN nil

//---------------------------------------------------//

METHOD SetSize( nType, nWidth, nHeight ) CLASS MpCal

聽 聽if nWidth != nil 
聽 聽 聽 ::oPanelExplorer:Move( , , , nHeight )
聽 聽 聽 ::oPanelCalex:Move( , , nWidth - ::oPanelExplorer:nRight, nHeight )
聽 聽endif
聽 聽
RETURN nil

*-------------------------------------------------------------------------------------------------------------------------------
procedure RddInit()


聽 聽 Set Century 聽 聽 On
聽 聽 Set Deleted 聽 聽 On
聽 聽 Set SoftSeek 聽 聽On
聽 聽 Set Date Format "MM/DD/YYYY"
聽 聽 set epoch to 1950

聽 聽 rddsetdefault( "ADS" )
聽 聽 REQUEST HB_LANG_EN
聽 聽 REQUEST DBFCDX, DBFFPT
聽 聽 
return

*-------------------------------------------------------------------------------------------------------------------------------
//I would recommend a better unique value to id each event saved to calendar.dbf
//A better choice of unique Id would be ADS's field defaulting to NewIdString( 'M' )
//but this will do for the this short sample
//
static Function GetUniqueId()
local cJulian聽 聽:= StrZero( DoY( date() ), 3 )
Local cId 聽 聽 聽 := Right( StrZero( Year( Date() ), 4 ), 2 ) + cJulian + StrTran( StrZero( Seconds(), 7, 1 ), ".", "" )

Return ( cId )


Regards;


Reinaldo.
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Codejock Calendar Samples?
Posted: Mon Jan 17, 2011 07:56 AM

Reinaldo

Thanks for sharing the code, this is very helpful

Can this control be used in a network environment ?

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Codejock Calendar Samples?
Posted: Mon Jan 17, 2011 02:45 PM

Richard;

In a network environment you'd have to find when a new appointment ("event") has been saved to disk in order update (refresh()) the calendar on alll the other workstations. Many SQLs have configurable services that may broadcast a message to all clients connected. The message could inform that a new appointment has been added/changed or deleted. You'd have to have a loop that processes messages and act accordingly.

ADS has such service so that when something is added/updated/deleted on a table, it broadcasts a message (in ADS nomenclature: "event notification") to all clients connected to the table with information about the event. With out this, you'd have to implement your own messaging system. As you see, it is a little bit tricky -not impossible, but tricky and it has little to do with the calendar control it self.

You could also have a timer to "poll" the table or poll a messages table and force a refresh. But still... I don't see a simpler way of doing it than the centralized notification system on the SQL engine itself -which you find in ADS starting with version 9.

In the absence of ADS, maybe someone has a better idea. I hope this helps.

Reinaldo.

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Codejock Calendar Samples?
Posted: Mon Jan 17, 2011 03:40 PM

Richard;

Another thought; you could periodically call the method :Populate() to force a sync between the data source (dbfs) and the calendar. That should work, but again not as efficient has a notification from the sql engine itself.

Just another idea.

Reinaldo.

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Codejock Calendar Samples?
Posted: Mon Jan 17, 2011 09:19 PM
I highly recommend this control.

Just another screen shot:




Reinaldo.
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: Codejock Calendar Samples?
Posted: Tue Jan 18, 2011 10:18 AM

ON YOUR CLASS
HOW CREATE EXPLORER CONTROL CAN i SEE THE TEST SOURCE ?

FWH .. BC582.. xharbour
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Codejock Calendar Samples?
Posted: Tue Jan 18, 2011 03:08 PM

MdaSolution;

The source is on this same thread, read 4 or 5 messages above. It is a reduced sample, but it does contain the code that creates the explorer control exactly as you see on the images.

Reinaldo.

Posts: 512
Joined: Mon Oct 17, 2005 10:38 AM
Re: Codejock Calendar Samples?
Posted: Wed Jan 19, 2011 02:39 PM

Hi Reinaldo.
2 little questions.
Is this control available in Italian language ?
If you want to distribute an application that is using this control, how can you make the installation
registering the component ?
Thanks a lot.
Massimo.

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Codejock Calendar Samples?
Posted: Wed Jan 19, 2011 03:09 PM

Massimo;

There is very little fixed text on the control. They call it "Labels". All labels have a property where you can set the text that should be displayed and it can change at any time. I'm not sure if labels are predefined in other languages, I think you should email CodeJock sales people with that question.

Regarding the auto-installation of the OCX, CodeJock has a few sample codes that shows how to automate the OCX registration. I haven't looked into that just yet, since I'm confident that it will not be an issue. At this moment I'm trying to learn how to use their other controls such as the Grid and report control which just looks fantastic!

Reinaldo.

Posts: 512
Joined: Mon Oct 17, 2005 10:38 AM
Re: Codejock Calendar Samples?
Posted: Wed Jan 19, 2011 03:13 PM

Thanks Reinaldo for your answer.

Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: Codejock Calendar Samples?
Posted: Wed Jan 19, 2011 04:03 PM
Massimo Linossi wrote:Thanks Reinaldo for your answer.

You can use this code below:
Code (fw): Select all Collapse
oBF:GlobalSettings:ResourceFile:= "SuitePro.ResourceIt.dll"
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Codejock Calendar Samples?
Posted: Thu Jan 20, 2011 10:37 PM
Reinaldo,

Perd贸n por el castellano.. pero me interesaba comentarle una cosa.
脡n general, fuera del tema del Calendar, el tema del envio de mensajes o eventos sobre la modificacion de datos, a mi modo de ver es intesante pero m谩s all谩 de la modificaci贸n de datos.
Eventos ejemplo que pueden ser enviados a otros usuarios:

- Usuario ingresado (programa abierto)
- Usuario dado de baja
- usuario haciendo proceso exclusivo
- Usuario quiere hace proceso exclusivo
- Documento (ejemplo factura) creada: Un documento puede estar compuesto de mas de una tabla y solamente se notificara la creacion del documento una vez finalizado.

- etc...

No se que le parecer谩 todo esto que comento... pienso que se puede programar todo esto con codigo .prg..

Saludos

reinaldocrespo wrote:Richard;

In a network environment you'd have to find when a new appointment ("event") has been saved to disk in order update (refresh()) the calendar on alll the other workstations. Many SQLs have configurable services that may broadcast a message to all clients connected. The message could inform that a new appointment has been added/changed or deleted. You'd have to have a loop that processes messages and act accordingly.

ADS has such service so that when something is added/updated/deleted on a table, it broadcasts a message (in ADS nomenclature: "event notification") to all clients connected to the table with information about the event. With out this, you'd have to implement your own messaging system. As you see, it is a little bit tricky -not impossible, but tricky and it has little to do with the calendar control it self.

You could also have a timer to "poll" the table or poll a messages table and force a refresh. But still... I don't see a simpler way of doing it than the centralized notification system on the SQL engine itself -which you find in ADS starting with version 9.

In the absence of ADS, maybe someone has a better idea. I hope this helps.


Reinaldo.
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Codejock Calendar Samples?
Posted: Thu Jan 20, 2011 11:45 PM

hmpaquito;

Realmente aqui hablo de notifiaciones y se trata de notificaciones que el ADS ya envia sin que tengas que programar nada de .prg. O sea, si quieres saber cuando una factura se crea; solo tienes que decir a ADS que genere una notificaci贸n cuando la tabla de factura recibe un "Insert". Igual puedes pedir a ADS que envie notificaciones cuando algo cambia en una tabla, cuando se borra algo, cuando se a帽ade algo, cuando un usuario se logea, cuando se des-logea... Cuando cualquiera de estas cosas suceda, entonces ADS (el server) envia la notificacion al respecto a todos los clientes (aplicaciones) conectados al server. Nada que programar. Y funciona muy bien.

Por ejemplo yo tengo un server que envia una notificacion cada vez que una habitacion del hospital es ocupada o desocupada y de esta manera las aplicaciones saben que habitaciones ofrecer a una nueva admision o transferencia de habitacion.

Espero se entienda.

Un saludo,

Reinaldo.

Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Codejock Calendar Samples?
Posted: Fri Jan 21, 2011 02:57 PM

Reinaldo,

Solamente planteaba algo ya ya tiempo me ronda la cabeza y que me lo record贸 su comentario: un sistema de eventos o notificaciones que una aplicaci贸n puede enviar a sus aplicaciones "hermanas" de la red. Las notificaciones pueden ser diversas y no solamente por modificaciones en los datos. En cualquier caso, no se como funciona en ADS las notificaciones, pero si por ejemplo

// Incio de documento
SELECT Factura
APPEND BLANK

Otra codigo

SELECT OtroFichero
APPEND BLANK // ADS aqui ??

// fin de documento

Seria en // fin de documento donde se tendria que realizar la notificacion de nuevo documento. ADS lo haria, segun entiendo, mal.

Saludos

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Codejock Calendar Samples?
Posted: Fri Jan 21, 2011 04:06 PM

hmpaquito;

Let's move this thread over to the spanish forum. ...y evitamos incomodar a los que no entienden. In the mean while; please excuse me for answering in English.

I will attempt to explain ADS Notifications:

Notifications provide a mechanism for communicating to a client that something has occurred. For example, notifications can be used to inform a client application that data in a critical table has changed. The client application can then use this information to refresh() an xbrowse (or some other control) of that table and thus provide the user with more up to date information (without having to "poll" the table).

A Notification might be used to signal a client that a record has been added to a special table created for purpose of communicating messages from the system administrator to the end users. The client application can then read the latest message and display it within its interface.

A Notification might be used to signal a client that a record has changed. The client app my make a decision based on what changed on that particular record. Perhaps create an entry on a queue to send some information via email. Then a client app listening for such notifications can take care of sending the email.

These are all typical situations where an ADS Notification might be used. No coding. No .prg. ADS provides an API to create a notification, to listen for notifications, to know if a notification has been issued while the app was not listening. etc...

Specifically ADS API provides "sp_SignalEvent()" to create a Notification based on some condition. That part can be stored on the ADS Data Dictionary as a trigger so that you never have to tell the server again to issue a Notification based on that condition. The server always knows because you saved that as a "trigger" info on the Data Dictionary. Then API function "sp_WaitForEvent()" will inform the client application if an event has occurred.

On a single threaded app, you test for notifications by using a repeated periodic call with short timeouts -i.e. "polling". But not polling the table but rather polling for the event notification. Due to its nature, polling will not actually notify the client app when a change has occurred, but rather notifies the client that a change HAS occurred sometime between now and the last check. But that works just fine.

So, In essence, with ADS notifications you take care of "events" on any table without having to write or "invent the wheel". The wheel is already invented and running smoothly. For more information about ADS notifications; please visit http://devzone.advantagedatabase.com.

Hope that helps,

Reinaldo.