Outlook Mail Templates

 

1.       Outlook allows creating Mail Templates that can be used to quickly send mails to
standard group of people or Set up meetings quickly…

2.       The way to set this up is described here: http://www.wikihow.com/Create-and-Use-Templates-in-Outlook-Email

3.       Rules are another quick way of sorting messages: http://office.microsoft.com/en-001/outlook-help/manage-email-messages-by-using-rules-HA010355682.aspx

But make sure that u select “Stop applying
more Rules” for every new rule, otherwise it’ll get screwed up

This course is quite good: Save
time with templates in Outlook

 

 

–>

Advertisements

Asp.Net Tips and Tricks


1.
Call remote methods: This can be done in 2 ways,

a.    1st
that u have a restful svc like a webAPI that binds every HTTP verb to a method

b.    2nd in
other cases like mine, where I had a simple asp.net web app, my home.aspx was
calling svc.aspx and passing the method to be executed as  a “action” query
string : AJAXResponse.aspx?action=btn1_Clk&ID=” + iD;

Now in the c# code, in case u have called AJAXResponse.aspx, then first make sure that in its aspx file all u have is : <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AJAXResponse.aspx.cs" Inherits="RFBAppUsingInterface.AJAXResponse" %>

 

 And in it’s .cs file’s Page_Load(),
check the action and call the method:

string action = HttpContext.Current.Request["action"];

            if (action == " btn1_Clk")
            {
                string ID = HttpContext.Current.Request["iD"];
                if (ID != null)
                    btn_Clk(ID);
            }
 

2.
SESION

a.       Read
from session:  HttpContext.Current.Session[“abc”])

3.  Response
JSON

          Response.Clear(); //MAKE SURE U DO THIS

            RESULT = PerformAction(dfd);

 
            var json = new JavaScriptSerializer();

            var resp = new JSONResponse();

            resp.a = df;
            resp.b = 
            resp.c = 
            Response.Write(json.Serialize(resp));
        }
    }

    public class JSONResponse
    {
        public string a { getset; }
        public string b { getset; }
        public string c { getset; }
    }

4.  Load the file at runtime: string path = HostingEnvironment.MapPath(@"~/App_Data/abc_" + Environment + ".xml");
                                                 var stream = new StreamReader(path);
                                                   config = Helper.LoadRBFConfiguration(stream);

5.  Role
of Global.asax:Whatever needs to be done only at Application Start should be put in Application_Start() of Global.asax.cs.

Also, if you want something to persist, create it here, Eg. If u want int a globally, all u have to do in home.aspx is : Global.a

6.  TO register anything: Page.ClientScript.RegisterStartupScript(GetType(), “ex”,

                                                                "alert('" +
                                                                "U don’t have access"');"true);

7.  In
home.aspx.designer.cs, add:

/// <summary>
        /// GroupPnl control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Panel GroupPnl;

Below are some changes to it:

a.  GroupPnl.Height = Unit.Percentage(100);
b.  GroupPnl.BackColor = System.Drawing.Color.Silver;
c.  CheckPanel.BackColor = Color.FromArgb(207, 238, 248);
d.  abc.BorderStyle = BorderStyle.Double;
e.  sd.OnClientClick = "CheckAll_ClkXMLHttpReq(event);return false;";// Note that in case you don’t do return false; here, it will do a page reload even though onclk u are executing a js function..
f.  GroupPnl.Controls.Add(new LiteralControl(
                            "

&nbsp;    

 +
                            pair.Key + "</span></span></p>");
g.  GroupCheckStatus.Click += new EventHandler(CheckGroup_Click); //Server Side Event
h.  GroupCheckStatus.Click += (sender, e) => CheckGroup_Click(sender, e); //Server Side Event
i.  If you hide some element on server side (ie in aspx page), then its not send over in the html, so u cannot show it using js latr..hence hide and show using js only…
j.   var Response = new TextBox(); Response.Wrap = true; OR  DetailsText.TextMode = TextBoxMode.MultiLine; // Show multi line in textbox

8.
If a solution has multiple projects, say A is dll proj and B is web
app (asp.net), the A can read the web.config from B

9.
To be able to override any machine.config tag in ur app, the
registration of that tag in m.c (under <configSections>)should be set as allowDefinition=MachineToApplication” or allowDefinition=Everywhere

10.

11.

 

 

 

–>

System.DirectoryServices;

using System.DirectoryServices;


ref:

 

  1. Using System.DirectoryServices

 

From <http://msdn.microsoft.com/en-us/library/ms180832(v=vs.80).aspx>

 

  1. System.DirectoryServices Namespace

 

From <http://msdn.microsoft.com/en-us/library/system.directoryservices.aspx>

 

  1. Using System.DirectoryServices to Search the Active Directory

 

From <http://msdn.microsoft.com/en-us/library/ms973834.aspx>

 

  1. Using System.DirectoryServices.AccountManagement

 

From <http://www.codeproject.com/Articles/38344/Using-System-DirectoryServices-AccountManagement>

Manually Parsing and Mapping XML in c#

Reading XML in c#

1.  using System.Xml;
2.   XmlReaderSettings settings = new XmlReaderSettings();
3.              settings.IgnoreWhitespace = true;
4.              XmlTextReader textReader = new XmlTextReader(stream);
5.              XmlReader reader = XmlReader.Create(textReader, settings);
 
 
 
Parsing through the tags:
 while (reader.Read())                                     
                    reader.Read();   //Reads A
                    while (!((reader.NodeType == XmlNodeType.EndElement) && (reader.Name == "A")))          //till all B End
                    {
                              reader.Read();  //Reads B1
 if (reader.Name == "B1")
                            {
                                 
                                if (reader.HasAttributes)
                                {

                                    if (reader["Ba1"] != null && reader["Ba2"] != null)
                                    {}
                                   reader.Read();
                                while (!((reader.NodeType == XmlNodeType.EndElement) && (reader.Name == "B1")))          //till all B End                       
                                { if (reader.Name == "R")
                                        {
                                            if (reader.HasAttributes)
                                            {
                                                String kName = reader["R1"];}
                                            if (kName == null)
                                                {
                                                    reader.MoveToElement();
                                                    reader.Read();
                                                    while (!((reader.NodeType == XmlNodeType.EndElement) && (reader.Name == "p")))
                                                    {
                                                        reader.Read();
                                                    }
                                                    reader.Read();   // to read /p
                                                    reader.Read();      // to read /R
                                                    

                                                }
 
Now to map all the stuff read from the XML file into a custom class’s instance, use:
 
  pCheck = (MyClass)Activator.CreateInstance(AppDomain.CurrentDomain, GroupAssembly (read this also from XML in case it is not the current assembly), ClassName(Read the from the XML as well), trueBindingFlags.Default, nullnew object[] {argument1, argument2}, nullnullnull).Unwrap();
 
 
 THIS IS THE SAMPLE XML:

<!–?xml version=”1.0″ encoding=”utf-8″ ?>
<A>
<B1 Ba1=”sfdsf” Ba2=”sdf”>
<R R1=”sd”>
<p>

 
 
 
 

–>

.Net Logging

aPIs for logging, database access and alerting that I’ve used in the past:

 

1.
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling

 

From <http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.exceptionhandling.aspx>

 

2.  Microsoft.Practices.EnterpriseLibrary.Logging;

3.  Apache log4net library 

 

From <http://logging.apache.org/log4net/index.html>

 

 

 

Ref:

 

1)
stackoverflow.com/questions/185542/net-logging-framework

2)       .NET logging and tracing tools From <http://www.dotnetlogging.com/>

3)
Open source support library for
Enterprise Stack applications and services in .net

a)
Enterprise Library 6.0

 

From <http://blogs.msdn.com/b/somasegar/archive/2013/04/25/enterprise-library-6-0.aspx>

 

 

 

 

–>

MQ Checks using .Net

Aim:

Perform Checks on MQ using .Net (To Check ChannelStatus, PubSubStatus, QueueManagerPing,
QueueManagerStatus)

Setup:

1.
Visual Studio

2.
Amqmdnet.dll

3.
IBM MQ Client                       

Steps:

1.
PCF commands are used to query MQ
status remotely. (using IBM.WMQ.PCF;)

2.
PCFMessageAgent agent;

3.
MQQueueManager qm = new MQQueueManager(queueManagerName, Channel, ConnName);

4.
request = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS);

5.
request.AddParameter(…);

6.
request.AddParameter… }); ;

7.
responses = agent.Send(request);

 

The
responses” contain all the info…

 

 

 

–>