AW: Fun with date calculations in VFP

2018-05-17 Thread Jürgen Wondzinski
Hmmm.. You know that "SaltyDog" is actually Eric's page ?

wOOdy


-Ursprüngliche Nachricht-
Von: ProFox [mailto:profox-boun...@leafe.com] Im Auftrag von Alan Bourke
Gesendet: Donnerstag, 17. Mai 2018 14:12
An: profoxt...@leafe.com
Betreff: Re: Fun with date calculations in VFP

There's a VFP implementation of the C# String.Format() here:
http://saltydogllc.com/string-format-for-visual-foxpro/


-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/001001d3edf0$cc7c52b0$6574f810$@wondzinski.de
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


Re: Fun with date calculations in VFP

2018-05-17 Thread Ted Roche
On Thu, May 17, 2018 at 8:11 AM, Alan Bourke  wrote:
> There's a VFP implementation of the C# String.Format() here: 
> http://saltydogllc.com/string-format-for-visual-foxpro/

Cool! Check that off the list!


-- 
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cacw6n4txdu8uyrrpj4sgtonzc_jyot-jlu1c84ns21yr6ds...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


Re: Fun with date calculations in VFP

2018-05-17 Thread Alan Bourke
There's a VFP implementation of the C# String.Format() here: 
http://saltydogllc.com/string-format-for-visual-foxpro/


-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/1526559110.4185758.1375444968.4fd9d...@webmail.messagingengine.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


Re: Fun with date calculations in VFP

2018-05-17 Thread Ted Roche
You have a set of Add functions: AddYears, AddDays, AddHours, Minutes,
Seconds, Ticks... where's AddMonth, besides the obvious GOMONTH()?

Time support native in VFP has always been weak. I wrote a s2hms and
hms2s to convert between seconds and HH:MM:SS strings.

DTOT converts a Data to a datetime by setting time to 00:00:00. It
would be handy to have the ability to set the time as well, even
though it's pretty much the trivial

RETURN DTOT(thedate)+hms2s(thetime)

A pretty print would be handy, I don't know C#, but PHP et all has
fprint with a unix-standard-y format string, String.Format does the
same in C# apparently:

http://www.csharp-examples.net/string-format-datetime/
https://secure.php.net/manual/en/datetime.format.php

I can't tell you how many times I've written a UDF or inline code to
generate variations on "Monday, December 31, 1999 12:34:56 am" -
having that in one place would be handy.


On Tue, May 15, 2018 at 4:20 PM, Eric Selje  wrote:
> I've started a class for a C# like DateTime static class here:
> https://github.com/eselje/FoxTypes/blob/master/FT_DATETIME.md
>
> I may steal some of the ideas here to embellish it, but if you have time
> and want to contribute please clone this repo and submit a pull request
> when done. It's pretty handy.
>
> Eric
>
>
> On Wed, May 9, 2018 at 10:39 AM, Ted Roche  wrote:
>
>> On Tue, May 8, 2018 at 5:39 PM, Richard Kaye  wrote:
>> > I owe you a Scotch next time you're in the area.
>> >
>>
>> Deal!
>>
>> --
>> Ted Roche & Associates, LLC
>> http://www.tedroche.com
>>
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cacw6n4tmna1qntltxsrekqqr8x+kbb9pqjhjphr+hdewghd...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


Re: Application User Level Access

2018-05-17 Thread Ajoy Khaund
Thanks.
I have reversed the order as of now.

1. Reports Only
2. Data Entry Only (NO Master Entry)
3. Manager (Data Entry + Master Entry)
4. Admin (All Forms & create users)

On Tue, May 15, 2018 at 10:45 PM, Charlie-gm  wrote:

> I'll apologize in advance some of this is somewhat basic, but I want to be
> clear about my approach.
>
> One thing that I do in VFP is to first subclass all the base classes into
> it's own .vcx. So I get something like "mybutton" which was subclassed from
> button.
>
> Now, in pretty much all those classes, I add  a property "naccess". I
> default the value to 1 (which can, of course, be overridden when I
> instantiate it on a form).
>
> In addition to that property I add another "lRemovebyAccess". I usually
> default this to .F.
>
> I also have a global object that has a property "userlevel" - when the
> application starts, that property gets set to some value (numeric) based on
> whatever rules are used for that application.
>
> Then, in the .Init() method of all my baseclasses I have the following
> code snippet:
> IF THIS.lRemovebyAccess == .T. AND THIS.nAccess > oApp.nUserLevel
> THIS.Visible = .F.
> THIS.Enabled = .F.
> ENDIF
>
> So now, whenever I put the buttons, grids, spinners, images, whatever...
> on a form, I can set the .lRemovebyAccess and nAccess of the objects.
>
> One thing to remember is if you put code in .Init's of your instantiated
> buttons (the ones you drop on a real form), you need to call DoDefault() in
> that code (of course).
>
> The lRemovebyAccess is a little redundant, but it gives a very quick way
> to make everything visible if you're having  problem debugging (e.g.
> .SetAll()). Also, it made it easy to completely swap the "security
> importance" of the app with just 1 baseclass property setting: that is,
> change the concept from specifically picking things to hide to specifically
> picking things to show.
>
> I would recommend at least 10 levels of access: I've rarely seen more than
> 5, but you just know...
>
> Also, I ran into a case where not only did they want tiered access levels,
> they also wanted to let one Admin see and do somethings and another Admin
> to see/do different things. I won't clutter up this already long email with
> that stuff but it essentially was just another property ".cfuncaccess" that
> could contain a string of characters. And then in the logon the user was
> assigned his "string" (usually a single character). From there the above
> IF statement was modified to include the check of strings, etc.
>
> I've put this in my generic visual class library that I use on all
> projects. A couple times about halfway into developing they said, '... oh
> yeah, we want to also add security levels' My prime contractor freaked
> out, told them it would add like a year to the project, yada yada. But
> after one meeting to be clear on requirements, I rolled it out in a week
> (which actually upset my prime contractor because they wanted to charge a
> lot more money... heh).
>
> -HTH
> -Charlie
>
> On 5/14/2018 1:29 AM, Ajoy Khaund wrote:
>
>> Hi All,
>>
>> In my applications I have added a user table where there will be field to
>> define the user level.
>>
>> Level - 1 Admin: can add users and has access to all
>> Level - 2 Manager - cannot add user but has access to all others
>> Level - 3 Operator - can add transactions but cannot create masters (eg.
>> add/edit a customer)
>>
>>
>
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/caps4rvvwdlok2e2sn+ytkjwk+2kc8ud5x2hrfx4pyaonppn...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.