Wednesday 12 February 2014

Intranet (Google sites RSS Feeds)


We are currently still in the progress of deciding on which intranet solution to use, the 2 current top sites in the running is:
The reasoning behind our not creating ourself is more on time constraints and the multiple requirements we have and the complications of that requirements.

  • Must integrate with google applications
    • Send Mail
    • Receive Mail
    • Check Calender
    • Check Google Docs
  • Wiki Creation
  • Integrate with Asana
  • RSS Feeds
So in affect to integrate the RSS (push) feed into your site is pretty simple, all you need is the page that you want to be subscribed to and add "/posts", remember the "S", at the end of the link. 

RSS Feeds and MVC

I will be doing some RSS feeds, integrating it with our current site and trying to keep you updated on the technologies we are using .

MVC Paypal Integration


I had to do some paypal integration with MVC, and found this site which gives a nice tutorial on how it is done.

http://logcorner.wordpress.com/2013/09/05/asp-net-mvc-paypal-integration/

Sunday 28 April 2013

C# Database handler Class

A class I have written to handle dabase processes of a datagrid.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;
using System.Collections;
using System.Drawing;

namespace StockCommander
{
    class databaseHandle
    {
        String connectionString = @"Data Source=(localdb)\Projects;Initial Catalog=test;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;";
        SqlDataAdapter dataAdapter;
        DataTable table = new DataTable();

        public void GetData(string selectCommand, ref DataGridView dataGrid)
        {
            try
            {
                dataAdapter = new SqlDataAdapter(selectCommand, connectionString);
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
                table = new DataTable();
                table.Locale = System.Globalization.CultureInfo.InvariantCulture;

                dataAdapter.Fill(table);
                dataGrid.DataSource = table;

                dataGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
            }
            catch (SqlException)
            {
                MessageBox.Show("SQL Exception occured...");
            }
        }
        public void GetData(string selectCommand, ref DataGridView dataGrid, int identityColumn)
        {
            try
            {
                dataAdapter = new SqlDataAdapter(selectCommand, connectionString);
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);
                table = new DataTable();
                table.Locale = System.Globalization.CultureInfo.InvariantCulture;

                dataAdapter.Fill(table);
                dataGrid.DataSource = table;
                table.Columns[identityColumn].AutoIncrement = true;
                table.Columns[identityColumn].AutoIncrementSeed = returnLastId();

                dataGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
            }
            catch (SqlException)
            {
                MessageBox.Show("SQL Exception occured...");
            }
        }
        public void updateData()
        {
            dataAdapter.Update(table);
        }

        private int returnLastId()
        {
            return table.Rows.Count + 1;
        }

        public void deleteRows(IEnumerator rowColl, ref DataGridView dataGrid)
        {
            while (rowColl.MoveNext())
            {
                DataGridViewRow currRow = (DataGridViewRow)rowColl.Current;
                dataGrid.Rows.Remove(currRow);

            }
        }
        public void setRowReadOnlyRows(ref DataGridView dataGrid,int i)
        {
           
            dataGrid.Rows[i].ReadOnly = true;
            dataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
        }

        public void setRowReadOnlyRows(ref DataGridView dataGrid)
        {
            for (int i = 0; i <= dataGrid.RowCount - 2; i++)
            {
                setRowReadOnlyRows(ref dataGrid, i);
            }
        }

    }
}

Friday 8 March 2013

Party Model

Currently implementing a "Agreement" level party model and just a basic party model.
Some of the implementation include a library of addresses/phone records.


Will add some Python code on how I handled the library concept.  As there is some complications to ensure that addresses is not being duplicated and that multiple addresses is linked to a single party and if updated the link is changed.

Monday 11 February 2013

Errors :(

I got a error: "SQL0668N Operation not allowed for reason code 5".

The web and DB2 help gave me the description that a load was busy hapening which in this case was not True.
In the end the real error was because I had was doing a load as below:

DECLARE CURSOR1 CURSOR FOR
SELECT column1,column2
from table1 where ID not in (select ID from TABLE2);



LOAD FROM CURSOR1OF CURSOR
    INSERT INTO table2 (col1,col2);

Because the Cursor contains the table in which the load is being done it gives the reason code 5.