09 October, 2012

Test post 2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
using System.Data;
using System.Configuration;

public partial class _default : System.Web.UI.Page
{
    MySqlConnection con;
    MySqlDataAdapter adp;

    protected void Page_Load(object sender, EventArgs e)
    {
        con = new MySqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);

        if (!Page.IsPostBack)
        {
            SignIn s = new SignIn(Session, Request, Response);
            s.DefaultSignIn();
        }
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        DataTable dt2 = new DataTable();

        adp = new MySqlDataAdapter("select a.LoginID,a.Admin,a.PriceFile,a.OrdersList,a.IncomingPayments,a.DistInvoices,a.SupplierInvoices,a.OutgoingPayments,a.PTP,a.CL,a.Reports,a.OrdersFiles,a.Rebates,a.attendance,a.AnnualLeave,a.LeaveAccess,a.Helpdesk,a.Country,a.BondedOrder,a.StyleSheet,a.UserGuides,a.StandardEng,a.NEWS, a.Track, a.BankStatement,a.CreditNotes, b.FullName,a.DReports,a.ManualInvoice,a.StorageInvoice, a.VirtualDist from ccs2_users a inner join auth b on a.LoginID=b.LoginID where a.LoginID='" + txtUserName.Value.Replace("'", "''") + "' and b.Password=AES_ENCRYPT('" + txtPassword.Value.Replace("'", "''") + "', StrKey) and b.Active=1 ", con);
        adp.Fill(dt);

        if (dt.Rows.Count > 0)
        {
            Session["CCS"] = dt;

            if (chkRemember.Checked == true)
            {
            
                Response.Cookies["CCS"].Value = txtUserName.Value;
                Response.Cookies["CCS"].Expires = DateTime.Now.AddDays(30);
            }
            Response.Cookies["CCSi"].Value = txtUserName.Value;
            Response.Cookies["CCSi"].Expires = DateTime.Now.AddDays(30);

            adp = new MySqlDataAdapter("select NextPassUpd from auth where LoginID='" + txtUserName.Value.Replace("'", "''") + "'", con);
            adp.Fill(dt2);

            if (DateTime.Now > (Convert.ToDateTime(dt2.Rows[0]["NextPassUpd"].ToString())))
            {

                Response.Redirect("PassUpdate.aspx");
            }
            else
            {
                Response.Redirect("home.aspx");
            }
        }
        else
            Alert.Show("Invalid combination of username or password");
    }
protected void btnLogin_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        DataTable dt2 = new DataTable();

        adp = new MySqlDataAdapter("select a.LoginID,a.Admin,a.PriceFile,a.OrdersList,a.IncomingPayments,a.DistInvoices,a.SupplierInvoices,a.OutgoingPayments,a.PTP,a.CL,a.Reports,a.OrdersFiles,a.Rebates,a.attendance,a.AnnualLeave,a.LeaveAccess,a.Helpdesk,a.Country,a.BondedOrder,a.StyleSheet,a.UserGuides,a.StandardEng,a.NEWS, a.Track, a.BankStatement,a.CreditNotes, b.FullName,a.DReports,a.ManualInvoice,a.StorageInvoice, a.VirtualDist from ccs2_users a inner join auth b on a.LoginID=b.LoginID where a.LoginID='" + txtUserName.Value.Replace("'", "''") + "' and b.Password=AES_ENCRYPT('" + txtPassword.Value.Replace("'", "''") + "', StrKey) and b.Active=1 ", con);
        adp.Fill(dt);

        if (dt.Rows.Count > 0)
        {
            Session["CCS"] = dt;

            if (chkRemember.Checked == true)
            {
            
                Response.Cookies["CCS"].Value = txtUserName.Value;
                Response.Cookies["CCS"].Expires = DateTime.Now.AddDays(30);
            }
            Response.Cookies["CCSi"].Value = txtUserName.Value;
            Response.Cookies["CCSi"].Expires = DateTime.Now.AddDays(30);

            adp = new MySqlDataAdapter("select NextPassUpd from auth where LoginID='" + txtUserName.Value.Replace("'", "''") + "'", con);
            adp.Fill(dt2);

            if (DateTime.Now > (Convert.ToDateTime(dt2.Rows[0]["NextPassUpd"].ToString())))
            {

                Response.Redirect("PassUpdate.aspx");
            }
            else
            {
                Response.Redirect("home.aspx");
            }
        }
        else
            Alert.Show("Invalid combination of username or password");
    }
protected void btnLogin_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        DataTable dt2 = new DataTable();

        adp = new MySqlDataAdapter("select a.LoginID,a.Admin,a.PriceFile,a.OrdersList,a.IncomingPayments,a.DistInvoices,a.SupplierInvoices,a.OutgoingPayments,a.PTP,a.CL,a.Reports,a.OrdersFiles,a.Rebates,a.attendance,a.AnnualLeave,a.LeaveAccess,a.Helpdesk,a.Country,a.BondedOrder,a.StyleSheet,a.UserGuides,a.StandardEng,a.NEWS, a.Track, a.BankStatement,a.CreditNotes, b.FullName,a.DReports,a.ManualInvoice,a.StorageInvoice, a.VirtualDist from ccs2_users a inner join auth b on a.LoginID=b.LoginID where a.LoginID='" + txtUserName.Value.Replace("'", "''") + "' and b.Password=AES_ENCRYPT('" + txtPassword.Value.Replace("'", "''") + "', StrKey) and b.Active=1 ", con);
        adp.Fill(dt);

        if (dt.Rows.Count > 0)
        {
            Session["CCS"] = dt;

            if (chkRemember.Checked == true)
            {
            
                Response.Cookies["CCS"].Value = txtUserName.Value;
                Response.Cookies["CCS"].Expires = DateTime.Now.AddDays(30);
            }
            Response.Cookies["CCSi"].Value = txtUserName.Value;
            Response.Cookies["CCSi"].Expires = DateTime.Now.AddDays(30);

            adp = new MySqlDataAdapter("select NextPassUpd from auth where LoginID='" + txtUserName.Value.Replace("'", "''") + "'", con);
            adp.Fill(dt2);

            if (DateTime.Now > (Convert.ToDateTime(dt2.Rows[0]["NextPassUpd"].ToString())))
            {

                Response.Redirect("PassUpdate.aspx");
            }
            else
            {
                Response.Redirect("home.aspx");
            }
        }
        else
            Alert.Show("Invalid combination of username or password");
    }
protected void btnLogin_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        DataTable dt2 = new DataTable();

        adp = new MySqlDataAdapter("select a.LoginID,a.Admin,a.PriceFile,a.OrdersList,a.IncomingPayments,a.DistInvoices,a.SupplierInvoices,a.OutgoingPayments,a.PTP,a.CL,a.Reports,a.OrdersFiles,a.Rebates,a.attendance,a.AnnualLeave,a.LeaveAccess,a.Helpdesk,a.Country,a.BondedOrder,a.StyleSheet,a.UserGuides,a.StandardEng,a.NEWS, a.Track, a.BankStatement,a.CreditNotes, b.FullName,a.DReports,a.ManualInvoice,a.StorageInvoice, a.VirtualDist from ccs2_users a inner join auth b on a.LoginID=b.LoginID where a.LoginID='" + txtUserName.Value.Replace("'", "''") + "' and b.Password=AES_ENCRYPT('" + txtPassword.Value.Replace("'", "''") + "', StrKey) and b.Active=1 ", con);
        adp.Fill(dt);

        if (dt.Rows.Count > 0)
        {
            Session["CCS"] = dt;

            if (chkRemember.Checked == true)
            {
            
                Response.Cookies["CCS"].Value = txtUserName.Value;
                Response.Cookies["CCS"].Expires = DateTime.Now.AddDays(30);
            }
            Response.Cookies["CCSi"].Value = txtUserName.Value;
            Response.Cookies["CCSi"].Expires = DateTime.Now.AddDays(30);

            adp = new MySqlDataAdapter("select NextPassUpd from auth where LoginID='" + txtUserName.Value.Replace("'", "''") + "'", con);
            adp.Fill(dt2);

            if (DateTime.Now > (Convert.ToDateTime(dt2.Rows[0]["NextPassUpd"].ToString())))
            {

                Response.Redirect("PassUpdate.aspx");
            }
            else
            {
                Response.Redirect("home.aspx");
            }
        }
        else
            Alert.Show("Invalid combination of username or password");
    }
}

26 September, 2012

Test Post

   51 if (EmailAddress!=string.Empty)

   52                         {

   53                             MailMessage mail = new MailMessage(ConfigurationManager.AppSettings["From"], EmailAddress);

   54                             mail.Subject = "Unpaid PAYMENT REMINDER ";

   55                             //mail.Body = "Dear distributor,<br/><br/>The payment of Order# " + dr["OrderNo"].ToString() + " has been flagged as not yet Paid. <br/><br/>Please can you make payment and upload the remittence slip.<br/><br/>Kind Regards,<br/><br/>Capital Steel Buildings";

   56                             mail.Body = "<span " + Constants.EmailMessageNormalStyle + ">Dear distributor,<br/><br/>The payment of Order# <span " + Constants.EmailMessageNumbersStyle + ">" + dr["OrderNo"].ToString() + "</span> has been flagged as not yet Paid. <br/><br/>Please can you make payment and upload the remittence slip.</span><br/><br/><span " + Constants.EmailFixMessageStyle + ">PLEASE DO NOT REPLY TO THIS EMAIL ADDRESS – EMAIL HAS BEEN GENERATED AUTOMATICALLY TO PROVIDE A NOTIFICATION ONLY–<br/>REPLYING TO THIS ADDRESS WILL RESULT IN NO FEEDBACK.</span><br/><br/><span " + Constants.EmailMessageBoldStyle + ">Regards,<br/>Capital Steel Buildings.</span>";

   57                             mail.IsBodyHtml = true;

   58 

   59                             SmtpClient sm = new SmtpClient();

   60                             NetworkCredential nt = new NetworkCredential("ccs@capitalsteelbuildings.co.uk", "ccs#2009");

   61 

   62                             sm.Host = ConfigurationManager.AppSettings["SMTP"];

   63                             sm.UseDefaultCredentials = false;

   64                             sm.Credentials = nt;

   65 

   66                             if (ConfigurationManager.AppSettings["SendEmail"].Equals("Yes"))

   67                                 sm.Send(mail);

   68                         }

22 April, 2012

Syntax Highlighting in Google Docs

Asalam-o-Alaikum!

I use Google Docs to make my programming notes. For which I have to write some code examples. As you know that writing code requires the syntax to be highlighted. But unfortunately, Google Docs lacks this feature. So I tried to search for an appropriate solution to highlight my code examples. And I have come across a solution which I am going to share with you. I know that this solution is not perfect, but it works for me :-)

Step 1: Open www.Snipt.net and Sign Up for new account.
Step 2: After signing in click on the Add Snipt button.

Click on Add Snipt

Step 3: Write your code in given area, select appropriate language from dropdown and click save button.

Adding code on Snipt.net

Step 4: You can see in below image that your code is colourized. Select this colourized code and copy it.

Syntax Highlighting on Snipt.net
 Step 5: Paste this code into Google Docs (Google Documents or Google Presentation). Here is the result.

Syntax Highlighting on Google Documents with white background page.
Note: 
  1. If you are feeling difficulty in reading code on Google Docs then make it bold.
  2. Be sure that background of Google Documents or Google Presentation is white. Otherwise the result will be like this...


Syntax Highlighting on Google Presentation with blue background slide.