Search This Blog

2009-05-22

XGrid revised


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using System.Collections.Specialized;
using System.Web.UI.HtmlControls;


namespace Gui.Controls
{


  [DefaultProperty ( "Text" )]
  [ToolboxData ( "<{0}:XGrid runat=server></{0}:XGrid>" )]
  public class XGrid : GridView
  {


    #region Constructor
    /// <summary>
    /// Initialises an <see cref="XGrid"/>.
    /// </summary>
    public XGrid ()
    {
    }
    #endregion


    #region Properties



    #region HasCustomFormatting
    /// <summary>
    /// Whether the results summary should be shown.
    /// </summary>
    [DefaultValue ( true )]
    [Category ( "Appearance" )]
    [Description ( "Whether this gridview would need custom formatting per column ." )]
    public bool HasCustomFormatting
    {
      get
      {

        if (HttpContext.Current.Session["global." + this.ID + ".HasCustomFormatting"] == null)
          return false;
        else
          return (bool)HttpContext.Current.Session["global." + this.ID + ".HasCustomFormatting"];
      }
      set { HttpContext.Current.Session["global." + this.ID + ".HasCustomFormatting"] = value; }
    }
    #endregion





    #region Ld
    private ListDictionary ld;
    [Description ( "Contains the extended properties values from the stored procedures " )]
    public ListDictionary Ld
    {
      get
      {
        return ld;
      }
      set
      {
        this.ld = value;
      }
    }
    #endregion Ld


    #region MaxCharColapse
    /// <summary>
    /// Whether the results summary should be shown.
    /// </summary>
    [DefaultValue ( 50 )]
    [Category ( "Appearance" )]
    [Description ( "At which character the column of the gridview should colapse" )]
    public int MaxCharColapse
    {
      get
      {
        if (HttpContext.Current.Session["global." + this.ID + "MaxCharColapse"] == null)
          return 50;
        else
          return (int)HttpContext.Current.Session["global." + this.ID + "MaxCharColapse"];
      }
      set { HttpContext.Current.Session["global." + this.ID + "MaxCharColapse"] = value; }
    }
    #endregion MaxCharColapse


    private int GvPageSize
    {
      get
      {
        if (HttpContext.Current.Session["global." + this.ID + ".GvPageSize"] == null)
        {
          //Utils.Debugger.WriteIf ( "GvPageSize is null " );
          return 20;
        }            //this is the default size of the page
        else
        {
          //Utils.Debugger.WriteIf ( "GvPageSize is  " + System.Convert.ToString ( HttpContext.Current.Session ["global." + this.ID + ".GvPageSize" ] ) );
          return System.Convert.ToInt32 ( HttpContext.Current.Session["global." + this.ID + ".GvPageSize"] );
        }
      } //eof get
      set
      {
        try
        {                //accept only whole numbers , if not whole number set default 7

          int pageSizeToSet = value;
          HttpContext.Current.Session["global." + this.ID + ".GvPageSize"] = pageSizeToSet;
          System.Convert.ToInt64 ( pageSizeToSet );
          if (pageSizeToSet >= this.DataSourceCount || pageSizeToSet < 0)
          {
            HttpContext.Current.Session["global." + this.ID + ".GvPageSize"] = this.DataSourceCount;
            //Utils.Debugger.WriteIf ( "The DataSourceCount is " + System.Convert.ToString ( this.DataSourceCount ) );
            this.MyPageIndex = 0;
            //variant Unable to cast object of type 'System.Web.UI.WebControls.TableRow' to type 'System.Web.UI.WebControls.GridViewRow
            //this.AllowPaging = false; 
          } //eof to return all if 
          else
          {
            HttpContext.Current.Session["global." + this.ID + ".GvPageSize"] = value;
          } //eof if the desired page size is smaller than the number 

        } //eof try 
        catch (System.FormatException sfe)
        {
          HttpContext.Current.Session["global." + this.ID + ".GvPageSize"] = 13; //fatal number of exceptions 
        } //eof catch

      } //eof set

    } //eof property GvPageSize


    private string GetSortDirection ()
    {
      switch (GridViewSortDirection)
      {
        case "ASC":
          GridViewSortDirection = "DESC";
          break;

        case "DESC":
          GridViewSortDirection = "ASC";
          break;
      }

      return GridViewSortDirection;
    }

    #region GridViewSortDirection
    private string GridViewSortDirection
    {
      get { return HttpContext.Current.Session["global." + this.ID + "SortDirection"] as string ?? "ASC"; }
      set { HttpContext.Current.Session["global." + this.ID + "SortDirection"] = value; }
    }
    #endregion GridViewSortDirection


    //private GenApp.Bo.User userObj;
    //public GenApp.Bo.User UserObj { get { return this.userObj; } set { this.userObj = value; } }


    #region GridViewSortExpression
    private string GridViewSortExpression
    {
      get { return HttpContext.Current.Session["global." + this.ID + "SortExpression"] as string ?? string.Empty; }
      set { HttpContext.Current.Session["global." + this.ID + "SortExpression"] = value; }
    }
    #endregion //GridViewSortExpression


    #region MyPageIndex
    public int MyPageIndex
    {
      get
      {
        //     //Utils.Debugger.WriteIf ( "The page index of gb with id " + Convert.ToString ( 
        //        HttpContext.Current.Session ["global." + this.ID ]) + " is " + 
        //Convert.ToString ( 
        //        HttpContext.Current.Session ["global." + this.ID + "MyPageIndex"] ))  ;
        return System.Convert.ToInt16 (
        HttpContext.Current.Session["global." + this.ID + "MyPageIndex"] );

      } //eof get

      set
      {
        this.PageIndex = value;
        HttpContext.Current.Session["global." + this.ID + "MyPageIndex"] = value;
      }
    } //eof property MyPageIndex


    #endregion //GridViewSortExpression


    #region StrLabMsgText
    private string _StrLabMsgText;
    public string StrLabMsgText
    {
      get
      {
        //     //Utils.Debugger.WriteIf ( "The page index of gb with id " + Convert.ToString ( 
        //        HttpContext.Current.Session ["global." + this.ID ]) + " is " + 
        //Convert.ToString ( 
        //        HttpContext.Current.Session ["global." + this.ID + "StrLabMsgText"] ))  ;
        return System.Convert.ToString (
        HttpContext.Current.Session["global." + this.ID + "StrLabMsgText"] );

      } //eof get

      set
      {
        _StrLabMsgText = value;
        HttpContext.Current.Session["global." + this.ID + "StrLabMsgText"] = value;
      }
    } //eof property StrLabMsgText


    #endregion


    #region DataSourceCount
    private int _dataSourceCount;

    /// <summary>
    /// The total number of rows in the data source.
    /// </summary>
    [Browsable ( false )]
    public int DataSourceCount
    {
      get
      {
        if (this.Rows.Count == 0)
          return 0;
        else if (this.AllowPaging)
          return this._dataSourceCount;
        else
          return this.Rows.Count;
      }
      set
      {
        this._dataSourceCount = value;
      } //eof set 

    }
    #endregion


    #region ColumnNumberToGenerateLinksTo
    private int _ColumnNumberToGenerateLinksTo;

    /// <summary>
    /// The total number of rows in the data source.
    /// </summary>
    [Browsable ( false )]
    public int ColumnNumberToGenerateLinksTo
    {
      get
      {
        if (_ColumnNumberToGenerateLinksTo == null)
          return 0;
        else
          return _ColumnNumberToGenerateLinksTo;
      }
      set
      {
        this._ColumnNumberToGenerateLinksTo = value;
      } //eof set 

    }
    #endregion

    #region UrlToLinkTo
    private string _UrlToLinkTo;
    /// <summary>
    /// Whether the results summary should be shown.
    /// </summary>
    [DefaultValue ( true )]
    [Category ( "Appearance" )]
    [Description ( " Which is the link to link to." )]
    public string UrlToLinkTo
    {
      get
      {
        if (HttpContext.Current.Session["global." + this.ID + ".UrlToLinkTo"] == null)
          return String.Empty;
        else
          return (string)HttpContext.Current.Session["global." + this.ID + ".UrlToLinkTo"];
      }
      set { HttpContext.Current.Session["global." + this.ID + ".UrlToLinkTo"] = value; }
    }
    #endregion

    //#region ColNameToLinkAgainst
    //private string _ColNameToLinkAgainst;
    ///// <summary>
    ///// Whether the results summary should be shown.
    ///// </summary>
    //[DefaultValue ( true )]
    //[Category ( "Appearance" )]
    //[Description ( " Which is the Column Name to link Against." )]
    //public string ColNameToLinkAgainst
    //{
    //  get
    //  {
    //    if (HttpContext.Current.Session["global." + this.ID + ".ColNameToLinkAgainst"] == null)
    //      return String.Empty;
    //    else
    //      return (string)HttpContext.Current.Session["global." + this.ID + ".ColNameToLinkAgainst"];
    //  }
    //  set { HttpContext.Current.Session["global." + this.ID + ".ColNameToLinkAgainst"] = value; }
    //}
    //#endregion

    #region ShowResultSummary
    /// <summary>
    /// Whether the results summary should be shown.
    /// </summary>
    [DefaultValue ( true )]
    [Category ( "Appearance" )]
    [Description ( "Whether the results summary should be shown." )]
    public bool ShowResultSummary
    {
      get
      {

        if (HttpContext.Current.Session["global." + this.ID + ".ShowResultSummary"] == null)
          return false;
        else
          return (bool)HttpContext.Current.Session["global." + this.ID + ".ShowResultSummary"];
      }
      set { HttpContext.Current.Session["global." + this.ID + ".ShowResultSummary"] = value; }
    }
    #endregion


    #region AllowInserting
    /// <summary>
    /// Whether the GridView will allow rows to be inserted.
    /// </summary>
    [DefaultValue ( false )]
    [Category ( "Behavior" )]
    [Description ( "Whether the GridView will allow rows to be inserted." )]
    public bool AllowInserting
    {
      get
      {
        if (HttpContext.Current.Session["AllowInserting"] == null)
          return false;
        else
          return (bool)HttpContext.Current.Session["AllowInserting"];
      }
      set
      {
        if (this.AllowInserting != value)
          this.RequiresDataBinding = true;

        HttpContext.Current.Session["AllowInserting"] = value;
      }
    }
    #endregion


    #region InsertRowActive
    /// <summary>
    /// Whether the insert row is active.
    /// </summary>
    [DefaultValue ( true )]
    [Category ( "Appearance" )]
    [Description ( "Whether the insert row is active." )]
    public bool InsertRowActive
    {
      get
      {
        if (HttpContext.Current.Session["InsertRowActive"] == null)
          return true;
        return (bool)HttpContext.Current.Session["InsertRowActive"];
      }
      set
      {
        if (this.InsertRowActive != value)
          this.RequiresDataBinding = true;

        HttpContext.Current.Session["InsertRowActive"] = value;
      }
    }
    #endregion


    #region InsertRow
    private GridViewRow _insertRow;

    /// <summary>
    /// The row in the grid that contains the insert controls.
    /// </summary>
    [Browsable ( false )]
    public GridViewRow InsertRow
    {
      get { return this._insertRow; }
    }
    #endregion


    #region HeaderRow
    private GridViewRow _myHeaderRow;

    /// <summary>
    /// Gets the row in the grid that corresponds to the header.
    /// </summary>
    [Browsable ( false )]
    public override GridViewRow HeaderRow
    {
      get
      {
        if (this._myHeaderRow != null)
          return this._myHeaderRow;
        else
          return base.HeaderRow;
      }
    }
    #endregion


    #region MyDataSource
    private DataTable _MyDataSource;
    public DataTable MyDataSource
    {
      get
      {
        return (DataTable)( HttpContext.Current.Session["global." + this.ID + "MyDataSource"] );

      } //eof get

      set
      {
        this._MyDataSource = value;
        HttpContext.Current.Session["global." + this.ID + "MyDataSource"] = value;
      }
    } //eof property MyDataSource



    #endregion MyDataSource

    #region AscendingImageUrl
    /// <summary>
    /// Image that is displayed when <see cref="SortDirection"/> is ascending.
    /// </summary>
    //[Editor ( typeof ( ImageUrlEditor ), typeof ( UITypeEditor ) )]
    [Description ( "Image that is displayed when SortDirection is ascending." )]
    [Category ( "Appearance" )]
    public string AscendingImageUrl
    {
      get { return HttpContext.Current.Session["AscendingImageUrl"] as string; }
      set { HttpContext.Current.Session["AscendingImageUrl"] = value; }
    }
    #endregion


    #region DescendingImageUrl
    /// <summary>
    /// Image that is displayed when <see cref="SortDirection"/
    /// is descending.
    /// </summary>
    //[Editor ( typeof ( ImageUrlEditor ), typeof ( UITypeEditor ) )]
    [Description ( "Image that is displayed when SortDirection is descending." )]
    [Category ( "Appearance" )]
    public string DescendingImageUrl
    {
      get { return HttpContext.Current.Session["DescendingImageUrl"] as string; }
      set { HttpContext.Current.Session["DescendingImageUrl"] = value; }
    }
    #endregion


    #region TextProperty
    [Bindable ( true )]
    [Category ( "Appearance" )]
    [DefaultValue ( "" )]
    [Localizable ( true )]
    public string Text
    {
      get
      {
        String s = (String)HttpContext.Current.Session["Text"];
        return ( ( s == null ) ? "[" + "global." + this.ID + "]" : s );
      }

      set
      {
        HttpContext.Current.Session["Text"] = value;
      }
    }
    #endregion Text



    #region FirstRowColor
    [Bindable ( true )]
    [Category ( "Appearance" )]
    [DefaultValue ( "" )]
    [Localizable ( true )]
    public string FirstRowColor
    {
      get
      {
        return (String)HttpContext.Current.Session["FirstRowColor"];
      }

      set
      {
        HttpContext.Current.Session["FirsRowColor"] = value;
      }
    }
    #endregion FirsRowColor



    #endregion


    #region Instance members

    #region Events
    /// <summary>
    /// Fires before a row is inserted.
    /// </summary>
    [Category ( "Action" )]
    [Description ( "Fires before a row is inserted." )]
    public event EventHandler<GridViewInsertEventArgs> RowInserting;

    /// <summary>
    /// Fires after a row has been inserted.
    /// </summary>
    [Category ( "Action" )]
    [Description ( "Fires after a row has been inserted." )]
    public event EventHandler<GridViewInsertedEventArgs> RowInserted;


    /// <summary>
    /// Raises the <see cref="RowInserting"/> event.
    /// </summary>
    /// <param name="e">Event data.</param>
    protected virtual void OnRowInserting ( GridViewInsertEventArgs e )
    {
      if (this.RowInserting != null)
        this.RowInserting ( this, e );
      else if (!this.IsBoundUsingDataSourceID && !e.Cancel)
        throw new System.Web.HttpException ( string.Format ( "The GridView '{0}' fired event RowInserting which wasn't handled.", "global." + this.ID ) );
    }

    /// <summary>
    /// Raises the <see cref="RowInserted"/> event.
    /// </summary>
    /// <param name="e">Event data.</param>
    protected virtual void OnRowInserted ( GridViewInsertedEventArgs e )
    {
      if (this.RowInserted != null)
        this.RowInserted ( this, e );
    }

    protected override void OnSorting ( GridViewSortEventArgs e )
    {
      //Utils.Debugger.WriteIf ( "OnSorting START" );
      GridViewSortExpression = e.SortExpression;
      //int pageIndex = this.PageIndex;
      int pageIndex = this.MyPageIndex;

      //    this.DataBind ( ); //databind again after sorting
      //Utils.Debugger.WriteIf ( "From OnSorting" );
      //this.PageSize = this.GvPageSize;
      //this.PageSize = 15; 
      //variant this.PageIndex = pageIndex;
      this.MyPageIndex = pageIndex;


      //variant this.CreateBottomSummary ( );
      this.DataSource = SortDataTable ( this.DataSource as DataTable, false );

      this.DataBind ();

      //base.OnSorting ( e );
    }



    protected override void OnDataBinding ( EventArgs e )
    {
      //DEBUG//Utils.Debugger.WriteIf ( "OnDataBionding start " );
      //int newSetPageSize = this.GetPagerSize ( );
      //Utils.Debugger.WriteIf ( "From OnDataBinding" );
      //this.GvPageSize = newSetPageSize;

      base.OnDataBinding ( e );

    } //eof method OnDataBinding


    #endregion    //W
    /// <summary>
    /// Create the pager.
    /// </summary>
    /// <param name="row">The pager row.</param>
    /// <param name="columnSpan">The number of columns the pager should span.</param>
    /// <param name="pagedDataSource">The data source.</param>
    protected override void InitializePager ( GridViewRow row, int columnSpan,
      PagedDataSource pagedDataSource )
    {
      //DEBUG//Utils.Debugger.WriteIf ( "Initialize Pager START" );
      // Nab total row count from data source



      #region GenericNumberPager

      #region Preparation
      this.DataSourceCount = pagedDataSource.DataSourceCount; ;
      HtmlGenericControl pageControls = new HtmlGenericControl ( "div" );
      pageControls.Style.Add ( "max-width", "100%" );
      pageControls.Style.Add ( HtmlTextWriterStyle.FontSize, "medium" );

      // Create table cell for pager
      TableCell cell = new TableCell ();
      cell.ColumnSpan = columnSpan;
      cell.Controls.Clear ();


      //variant AddSomeFontStyle pageControls.Style.Add ( HtmlTextWriterStyle.FontFamily, "webdings" );
      pageControls.Style.Add ( HtmlTextWriterStyle.FontSize, "medium" );
      pageControls.Style.Add ( "float", "left" );
      #endregion Preparation


      #region AddTheFirstLink
      LinkButton lnkFirst = new LinkButton ();
      lnkFirst.ID = "lnkFirst";
      lnkFirst.ToolTip = "Click here to open the First page";
      lnkFirst.CausesValidation = false;
      lnkFirst.Text = "First Page";
      lnkFirst.CommandName = "Page";
      lnkFirst.CommandArgument = "first";
      //variant lnkFirst.Enabled = (this.PageIndex != 0);
      lnkFirst.Enabled = ( this.PageIndex != 0 );
      pageControls.Controls.Add ( lnkFirst );
      pageControls.Controls.Add ( new LiteralControl ( "&nbsp;&nbsp; " ) );
      #endregion AddTheFirstLink


      #region AddThePreviousPageLink
      LinkButton lnkPrevious = new LinkButton ();
      lnkPrevious.ID = "lnkPrevious";
      lnkPrevious.ToolTip = "Click to open the Previous page";
      lnkPrevious.CausesValidation = false;
      lnkPrevious.Text = "Previous Page";
      lnkPrevious.CommandName = "Page";
      lnkPrevious.CommandArgument = "Prev";
      lnkPrevious.Enabled = lnkFirst.Enabled;
      pageControls.Controls.Add ( lnkPrevious );
      pageControls.Controls.Add ( new LiteralControl ( "&nbsp;" ) );

      #endregion AddTheNextPageLink


      #region AddTheNumbersForPaging

      int intNumOfPages = System.Convert.ToInt16 ( this.DataSourceCount / this.PageSize );
      int intCurrentPageIndex = this.MyPageIndex;
      int intSizeAdjuster = 0;
      int intPreviousTenPages = 0;
      int intNextTenPages = 0;
      bool flagDoCreatePagerLink = false;



      #region AddThePreviousTenPageLink
      intPreviousTenPages = intCurrentPageIndex - 10;
      if (intPreviousTenPages <= 0)
        intPreviousTenPages = 0;

      if (intPreviousTenPages != 0)
      {
        LinkButton lnkPreviousTen = new LinkButton ();
        lnkPreviousTen.ID = "lnkPreviousTen";
        lnkPreviousTen.ToolTip = "Click to open the Previous 10 pages";
        lnkPreviousTen.CausesValidation = false;
        lnkPreviousTen.Text = "-10...";
        lnkPreviousTen.CommandName = "Page";
        lnkPreviousTen.CommandArgument = intPreviousTenPages.ToString ();
        lnkPreviousTen.Enabled = lnkFirst.Enabled;
        pageControls.Controls.Add ( lnkPreviousTen );
        pageControls.Controls.Add ( new LiteralControl ( "&nbsp;" ) );
      }
      #endregion AddThePreviousTenPageLink


      #region IfThereIsOnlyOneItemItBehavesDifferently
      if (this.PageSize == 1)
        intSizeAdjuster = 0;
      else
        intSizeAdjuster = 1;
      #endregion IfThereIsOnlyOneItemItBehavesDifferently

      #region LoopTroughPageNumbers
      for (int i = 0; i < intNumOfPages + intSizeAdjuster; i++)
      {
        #region IfThePagerHasMoreThan2*10Pages
        if (intNumOfPages >= 2 * 10)
        {
          if (intCurrentPageIndex <= 10)
          {
            if (i <= intCurrentPageIndex + 10)
              flagDoCreatePagerLink = true;
            else
              flagDoCreatePagerLink = false;

            //else do nothing 

          } //eof if ( intCurrentPageIndex <= 10)
          else if (intCurrentPageIndex <= intNumOfPages - 10)
          {
            if (i >= intCurrentPageIndex - 10 && i <= intCurrentPageIndex + 10)
              flagDoCreatePagerLink = true;
            else
              flagDoCreatePagerLink = false;

          }
          else if (intCurrentPageIndex > intNumOfPages - 10)
          {
            if (i <= intCurrentPageIndex && i >= intCurrentPageIndex - 10)
              flagDoCreatePagerLink = true;
            else if (i > intCurrentPageIndex)
              flagDoCreatePagerLink = true;
            else
              flagDoCreatePagerLink = false;
          }

          #region AddThePageNumberPagerLink
          if (flagDoCreatePagerLink == true)
          {

            LinkButton lbPager = new LinkButton ();
            lbPager.ID = i.ToString ();

            lbPager.CommandName = "Page";
            lbPager.CausesValidation = false;
            lbPager.CommandArgument = ( i + 1 ).ToString ();
            lbPager.Text = ( i + 1 ).ToString ();
            //disable the links for the current page
            if (intCurrentPageIndex == i)
            {
              lbPager.ToolTip = "This is the current active page";
              lbPager.Enabled = false;
            }

            pageControls.Controls.Add ( lbPager );
            pageControls.Controls.Add ( new LiteralControl ( "&nbsp;&nbsp; " ) );

          }
          #endregion AddThePageNumberPagerLink
        } //eof if (intNumOfPages > 20)
        #endregion IfThePagerHasMoreThan2*10Pages

        else
        {
          #region AddThePageNumberPagerLink
          LinkButton lbPager = new LinkButton ();
          lbPager.ID = i.ToString ();

          lbPager.CommandName = "Page";
          lbPager.CausesValidation = false;
          lbPager.CommandArgument = ( i + 1 ).ToString ();
          lbPager.Text = ( i + 1 ).ToString ();
          //disable the links for the current page
          if (intCurrentPageIndex == i)
          {
            lbPager.ToolTip = "This is the current active page";
            lbPager.Enabled = false;
          }

          pageControls.Controls.Add ( lbPager );
          pageControls.Controls.Add ( new LiteralControl ( "&nbsp;&nbsp; " ) );
          #endregion AddThePageNumberPagerLink
        } //else if ( intNumOfPages > 10 ) 

      } //eof for 
      #endregion LoopTroughPageNumbers

      #endregion AddTheNumbersForPaging


      #region AddTheNextPageLink
      LinkButton lnkNext = new LinkButton ();
      lnkNext.ID = "lnkNext";
      lnkNext.ToolTip = "Next page";
      lnkNext.CausesValidation = false;
      lnkNext.Text = "Next Page";
      lnkNext.CommandName = "Page";
      lnkNext.CommandArgument = "Next";
      //variant lnkNext.Enabled = (this.PageIndex < (this.PageCount - 1));
      lnkNext.Enabled = ( this.PageIndex < ( this.PageCount - 1 ) );
      pageControls.Controls.Add ( lnkNext );
      pageControls.Controls.Add ( new LiteralControl ( "&nbsp;&nbsp; " ) );
      #endregion AddTheNextPageLink

      #region AddTheNextTenPagesLink

      intNextTenPages = intCurrentPageIndex + 10;
      if (intNextTenPages >= intNumOfPages)
        intNextTenPages = intNumOfPages;

      if (intNextTenPages != intNumOfPages)
      {
        LinkButton lnkNextTen = new LinkButton ();
        lnkNextTen.ID = "lnkNextTen";
        lnkNextTen.ToolTip = "Next page";
        lnkNextTen.CausesValidation = false;
        lnkNextTen.Text = "..+10";
        lnkNextTen.CommandName = "Page";
        lnkNextTen.CommandArgument = intNextTenPages.ToString (); ;
        //variant lnkNextTen.Enabled = (this.PageIndex < (this.PageCount - 1));
        lnkNextTen.Enabled = ( this.PageIndex < ( this.PageCount - 1 ) );
        pageControls.Controls.Add ( lnkNextTen );
        pageControls.Controls.Add ( new LiteralControl ( "&nbsp;&nbsp; " ) );
      }
      #endregion AddTheNextPageLink

      #region AddTheLastLink
      LinkButton lnkLast = new LinkButton ();
      lnkLast.ID = "lnkLast";
      lnkLast.ToolTip = "Click here to open the Last page";
      lnkLast.CausesValidation = false;
      lnkLast.Text = "Last Page";
      lnkLast.CommandName = "Page";
      lnkLast.CommandArgument = "Last";
      lnkLast.Enabled = ( this.PageIndex < ( this.PageCount - 1 ) );
      pageControls.Controls.Add ( lnkLast );
      pageControls.Controls.Add ( new LiteralControl ( "&nbsp;&nbsp; " ) );
      #endregion AddTheLastLink


      cell.Controls.Add ( pageControls );
      // Add the cell to pager row
      row.Cells.Add ( cell );



      #region CopyPaste
      //pageControls.Controls.Add ( lnkFirst );
      //pageControls.Controls.Add ( new LiteralControl ( "&nbsp;&nbsp; " ) );
      //LinkButton lnkPrevious = new LinkButton ();
      //lnkPrevious.ID = "lnkPrevious";
      //lnkPrevious.ToolTip = "Previous page";
      //lnkPrevious.CausesValidation = false;
      //lnkPrevious.Text = "<<";
      //lnkPrevious.CommandName = "Page";
      //lnkPrevious.CommandArgument = "Prev";
      //lnkPrevious.Enabled = lnkFirst.Enabled;
      //pageControls.Controls.Add ( lnkPrevious );
      //pageControls.Controls.Add ( new LiteralControl ( "&nbsp;" ) );
      //LinkButton lnkNext = new LinkButton ();
      //lnkNext.ID = "lnkNext";
      //lnkNext.ToolTip = "Next page";
      //lnkNext.CausesValidation = false;
      //lnkNext.Text = ">>";
      //lnkNext.CommandName = "Page";
      //lnkNext.CommandArgument = "Next";
      ////variant lnkNext.Enabled = (this.PageIndex < (this.PageCount - 1));
      //lnkNext.Enabled = ( this.PageIndex < ( this.PageCount - 1 ) );
      //pageControls.Controls.Add ( lnkNext );
      //pageControls.Controls.Add ( new LiteralControl ( "&nbsp;&nbsp; " ) );
      //LinkButton lnkLast = new LinkButton ();
      //lnkLast.ID = "lnkLast";
      //lnkLast.ToolTip = "Last page";
      //lnkLast.CausesValidation = false;
      //lnkLast.Text = "last";
      //lnkLast.CommandName = "Page";
      //lnkLast.CommandArgument = "Last";
      //lnkLast.Enabled = lnkNext.Enabled;
      //pageControls.Controls.Add ( lnkLast );
      #endregion CopyPaste
      // Add pager controls to cell1



      #endregion GenericNumberPager

      //variant this.CreateBottomSummary ( );
    }


    protected override void OnInit ( EventArgs e )
    {
      base.OnInit ( e );
      //Utils.Debugger.WriteIf ( "XGrid.cs OnInit START" );
      //this.GvPageSize = 20;
      this.PageIndex = this.MyPageIndex;
    } //eof method 

    protected override void LoadControlState ( object savedState )
    {
      base.LoadControlState ( savedState );
    }

    private void CreateBottomSummary ()
    {
      //Utils.Debugger.WriteIf ( "XGrid.cs CreateBottomSummary START" );
      if (this.ShowResultSummary && this.PageCount != 0)
      {
        //Utils.Debugger.WriteIf ( " after if " );
        // Create summary controls
        //variant org 
        //variant int firstResultIndex = this.PageIndex * this.PageSize;
        int firstResultIndex = this.PageIndex * this.PageSize;

        //DEBUG//Utils.Debugger.WriteIf ( "From CreateBottomSummary" );
        //variant gets null each 2 time int firstResultIndex = this.PageIndex * this.GvPageSize; 
        HtmlGenericControl topSummaryControl = new HtmlGenericControl ( "div" );
        topSummaryControl.Style.Add ( "float", "left" );
        topSummaryControl.InnerHtml = string.Format ( "Showing records <strong> from </strong>" +
        "{0} <strong> to </strong> {1} out of {2}   ", firstResultIndex + 1,
        firstResultIndex + this.Rows.Count, this.DataSourceCount ); //add + " with " 
        HtmlGenericControl bottomSummaryControl = new HtmlGenericControl ( "div" );
        bottomSummaryControl.Style.Add ( "float", "left" );
        bottomSummaryControl.InnerHtml = topSummaryControl.InnerHtml;


        #region AddHererTextBox
        ////ADD HERE TEXTBOX START 
        ////====================================Add here the paging textbox START
        //TextBox txtgv = new TextBox ( );
        //txtgv.ID= "global." + this.ID.ToString ( ) + "txtgv";
        //txtgv.Visible = true;
        //txtgv.Width = new Unit ( 20, UnitType.Pixel );
        //txtgv.Font.Size = new FontUnit ( FontSize.XSmall );
        //Utils.Debugger.WriteIf ( "From CreateBottomSummary2" );
        //txtgv.Text = System.Convert.ToString ( this.GvPageSize );
        //txtgv.EnableViewState = true;
        ////ASSIGN EVENT HANDLERS DURING CREATE CHILD CONTROLS 
        ////txtgv.TextChanged += new EventHandler ( this.ClickSetPageSize );
        //Button butPageSetter = new Button ( );
        //butPageSetter.ID = "butPageSetter";
        //butPageSetter.Text = " per page ";
        //butPageSetter.Click += new EventHandler ( this.ClickSetPageSize );
        ////txtgv.TextChanged += new EventHandler ( txtgv_TextChanged );
        //bottomSummaryControl.Controls.Add ( txtgv );
        //bottomSummaryControl.Controls.Add ( butPageSetter );
        ////====================================Add here the paging textbox END
        #endregion //AddHererTextBox


        if (this.PageCount == 1)
        {
          // Add summary to table at the top
          this.Controls[0].Controls.AddAt ( 0, this.CreateSummaryRow ( topSummaryControl ) );
          // Add summary to table at the bottom
          this.Controls[0].Controls.Add ( this.CreateSummaryRow ( bottomSummaryControl ) );
          //variant bottom this.Controls.Add ( this.CreateSummaryRow ( bottomSummaryControl ) );
        } //eof if
        else
        {
          // Add summary control to top pager
          if (this.TopPagerRow != null)
            this.TopPagerRow.Cells[0].Controls.Add ( topSummaryControl );
          // Add summary control to bottom pager
          if (this.BottomPagerRow != null)
            this.BottomPagerRow.Cells[0].Controls.Add ( bottomSummaryControl );
        } //eof else 
      } //eof if ( this.ShowResultSummary && this.PageCount != 0 )

      //variant base.PageSize = this.GvPageSize; 
    }

    /// <summary>
    /// Creates the control's child controls.
    /// </summary>
    protected override int CreateChildControls ( IEnumerable dataSource, bool dataBinding )
    {
      int controlsCreated = base.CreateChildControls ( dataSource, dataBinding );
      if (this.DisplayInsertRow)
      {
        ICollection cols = this.CreateColumns ( null, false );
        DataControlField[] fields = new DataControlField[cols.Count];
        cols.CopyTo ( fields, 0 );
        if (this.Controls.Count == 0)
        {
          // Create dummy table for inserting the first entry
          Table tableControl = new Table ();
          if (this.ShowHeader)
          {
            // Create header
            this._myHeaderRow = this.CreateRow ( -1, -1, DataControlRowType.Header, DataControlRowState.Normal );
            this.InitializeRow ( this._myHeaderRow, fields );
            // Trigger events
            GridViewRowEventArgs headerRowArgs = new GridViewRowEventArgs ( this._myHeaderRow );
            this.OnRowCreated ( headerRowArgs );
            tableControl.Rows.Add ( this._myHeaderRow );
            if (dataBinding)
              this.OnRowDataBound ( headerRowArgs );
          }
          // Add insert row
          this.Controls.Add ( tableControl );


        }
        else
          // Use generated header row
          this._myHeaderRow = null;

        // Create insertion row
        this._insertRow = this.CreateRow ( -1, -1, DataControlRowType.DataRow, this.InsertRowActive ? DataControlRowState.Insert : DataControlRowState.Normal );
        this._insertRow.ControlStyle.MergeWith ( this.AlternatingRowStyle );
        this.InitializeRow ( this._insertRow, fields );

        // Trigger events
        GridViewRowEventArgs insertRowArgs = new GridViewRowEventArgs ( this._insertRow );
        this.OnRowCreated ( insertRowArgs );

        // Add row to top of table, just below header
        this.Controls[0].Controls.AddAt ( this.Controls[0].Controls.IndexOf ( this.HeaderRow ) + 1, this._insertRow );
        if (dataBinding)
          this.OnRowDataBound ( insertRowArgs );
      }

      this.CreateBottomSummary ();
      return controlsCreated;
    } //eof CreateChildControls

    /// <summary>
    /// Initialises a row in the grid.
    /// </summary>
    /// <param name="row">The row to initialise.</param>
    /// <param name="fields">The fields with which to initialise the row.</param>
    protected override void InitializeRow ( GridViewRow row, DataControlField[] fields )
    {
      base.InitializeRow ( row, fields );

      if (row.RowType == DataControlRowType.Header && this.AscendingImageUrl != null)
      {




        for (int i = 0; i < fields.Length; i++)
        {
          if (this.SortExpression.Length > 0 && fields[i].SortExpression == this.SortExpression)
          {
            // Add sort indicator
            Image sortIndicator = new Image ();
            sortIndicator.ImageUrl = this.SortDirection == SortDirection.Ascending ? this.AscendingImageUrl : this.DescendingImageUrl;
            sortIndicator.Style.Add ( HtmlTextWriterStyle.VerticalAlign, "TextTop" );
            row.Cells[i].Controls.Add ( sortIndicator );
            break;
          }
        }
      }

      foreach (TableCell cell in row.Cells)
      {
        // If we have an insert button it should only be shown on the insert row
        foreach (Control control in cell.Controls)
        {
          IButtonControl button = control as IButtonControl;
          if (row == this._insertRow)
          {
            if (row.RowState == DataControlRowState.Normal)
            {
              // Hide all controls other than the insert button on the insert row
              control.Visible = false;
              if (button != null && ( button.CommandName == "Insert" || button.CommandName == "New" ))
                control.Visible = true;
            }
            else if (button != null && button.CommandName == "Cancel")
              // Hide cancel button on insert row
              control.Visible = false;
          }
          else if (button != null && button.CommandName == "New")
            // Hide the insert button from all other rows
            control.Visible = false;
        }
      }
    }

    private IOrderedDictionary _insertValues;

    private bool HandleInsertCallback ( int affectedRows, Exception ex )
    {
      GridViewInsertedEventArgs e = new GridViewInsertedEventArgs ( this._insertValues, ex );
      this.OnRowInserted ( e );
      if (ex != null && !e.ExceptionHandled)
        return false;

      this.RequiresDataBinding = true;
      return true;
    }

    /// <summary>
    /// Raises the <see cref="GridView.RowCommand"/> event.
    /// </summary>
    /// <param name="e">Event data.</param>
    protected override void OnRowCommand ( GridViewCommandEventArgs e )
    {
      base.OnRowCommand ( e );
      if (e.CommandName == "New")
      {
        this.InsertRowActive = true;
        this.EditIndex = -1;
        this.RequiresDataBinding = true;
      }
      else if (e.CommandName == "Edit")
        this.InsertRowActive = false;
      else if (e.CommandName == "Insert")
      {
        // Perform validation if necessary
        bool doInsert = true;
        IButtonControl button = e.CommandSource as IButtonControl;
        if (button != null)
        {
          if (button.CausesValidation)
          {
            this.Page.Validate ( button.ValidationGroup );
            doInsert = this.Page.IsValid;
          }
        }

        if (doInsert)
        {
          // Get values
          this._insertValues = new OrderedDictionary ();
          this.ExtractRowValues ( this._insertValues, this._insertRow, true, false );
          GridViewInsertEventArgs insertArgs = new GridViewInsertEventArgs ( this._insertRow, this._insertValues );
          this.OnRowInserting ( insertArgs );
          if (!insertArgs.Cancel && this.IsBoundUsingDataSourceID)
          {
            // Get data source
            DataSourceView data = this.GetData ();
            data.Insert ( this._insertValues, this.HandleInsertCallback );
          }
        }
      }
    }  //eof method OnRowCommand

    protected override void OnRowUpdating ( GridViewUpdateEventArgs e )
    {
      base.OnRowUpdating ( e );
    }

    protected override void OnPageIndexChanging ( GridViewPageEventArgs e )
    {
      this.DataSource = this.SortDataTable ( this.DataSource as DataTable, true );
      //this.PageIndex = e.NewPageIndex;
      this.MyPageIndex = e.NewPageIndex;

      //Utils.Debugger.WriteIf ( "From OnPageIndexChanging" );

      this.DataBind (); //databind again after sorting            
    } //eof method 



    protected override void DataBind ( bool raiseOnDataBinding )
    {
      //this.PageSize = this.GetPagerSize ( );
      //this.PageSize = this.GvPageSize; 

      base.DataBind ( raiseOnDataBinding );
      this.PageIndex = this.MyPageIndex;
    }
    /// <summary>
    /// Renders the contents of the control.
    /// </summary>
    /// <param name="writer">The <see cref="HtmlTextWriter"/> to write to.</param>
    protected override void RenderContents ( HtmlTextWriter writer )
    {
      if (String.IsNullOrEmpty ( this.StrLabMsgText ) == false)
      {
        writer.WriteBeginTag ( "div" );
        writer.WriteBeginTag ( "p" );
        writer.Write ( this.StrLabMsgText );
        writer.WriteEndTag ( "p" );

        writer.WriteEndTag ( "div" );
      }
      base.RenderContents ( writer );
    } //eof method RenderContents



    //OLD private TableRow CreateSummaryRow ( Control summaryControl )
    //{
    //  TableRow summaryRow = new TableRow ( );
    //  TableCell summaryCell = new TableCell ( );
    //  summaryCell.ColumnSpan = this.HeaderRow.Cells.Count;
    //  summaryRow.Cells.Add ( summaryCell );
    //  summaryCell.Controls.Add ( summaryControl );

    //  return summaryRow;
    //} //eof method CreateSummaryRow

    private GridViewRow CreateSummaryRow ( Control summaryControl )
    {
      GridViewRow summaryRow = new GridViewRow ( 0, 0, DataControlRowType.EmptyDataRow, DataControlRowState.Normal );
      TableCell summaryCell = new TableCell ();
      summaryCell.ColumnSpan = this.HeaderRow.Cells.Count;
      summaryRow.Cells.Add ( summaryCell );
      summaryCell.Controls.Add ( summaryControl );

      return summaryRow;
    } //eof method CreateSummaryRow


    protected override void OnRowCreated ( GridViewRowEventArgs e )
    {
      //Utils.Debugger.WriteIf ( "START --- XGrid -- OnRowCreated" );
      base.OnRowCreated ( e );

      #region HideColumnsSetToBeHidden
      System.Collections.Specialized.ListDictionary ld = this.Ld;
      if (ld != null)
      {
        for (int i = 0; i < e.Row.Cells.Count; i++)
        {
          string key;
          int intColNumberToHide;


          if (i < 9)
            key = "0" + i.ToString () + "HideColumn";
          else
            key = i.ToString () + "HideColumn";

          if (key != null && ld != null && ld[key] != null && String.IsNullOrEmpty ( ld[key].ToString () ) == false)
          {
            #region TryToGetANumber
            try
            {
              intColNumberToHide = System.Convert.ToInt16 ( ld[key] );
              if (intColNumberToHide == 1)
              {
                e.Row.Cells[i].Visible = false;
              }
              else
              {
                //do nothing by default all this.columns are visible !!!                                
              }
            }
            #endregion TryToGetANumber
            #region CatchExceptions
            catch (Exception ex)
            {

            }
            #endregion CatchExceptions
          } //eof if (String.IsNullOrEmpty ( ld[key].ToString() ) == false)
        }
      } //eof if (ld != null)
      #endregion HideColumnsSetToBeHidden

      if (e.Row.RowType == DataControlRowType.DataRow)
      {
        if (( e.Row.RowIndex % 2 ) == 0)
          e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml ( "#EFEFEF" );
      } //eof if 
      //Utils.Debugger.WriteIf ( "END --- XGrid -- OnRowCreated" );
    } //eof method 



    protected override void OnDataBound ( EventArgs e )
    {
      base.OnDataBound ( e );

    }

    protected override void OnRowDataBound ( GridViewRowEventArgs e )
    {


      //Utils.Debugger.WriteIf ( "START --- XGrid --- OnRowDataBound" );
      base.OnRowDataBound ( e );

            

      
      if (e.Row.RowType == DataControlRowType.Header)
      {

      }

    } //eof method 


    private bool DisplayInsertRow
    {
      get { return this.AllowInserting && this.PageIndex == 0; }
    }
    #endregion


    #region TemplateMethods
    protected override object SaveViewState ()
    {
      return new Pair ( base.SaveViewState (), null );
    }

    protected override void LoadViewState ( object savedState )
    {
      base.LoadViewState ( ( (Pair)savedState ).First );
      EnsureChildControls ();
    }

    protected override void CreateChildControls ()
    {
      base.CreateChildControls ();
    }

    #endregion //TemplateMethods


    #region UtilityMethods

    /// <summary>
    /// Search for a control within the passed root control by the control id passed as string
    /// </summary>
    /// <param name="root">the upper control to start to search for</param>
    /// <param name="id">the id of the control as string</param>
    /// <returns></returns>
    private Control FindControlRecursively ( Control root, string id )
    {
      try
      {
        if (root.ID == id)
        {
          return root;
        } //eof if

        foreach (Control c in root.Controls)
        {
          Control t = this.FindControlRecursively ( c, id );
          if (t != null)
          {
            return t;
          } //eof if
        } //eof foreach
      } //eof try 
      catch (Exception e)
      {
        //Utils.Debugger.WriteIf ( "The following Exception occured : \n" + e.Message );
        return null;
      } //eof catch

      return null;
    } //eof FindControlRecursive


    protected DataView SortDataTable ( DataTable dataTable, bool isPageIndexChanging )
    {
      //Utils.Debugger.WriteIf ("SortDataTable(DataTable dataTable, bool isPageIndexChanging) START");
      if (dataTable != null)
      {
        DataView dataView = new DataView ( dataTable );
        if (GridViewSortExpression != string.Empty)
        {
          try
          {

            if (isPageIndexChanging)
            {
              dataView.Sort = string.Format ( "{0} {1}", GridViewSortExpression, GridViewSortDirection );
            }
            else
            {
              dataView.Sort = string.Format ( "{0} {1}", GridViewSortExpression, GetSortDirection () );
            }
          }
          catch (Exception e)
          {

          }
        }
        return dataView;
      }
      else
      {
        return new DataView ();
      }
    } //eof method SortDataTable

    #endregion //UtilityMethods


  } //eof class 


  /// <summary>
  /// Provides data for the <see cref="ExtendedGridView.RowInserting"/> event.
  /// </summary>
  public class GridViewInsertEventArgs : CancelEventArgs
  {
    #region Constructor
    /// <summary>
    /// Initialises a <see cref="GridViewInsertEventArgs"/>.
    /// </summary>
    /// <param name="row">The insertion row.</param>
    /// <param name="newValues">The values for the new row.</param>
    public GridViewInsertEventArgs ( GridViewRow row, IOrderedDictionary newValues )
    {
      this._row = row;
      this._values = newValues;
    }
    #endregion

    #region Properties

    #region Row
    private GridViewRow _row;

    /// <summary>
    /// The row containing the input controls.
    /// </summary>
    public GridViewRow Row
    {
      get { return this._row; }
    }
    #endregion

    #region NewValues
    private IOrderedDictionary _values;

    /// <summary>
    /// The values for the new row to insert.
    /// </summary>
    public IOrderedDictionary NewValues
    {
      get { return this._values; }
    }
    #endregion

    #endregion
  }

  /// <summary>
  /// Provides data for the <see cref="ExtendedGridView.RowInserted"/> delegate.
  /// </summary>
  public class GridViewInsertedEventArgs : EventArgs
  {
    #region Constructor
    /// <summary>
    /// Initialises a <see cref="GridViewInsertedEventArgs"/>.
    /// </summary>
    /// <param name="newValues">The values for the new row.</param>
    /// <param name="ex">The exception that occurred during the insert, if any.</param>
    public GridViewInsertedEventArgs ( IOrderedDictionary newValues, Exception ex )
    {
      this._values = newValues;
      this._exception = ex;
    }
    #endregion

    #region Properties

    #region NewValues
    private IOrderedDictionary _values;

    /// <summary>
    /// The values that were inserted into the new row.
    /// </summary>
    public IOrderedDictionary NewValues
    {
      get { return this._values; }
    }
    #endregion

    #region Exception
    private Exception _exception;

    /// <summary>
    /// The exception that occurred during the insert, if any.
    /// </summary>
    public Exception Exception
    {
      get { return this._exception; }
    }
    #endregion

    #region ExceptionHandled
    private bool _exceptionHandled;

    /// <summary>
    /// Whether the exception that occurred during the insert has been handled.
    /// </summary>
    public bool ExceptionHandled
    {
      get { return this._exceptionHandled; }
      set { this._exceptionHandled = value; }
    }
    #endregion

    #endregion
  } //eof class GridViewInsertedEventArgs
} //eof namespace Controls

No comments:

Post a Comment

- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!

Labels

perl (41) Cheat Sheet (25) how-to (24) windows (14) sql server 2008 (13) linux (12) oracle (12) sql (12) Unix (11) cmd windows batch (10) mssql (10) cmd (9) script (9) textpad (9) netezza (8) sql server 2005 (8) cygwin (7) meta data mssql (7) metadata (7) bash (6) code generation (6) Informatica (5) cheatsheet (5) energy (5) tsql (5) utilities (5) excel (4) future (4) generic (4) git cheat sheet (4) html (4) perl modules (4) programs (4) settings (4) sh (4) shortcuts (4) поуки (4) принципи (4) Focus Fusion (3) Solaris (3) cool programs (3) development (3) economy (3) example (3) freeware (3) fusion (3) logging (3) morphus (3) mssql 2005 (3) nuclear (3) nz (3) parse (3) python (3) sftp (3) sofware development (3) source (3) sqlplus (3) table (3) vim (3) .Net (2) C# (2) China (2) GUI (2) Google (2) GoogleCL (2) Solaris Unix (2) architecture (2) ascii (2) awk (2) batch (2) cas (2) chrome extensions (2) code2html (2) columns (2) configuration (2) conversion (2) duplicates (2) excel shortcuts (2) export (2) file (2) free programs (2) informatica sql repository (2) linux cheat sheet (2) mssql 2008 (2) mysql (2) next big future (2) nsis (2) nz netezza cheat sheet (2) nzsql (2) ora (2) prediction (2) publish (2) release management (2) report (2) security (2) single-click (2) sqlserver 2005 (2) sqlserver 2008 (2) src (2) ssh (2) template (2) tools (2) vba (2) video (2) xlt (2) xml (2) youtube videos (2) *nix (1) .vimrc (1) .virmrc vim settings configs (1) BSD license (1) Bulgaria (1) Dallas (1) Database role (1) Dense plasma focus (1) Deployment (1) ERP (1) ExcelToHtml (1) GD (1) GDP (1) HP-UX (1) Hosting (1) IDEA (1) INC (1) IT general (1) ITIL management bullshit-management (1) IZarc (1) Java Web Start (1) JavaScript anchor html jquery (1) Khan Academy (1) LINUX UNIX BASH AND CYGWIN TIPS AND TRICKS (1) Linux Unix rpm cpio build install configure (1) Linux git source build .configure make (1) ListBox (1) MIT HYDROGEN VIRUS (1) OO (1) Obama (1) PowerShell (1) Run-time (1) SDL (1) SIWA (1) SOX (1) Scala (1) Services (1) Stacks (1) SubSonic (1) TED (1) abstractions (1) ansible hosts linux bash (1) ansible linux deployment how-to (1) ansible yum pip python (1) apache (1) apache 2.2 (1) application life cycle (1) architecture input output (1) archive (1) arguments (1) avatar (1) aws cheat sheet cli (1) aws cli (1) aws cli amazon cheat sheet (1) aws elb (1) backup (1) bash Linux open-ssh ssh ssh_server ssh_client public-private key authentication (1) bash perl search and replace (1) bash stub (1) bin (1) biofuels (1) biology (1) books (1) browser (1) bubblesort (1) bugs (1) build (1) byte (1) cas_sql_dev (1) chennai (1) chrome (1) class (1) claut (1) cmdow (1) code generation sqlserver (1) command (1) command line (1) conf (1) confluence (1) console (1) convert (1) cool programs windows free freeware (1) copy paste (1) copy-paste (1) csv (1) ctags (1) current local time (1) cygwin X11 port-forwarding mintty xclock Linux Unix X (1) cygwin bash how-to tips_n_tricks (1) cygwin conf how-to (1) data (1) data types (1) db2 cheat sheet (1) db2 starter ibm bash Linux (1) debt (1) diagram (1) dictionaries (1) digital (1) disk (1) disk space (1) documentation (1) dos (1) dubai (1) e-cars (1) electric cars (1) electricity (1) emulate (1) errors (1) exponents (1) export workflow (1) extract (1) fast export (1) fexp (1) file extension (1) file permissions (1) findtag (1) firewall (1) for loop (1) freaky (1) functions (1) fusion research (1) german (1) git gitlab issues handling system (1) google cli (1) google code (1) google command line interface (1) gpg (1) ha (1) head (1) helsinki (1) history (1) hop or flop (1) host-independant (1) how-to Windows cmd time date datetime (1) ibm db2 cognos installation example db deployment provisioning (1) ideas (1) image (1) informatica oracle sql (1) informatica repo sql workflows sessions file source dir (1) informatica source files etl (1) install (1) isg-pub issue-tracker architecture (1) it management best practices (1) java (1) jump to (1) keyboard shortcuts (1) ksh (1) level (1) linkedin (1) linux bash ansible hosts (1) linux bash commands (1) linux bash how-to shell expansion (1) linux bash shell grep xargs (1) linux bash tips and t ricks (1) linux bash unix cygwin cheatsheet (1) linux bash user accounts password (1) linux bash xargs space (1) linux cheat-sheet (1) linux cheatsheet cheat-sheet revised how-to (1) linux how-to non-root vim (1) linux ssh hosts parallel subshell bash oneliner (1) london (1) make (1) me (1) metacolumn (1) metadata functions (1) metaphonre (1) method (1) model (1) movie (1) multithreaded (1) mysql cheat sheet (1) mysql how-to table datatypes (1) n900 (1) nano (1) neteza (1) netezza bash linux nps (1) netezza nps (1) netezza nps nzsql (1) netezza nz Linux bash (1) netezza nz bash linux (1) netezza nz nzsql sql (1) netezza nzsql database db sizes (1) non-password (1) nord pol (1) nps backup nzsql schema (1) number formatting (1) nz db size (1) nz table count rows (1) nzsql date timestamp compare bigint to_date to_char now (1) on-lier (1) one-liners (1) one-to-many (1) oneliners (1) open (1) open source (1) openrowset (1) openssl (1) oracle PL/SQL (1) oracle Perl perl (1) oracle installation usability (1) oracle number formatting format-model ora-sql oracle (1) oracle templates create table (1) oracle trigger generic autoincrement (1) oracle vbox virtual box cheat sheet (1) oracle virtual box cheat sheet (1) outlook (1) parser (1) password (1) paths (1) perl @INC compile-time run-time (1) perl disk usage administration Linux Unix (1) perl modules configuration management (1) permissions (1) php (1) picasa (1) platform (1) postgreSQL how-to (1) powerShell cmd cygwin mintty.exe terminal (1) ppm (1) predictions (1) prices (1) principles (1) productivity (1) project (1) prompt (1) proxy account (1) public private key (1) publishing (1) putty (1) qt (1) read file (1) registry (1) relationship (1) repository (1) rm (1) scala ScalaFmt (1) scp (1) scripts (1) scsi (1) search and replace (1) sed (1) sendEmail (1) sh stub (1) shortcuts Windows sql developer Oracle (1) sidebar (1) silicon (1) smells (1) smtp (1) software development (1) software procurement (1) sofware (1) sort (1) sql script (1) sql_dev (1) sqlcmd (1) sqlite (1) sqlite3 (1) sshd (1) sshd cygwin (1) stackoverflow (1) stored procedure (1) stub (1) stupidity (1) subroutines (1) svn (1) sysinternals (1) system design (1) tail (1) tar (1) temp table (1) templates (1) teradata (1) terminal (1) test (1) testing (1) theory (1) thorium (1) time (1) tip (1) title (1) tmux .tmux.conf configuration (1) tmux efficiency bash (1) tool (1) ui code prototyping tips and tricks (1) umask Linux Unix bash file permissions chmod (1) url (1) urls (1) user (1) utility (1) utils (1) vb (1) vbox virtual box cheat sheet (1) vim perl regex bash search for string (1) vim recursively hacks (1) vim starter (1) vim-cheat-sheet vim cheat-sheet (1) vimeo (1) visual stuio (1) warsaw (1) wiki (1) wikipedia (1) window (1) windows 7 (1) windows 8 (1) windows programs (1) windows reinstall (1) windows utility batch perl space Windows::Clipboard (1) wisdoms (1) workflow (1) worth-reading (1) wrapper (1) xp_cmdshell (1) xslt (1) youtube (1)

Blog Archive

Translate with Google Translate

My Blog List