Thursday, 17 May 2012

Data Duplication Elimination or BSN(Basic Sorted Neighbourhood) Methods using C# (C-Sharp)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication4
{
    class Program
    {
static void Main(string[] args)
        {
            List<person> persons = new List<person>();
            //database records entring
            person p = new person();
            //1st record
            p.id = 1;
            p.firstName = "Aoun";
            p.lastName = "Ali";
            p.age = 22;
            p.address = "Pakistan, karachi";

            persons.Add(p);

            //2nd record
            p = new person();
            p.id = 2;
            p.firstName = "Marium";
            p.lastName = "Hussain";
            p.age = 22;
            p.address = "Pakistan, Karachi";

            persons.Add(p);

            //3rd record
            p = new person();
            p.id = 3;
            p.firstName = "Osama";
            p.lastName = "Ali";
            p.age = 23;
            p.address = "Pakistan, karachi";

            persons.Add(p);

            //4th record
            p = new person();
            p.id = 4;
            p.firstName = "Ayesha ";
            p.lastName = "Ejaz";
            p.age = 22;
            p.address = "Pakistan, karachi";

            persons.Add(p);

            //5th record
            p = new person();
            p.id = 5;
            p.firstName = "Adnan";
            p.lastName = "Naseer";
            p.age = 23;
            p.address = "Pakistan, karachi";

            persons.Add(p);

            //6th record
            p = new person();
            p.id = 6;
            p.firstName = "Raheel";
            p.lastName = "Malik";
            p.age = 23;
            p.address = "Pakistan, islamabad";

            persons.Add(p);

            //7th record(redundant)
            p = new person();
            p.id = 7;
            p.firstName = "Aoun";
            p.lastName = "Ali";
            p.age = 22;
            p.address = "Pakistan, karachi";

            persons.Add(p);

            //8th record(redundant)
            p = new person();
            p.id = 8;
            p.firstName = "Marium";
            p.lastName = "Hussain";
            p.age = 22;
            p.address = "Pakistan, Karachi";

            persons.Add(p);

            //9th record(redundant)
            p = new person();
            p.id = 9;
            p.firstName = "Ayesha";
            p.lastName = "Ejaz";
            p.age = 23;
            p.address = "Pakistan, karachi";

            persons.Add(p);

            //10th record(redundant)
            p = new person();
            p.id = 10;
            p.firstName = "Osama";
            p.lastName = "Ali";
            p.age = 23;
            p.address = "Pakistan, karachi";

            persons.Add(p);
            //DATABASE END

            //display record
            Console.WriteLine("ID        First_Name       Last_Name       age       Address");
            for(int i=0; i<persons.Count  ; i++)
            {
                Console.WriteLine(persons[i].id + "        " + persons[i].firstName + "             " + persons[i].lastName + "            " + persons[i].age + "             " + persons[i].address);
            }
            Console.WriteLine("\n\n\n\n");


            List<string> key = new List<string>();

            //MAKING KEY BY CONCATENATING THE IMPORTANT COLUMNS ( I CHOOSE FIRST_NAME, AGE, ADDRESS)
            foreach (person pi in persons)
            {
                key.Add(pi.firstName + pi.age.ToString() + pi.address);
            }

            //SORT THE KEY FIRST
            key.Sort();

            //MAKING SORTED LIST ON THE BASIS OF SORTED KEY SO THAT REDUNDANT RECORDS COME NEXT TO EACH OTHER
            List<person> sortedlist = new List<person>();
            for (int i = 0; i < persons.Count; i++)
            {
                foreach (person pi in persons)
                {
                    if (key[i] == (pi.firstName + pi.age.ToString() + pi.address))
                    {
                        sortedlist.Add(pi);
                        break;
                    }
                }
            }

            Console.WriteLine("\n\n\n\n");

            //remove redundant data from sorted list
            for (int i = 0; i < sortedlist.Count - 1; i++)
            {
                string record1 = sortedlist[i].firstName + sortedlist[i].age.ToString() + sortedlist[i].address;
                string record2 = sortedlist[i + 1].firstName + sortedlist[i + 1].age.ToString() + sortedlist[i + 1].address;

                if (record1 == record2)
                    sortedlist.Remove(sortedlist[i]);
            }

            Console.WriteLine("After Applied BSN");
            Console.WriteLine("ID       First_Name      Last_Name     age     Address");
            for (int i = 0; i < sortedlist.Count; i++)
            {
                Console.WriteLine(sortedlist[i].id + "        " + sortedlist[i].firstName + "       " + sortedlist[i].lastName + "     " + persons[i].age + "     " + persons[i].address);
            }
            Console.ReadKey();
        }
    }

    class person
    {
        public int id;
        public string firstName;
        public string lastName;
        public int age;
        public string address;
    }


    }



Output:
Before BSN:

this is input or before bsn





After BSN:





I m also Giving a video reference This is in urdu Language from Virtual university ,Lecture of dataware housing.



Dataware house implementation

text ned university telenor logo dataware house erp enterprises pakistan oracle juniva sims numbers this is the blog tech labs news updates djuice
ned university logo dataware house aoun ali naqvi bcit c++ c# network data manipulation

About Organization:
Telenor Pakistan is 100% owned by the Telenor Group, an international provider of high quality voice, data, content and communication services in 11 markets across Europe and Asia. Telenor Group is among the largest  mobile operators in the world with 140 million mobile subscriptions and a workforce of approximately 30,000.

Telenor Pakistan is the country's single largest European foreign direct investor, with investments in excess of US$2 billion. It acquired a GSM license in 2004 and began commercial operations on March 15, 2005.

At the end of December 2011 it had a reported subscriber base of 28.11 million, and a market share of 24% making it the country's second largest mobile operator.

Reason for selecting Telenor Pakistan

Reason#1:
Offering mobile financial services
Telenor Pakistan acquired 51% of Tameer Microfinance Bank in November 2008. In 2009 it launched 'easy paisa' to become Pakistan's first telecom operator to partner with a bank to offer mobile financial services across Pakistan.

Contributing to Pakistan's economy
The company continues to contribute to Pakistan's economy. It has created 3,000 direct and 25,000 plus indirect jobs and has a network of over 180,000 retailers, franchises and sales & service centers, thus providing a means to livelihood to thousands.
For 2011 it is estimated that Telenor Pakistan contributed over Rs. 23 billion in various forms of direct and indirect taxes to the economy of Pakistan.

Reason#2
Internet service provider
Telenor Pakistan provides wide EDGE connectivity across the country. It has one of the largest data networks (GPRS) in Pakistan providing Internet services to customers.

Today
Telenor Pakistan has grown to become a leading mobile communications services provider of the country.

Telenor Pakistan's corporate headquarters are in Islamabad, with regional offices in Karachi, Lahore, Faisalabad, Multan, Hyderabad and Peshawar
Reason#3:
Corporate Responsibility
Telenor Pakistan's flagship corporate responsibility program, Khuddar Pakistan, aims to create dignified opportunities for persons with disabilities. The purpose is to become the most disabled-friendly organization in Pakistan in terms of employment, service, and community support.

Environmentally conscious
Telenor Pakistan has taken and continues to implement a number of environmentally-friendly initiatives. These include mainstreaming energy efficiency and alternate energy solutions, and implementing occupational health & safety practices that comply with international standards.

Growing Responsibly
Feb 11
Telenor Pakistan crosses the 25 million subscriber mark
Feb 11
Djuice launches ‘Khamoshi Ka Boycott’
Feb 11
Karo Mumkin projects launched
Mar 11 
Celebrates 6th birthday
Apr 11
Karo Mumkin receives ‘Best Branded Programming Project in
the Asia-Pacific region’ award in the Asia Pacific Content Awards
Apr 11
Telenor HumQadam launched
May 11
Karo Mumkin campaign wins award in ‘Public Service, Govt. & CSR’
category at the Pakistan Advertisers Society awards in Karachi
May 11
Telenor Pakistan achieves leading position in Business Intelligence
Groupwide’s BI Magic Quadrant results for the third year in a row
May 11
BCG Report launched ‘Shaping our financial future: Socio-economic
impact of mobile financial services’
May 11
Telenor Pakistan crosses the 26 million subscriber mark
Jun 11
Easypaisa wins Shaukat Khanum Social Responsibility Award
Aug 11
Djuice launches youth anthem ‘Kya Darta Hai’
Aug 11
Telenor Pakistan wins Prime Minister of Pakistan Trophy 2011 (Telecom Sector category) under the auspices of LCCI

Reason#4
Having A Large Records of the Customers &  Operations
Due to having a 2nd Largest Network in Pakistan It has a mass records of the Customers of any type and age and different Operational records are also maintained Like Different offers ,Smart tunes , Messages & call packages Talkshalk ,Djuice ,Persona etc and Prepaid and postpaid billings ,recharge ,Transfer balance ,quizzes ,Day night Packages, Friends and family (F&F) Voice call ,Voice Messages (Bubble messages) MMS and other transactions.
QUESTIONNAIRE:

1.      Who are your clients?
2.      What are your client’s requirements?
3.      How many Connections do you sale in the period of a month?
4.      Which workflow are you now following? Any software implemented?
5.      If yes? Then is it a specialized for your company or just any software to do regular office tasks?
6.      Do you have data experts or just the data entry operators?
7.      Are you completely satisfied with the current workflow? What are the problems you are facing with current workflow definition?
8.      How much historical data is saved in your database?
9.      What data is stored during a call is made by your client?
10.  Do you store data related to your employees/staff?
11.  Do you have any defined access rights for your data?
12.  What type of data needs to be updated in your data warehouse?
13.  How long should be the duration between data update?
14.  Who has the final say in decision making?
15.  What do you think why a customer selects your company when there are a numerous Telecommunication companies in Pakistan?
Gathered Information:
1.      As we are the second largest telecommunication company of Pakistan ,our Most clients are related to business class ,Youngsters and Middle class more than 2.0 Million Customer are there in Pakistan only.   
2.      Our clients require Affordable call rates and SMS/MMS Packages for the Local and International Services In fact they also require the better internet services facility  for their smart phones in affordable rate and speed.
3.      In Pakistan 958290 Connections are sold every month of different Telecom Companies in which Telenor connections are  35% (335401) Per month for both Post Paid and Pre Paid.
4.      Yes We use Different ERPs For different Operations of the organizations
5.      Telenor Pakistan is using mainly software’s for recording the data for other process improves their standard and company working
·         Oracle ERP is Using by Telenor
·         Shop Tool
·         Siebel Partner Portal ( This software is responsible for the entries recording purpose of client whole data ,the phone number allotted to them or Sims issued by the Telenor benefits are No chance of Fraud ,See financial position of the firm, Daily transactions Accurate results, Keep the whole record)
·         Chris Express ( it is a read only software in which clients Information are saved but cannot be altered or changed ,Clients can get information but cannot altered that information Benefits are Postpaid call timings can get from it ,Billing details  of Post Paid Customers is provided over there ,Each call is recorded in it, Customer can get their info where he is calling at a particular time and date , in case of any miss happen recorded data give help to that one)
·         Janiva (Telenor use This Software for the Prepaid Connection along with all details of prepaid the benefits are easy Load Verification, Time balance transfer ,Number Dialed by subscriber ,Company has proved of it )


6  .      Mr. Lars Christian (CEO-Telenor Pakistan)  told us that they are having A Team of Data Experts and Data entry Operators in our Head Office Islamabad and we are also having the Team of Data Entry operators in Our Franchise and in Other branches of Telenor in Different cities of Pakistan
7.      We are Partially satisfied, The issue is that we want more Intelligent data processes which would be helpful for us in Business Strategic Plan, We Want to be the First Largest Telecom Company of Pakistan Instead of Second Largest.
8.      From The Launching date of the Company We have recorded information of our Clients and Employees we have data from 15 –March 2005 when we launched our company in Pakistan (Islamabad, Karachi Lahore etc) more than 15000 employees are there in Pakistan.
9.      The user Connection Number ,call timings ,Duration Packages ,Charges Date from and to Numbers are saved when a call is made by the customer
10.  Yes we store the data related to our each Employee or staff their Designations, Duty Timings, salary packages, Roles  etc.
11.  Aamir Ibrahim head of corporate Affairs told that they provides the views and roles to different managers and staff for the client confidentiality, security and better services purpose we provides different roles to our Customer relation services and also maintain the logs when any employee wants to see the clients information.
12.  Mainly transactional data and regular cost.
13.  As we do the closing of records after every six months, so should the data be updated
14.  Chief executive , department Executives and board of directors
15.  Our company undergoes the process of benchmarking in every quartile of the year in which we analyze the working flow of our competitors and try to work one step ahead of them and that’s why we are one of the best Telecommunication companies in Pakistan