Thursday, December 19, 2013

Prevent external emails from Corporate account - Outlook 2010

Sometimes we unknowingly or by mistake we may send official/important emails to our personal email ids (or other external email ids). To prevent those instance(s), we can make use of VBA from MS-Outlook 2010. 

Technically, below event triggers while we click on Send button (of course Alt + S :P)

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

If Item.Class <> olMail Then Exit Sub

Dim sCompanyDomain As String: sCompanyDomain = ""

Const PidTagSmtpAddress As String = ""

On Error Resume Next
Dim oMail As MailItem: Set oMail = Item
Dim oRecipients As Recipients: Set oRecipients = oMail.Recipients
Dim bDisplayMsgBox As Boolean: bDisplayMsgBox = False

Dim sExternalAddresses As String
Dim oRecipient As Recipient

For Each oRecipient In oRecipients

    Dim oProperties As PropertyAccessor: Set oProperties = oRecipient.PropertyAccessor
    Dim smtpAddress As String: smtpAddress = oProperties.GetProperty(PidTagSmtpAddress)

    Debug.Print smtpAddress

    If (Len(smtpAddress) >= Len(sCompanyDomain)) Then
        If (Right(LCase(smtpAddress), Len(sCompanyDomain)) <> sCompanyDomain) Then

            ' external address found
            If (sExternalAddresses = "") Then
                sExternalAddresses = smtpAddress
                sExternalAddresses = sExternalAddresses & ", " & smtpAddress
            End If

            bDisplayMsgBox = True
        End If
    End If

If (bDisplayMsgBox) Then
    Dim iAnswer As Integer
    iAnswer = MsgBox("You are about to send this email externally to " & sExternalAddresses & vbCr & vbCr & "Do you want to continue?", vbExclamation + vbYesNo, "External Email Check - Srinivas G")

    If (iAnswer = vbNo) Then
        Cancel = True
    End If

End If

End Sub

Friday, November 29, 2013

Sort Column data in GridView with Entity Framework

 Using db As New Model.ApplicationEntities()

            Dim q = From tm In db.lk_xyzEnitty
                           .... .... .. .....
                    Select ..... ...... ..

            ' Logic to sort the resultant list based on sort expression
            If Not ResourceSortExpression Is Nothing AndAlso ResourceSortExpression <> String.Empty Then
                ' From grid, if click on sort link then below logic applied
                Dim param = Expression.Parameter(GetType(lk_xyzEnitty), CStr(ResourceSortExpression))
                Dim sortExpression = Expression.Lambda(Of Func(Of lk_xyzEnitty, Object))(Expression.Convert(Expression.Property(param, ResourceSortExpression), GetType(Object)), param)

                If ResourceSortDirection = "ASC" Then
                    gridViewControl.DataSource = q.ToList().AsQueryable().OrderBy(sortExpression)
                    gridViewControl.DataSource = q.ToList().AsQueryable().OrderByDescending(sortExpression)
                End If
                ' By default or First time, resources order by Name
                gridViewControl.DataSource = q.ToList()
            End If


        End Using

NoteResourceSortExpression is property. 
ResourceSortExpression = e.SortExpression from gridViewControl_Sorting event handler.

Wednesday, November 13, 2013

TSQL - Filter/Show All or specific records from Select query

-- Trick to filter/show all or specific records from select query 
DECLARE @AllRecords NCHAR(1) 

IF (@RoleID <= 0) 
SET @AllRecords = N'Y' 
SET @AllRecords = N'N' 


ar.RoleID = @RoleID OR @AllRecords = N'Y' 

Thursday, November 7, 2013

Nenu naa pychayam :P

1. Beach nunchi sunrise and sunsent chooste fantastic ga vuntundi.. ade ammaitho chooste manchi Romantic ga vuntundi.
2. Samarayogulnni (freedom fighters) sanmanichukoleka pothunnam..Kanisam smarinchukundham.
3. Eakathvam le ni naayakathvam..
4. Raastram ragili potundhi.. kaastam ga kaali potundhi..
Veetini aape vare lera??

Avunu le.. kaastanni madhylo aarapakoodadhu ga.. andhukanenemo mari :p
4. Thappu ga chese prabhutvam vundi..
Thappu ani cheppe prathi paksham vundi..
kani padhavi loki vachhi manchi chese valle karvu iyyaru...

Eppudu topic Samakyndhra, telangana kaadhu.. Pavan kalyan politics loki vastada ani.. Media kooda super kada :) VAllaki TRP ratings ravali ga :p

5. Nirbandhamyna prema..Sunnitha veta anivi vundavu.. 
Ante balavanthamyna prema anedi vundadhu..swachhandham ga ne premistham.

Pure Telugu Words:
Dhohithrudu - koothuru bidda

Friday, October 4, 2013

How to take care of our eyes

1. After every 20 minutes of looking into the computer screen, turn your head and try to look at any object placed at least 20 feet away. This changes the focal length of your eyes, a must-do for the tired eyes.

2. Try and blink your eyes for 20 times in succession, to moisten them. 

3. If time permits, one should walk 20 paces after every 20 minutes of sitting in one particular posture. Helps blood circulation for the entire body. 

One say that your eyes are mirrors of your soul, so do take care of them, they are priceless.

"Sarvendriyanam nayanam pradhanam"

Wednesday, August 14, 2013

August 15

I love my India
I am proud to be an Indian.

Independence day pillala ki choclates kosam, corporate employees ki best dressing men/women kosam, common people ki oka holiday ga mari poiena.

Annam pette rythulu ki annam leka aathma hatyalu chesukuntunna...Madhya tharagathi jeevulu kareedhu ga marina kayagooralu konaleka pappu pacchadi tho saripettukunna..

I na I love my India 
I am proud to be an Indian.

Dasabdhalu dhati sathabdhalu vypu parugulu teesina..Thara tharalu ga Prabuthvalu mari na Peadhala thala raathalu prabuthvapu kagithala geethala ki parimithamyna..

66 yella soodhriga bharatha prasthanam lo purogathi chendhina parinethi chendhani maanava jeevana syli ki...Samajikam le ni e samajam lo praja swamyam koraky enka poradutunna...

I na I love my India 
I am proud to be an Indian.

Parai desalu manlni dhooshinichi bhadinchina enka sahanam ane chiru navvutho thalavanchina... Ikamathyam lo ikyatha lopinchi mana lo maname samaskarincha lekapotunna..

Thappu chesina vallaki siksha veyilekunna....Prajala kosam rajyangalu marakunna...
I na I love my India 
I am proud to be an Indian.

August 15 ane okka roju ke parimitha my jathiya samykyatha kosam matlade konthamandi janatha, dry day ani bhadapade konthamandhi ga vunna thoti vyavastha...
Sraminchina saripada sampadhana chalaka valasa poie videsala lo ranistunna youvatha..

I na I love my India
I am proud to be an Indian
Edhi bhava racha kaadu, bhavodvegam anukovadam sari kadu.. edi ok samanya bharathyudinyna na avedhana na.. Because India is still DEVELOPING Country..

- Sri
(Srinivas G). I apologize for the typo mistakes.
Inspired from Sirivennala Sitharamasasthri's lyrics - " అర్ధశతాబ్దపు అఙానాన్ని స్వతంత్రమందామా స్వర్ణోత్సవాలు చేద్దామా"

Monday, March 25, 2013

Your topic

Basically this topic is about Email etiquitte. nothing much to mention the words which they have given in the subject line..

Everyone knows about the topic, but try to throw a light again with etiquitte (or rules)

First talk what to do and then and then say what not to do.

1. Greetings for receipient

2. Msg to be brief and to the point, if needed with proper example

3. Shouldnt send any vital or private infomation

4. Dont use emotional sings to convey our feelings

5. Subject should be simple and understandable

6. list out to whom the email/msg to be sent for, others put in CC (or optional)

7. formatting is also important, not multi-color or multi-fonts until it is required

8. major issues or discussons or lengthy email, would be ideal to summarize it properly

9. Recepient salutation and our signature is important

10. provide contact no. (office ext.) to communicate to u if they want to have a personal discussion on the email u sent.

11. IMP - Try to think about courtesy at all times. Use words that are pleasing to the ears and avoid using words that may suggest command or threats.

12. message wuold be same but conventions should vary. developers knows technical terms but not the business try to convey with non-technical words for business persons.. depending on their tech knowlege, etc.

13. imp - use BCC only when required.. hiding persons but passing msgs is not a professional way..


1. avoid using offensive language and bias toward gender, race, or creed.

2. avoid red color, shows our angry on them

3. avoid CAPITAL letters, shows our irritation

4. do not use chatting terms or short terms except business teminology or TQ -thank you, bfn -bye for now..

5. lenghty notes to be avoided in email, rater send an document.

6. shold not point any region

7. subject should not be blank

8. dont ask acknowlege for all emails until it is urgent or mandatory.

9. do nt use words like hate, went-off, objectionable words..

**Though we complain or comment on others, write in a diplomatic way..

Should avoid offensive, racist or obscene things. it not only impacts personal repo but also affects on business

Simple examples to make everyone understand..

- if a team member is not working well then we wont blame the team except him.. similarly we shuldnt make any sentence on the region or group...

- no persnoal stmts on anyone, its just a business or work.. no matter of "hate" or "like" in terminology

- if u have any other examples in ur mind..

IMP- Sometimes in organization,we send some casual emails to our fellow mates, which consists of comics, pictures, cartoons, content from web, or other sources too.. for those emails also they should not contain anything against to gender, face, community, hate,creed etc.

Hope it helps for your discussion.