Saturday 23 December 2017

Error: To install this application you need either a Windows developer license or a sideloading-enabled system


Solution:
Open Your project in VS as Administrator mode
Click on Tools-->NuGet Package Manager-->Package Manager console
Run below command
Show-WindowsDeveloperLicenseRegistration
It will open Setting for Developers
Select Developer Mode
Click Yes in the prompt
Go back to VS Package Manager console
Run below command
Get-WindowsDeveloperLicense
It has to show IsValid True.
Now Reopen you XAML page, it should work

Thursday 30 November 2017

IIS 10: HTTP Error 500.19 - Internal Server Error


Search for "Turn windows features on or off"
Check "Internet Information Services"
Check "World Wide Web Services"
Check "Application Development Features"
Enable all items under this

Monday 20 November 2017

The remote server returned an error: (403) Forbidden



Go to run
type: services.msc
Search for below service and start
SQL Server Agent (MSSQLSERVER)
Now you should not get any error

Friday 17 November 2017

C# shim not working in VS 2015

Go to Test Project.
Delete all files under "Fakes" folder
Remove all Fakes references from "References"

Under reference -->Right click add new reference, browse
Select:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PublicAssemblies\Microsoft.QualityTools.Testing.Fakes.dll
This should be 12.0.0.0

Go to references right click on Dll Select "Add Fakes Assembly"

Now you will see new references with name .Fakes and under "Fakes" folder new files will be added

Now build and run test cases.


It should work fine

Monday 13 November 2017

SQL injection

using (MySqlConnection objConn = new MySqlConnection(ConnString))
{
   
// string sql = "SELECT UserId FROM User WHERE " + "(email = '" + email + "' AND " + "password = '" + password + "')";//Never use this way, it will leads to SQL injections
    string sql = "SELECT UserID FROM User WHERE email = @email and password = @password "; //This way we r createing SQL statement dynamically
    using (MySqlCommand cmd = new MySqlCommand(sql))
    {
         cmd.Connection = objConn;
         cmd.Parameters.AddWithValue("@email", email);
         cmd.Parameters.AddWithValue("@password", password);  
  try
           {
             cmd.Connection.Open();
             var userId = cmd.ExecuteScalar();
         }
         catch (SqlException sx)
         {
             // Handle exceptions before moving on.
         }
     }
}

Sunday 8 October 2017

'HttpContent' does not contain a definition for 'ReadAsAsync'

'HttpContent' does not contain a definition for 'ReadAsAsync' and no extension method
'ReadAsAsync' accepting a first argument of type 'HttpContent' could be found
(are you missing a using directive or an assembly reference?)

Solution:
Add below refences.
System.Net.Http.Formatting.

Saturday 7 October 2017

Sunday 1 October 2017

login failed for user ''. (microsoft sql server, error: 18456)

Solution:
<add name="DevConnectionString" connectionString="Data Source=MydDB;Initial Catalog=TestDB;Persist Security Info=True;User ID=sa;Password=MyPassword" providerName="System.Data.SqlClient" />

Monday 7 August 2017

Aras innovator promoteItem from one state to another state

<AML>
<Item type="Document" action="promoteItem" version="0" where="[Document].id='1121B0903C8C4DAEB57006C0C5234C82'" serverEvents="0">
<state>Superseded</state>
</Item>
</AML>

Error LifeCycle: PromoteItem: Transition to promote Part from Preliminary to Released not found

LifeCycle: PromoteItem: Transition to promote Part from Preliminary to Released not found
Internal Error: failed to get the transition to promote the Part from Preliminary to Released
Aras Innovator error.
Solution:
You are missing “Assigned Creator” value for a Item, first provide “Assigned Creator” value, then try to promoteitem.
This is the AML which used to promote the state for an Item.
<AML>
<Item type=”Part” action=”promoteItem” where=”[PART].item_number=’P0001′”>
<state>New state</state>
</Item>
</AML>

Not able debug the code using Office connector.

Not able debug the code using Office connector.
Alternate way is- enabling logging:
Go to Innovator server.
Open: InnovatorServerConfig.xml
<operating_parameter key="debug_log_flag" value="false" />
Change to : <operating_parameter key="debug_log_flag" value="true” />
Note: This will be log each action, so after logging your action set back to “false”
Go to this path:
C:\ArasBuilds\B12345\Innovator\Server\logs\
Open .xml
AML, which is passing OC to Aras:
<Item isNew="1" isTemp="1" type="Part" action="add" id="E2FD1158A14A4C99A9D8AD51BC7E74F7">
                                <item_number>Part</item_number>
                                <external_owner>Aras.Document.MS-Office</external_owner>
                                <authoring_tool>Microsoft Excel</authoring_tool>
                                <classification>Test</classification>
                                <from_template>
                                </from_template>
                                <locked_by_id>AD30A6D8D3B642F5A2AFED1A4B02BEFA</locked_by_id>
                                <thumbnail>vault:///?fileId=DBA6420BA6E1400D89F8C2B9A75F4D55</thumbnail>
                </Item>


Delete Client Cache from Aras innovator

Open Aras innovator
Go to Tools --> Admin -->Clear Client Metadata Cache
Delete any IE temporary files 

Aras VaultFiles files location

TO find any file in Innovator
go to Administrator
File handling
Files
Search for file name which you know.

If you want know the location of that file.
go to IIS
open Innovator web site
Right click
go to explorer

C:\[Innovator]\[InnovatorWebSite]\Logs\VaultFiles\[InnovatorWebSite]\[1\0F\5898444B147289C46295BF3BF9C56]

In this path u can find physical file.

Aras innovator enabling logging

Aras innovator enabling logging:
Go to Innovator server.
Open: InnovatorServerConfig.xml
<operating_parameter key="debug_log_flag" value="false" />
Change to : <operating_parameter key="debug_log_flag" value="true” />
Note: This will be log each action, so after logging your action set back to “false”
Go to this path:
C:\LocalBuild\ArasInn\Innovator\Server\logs\
Open .xml
You will see all the logs (AML) which are sending to aras

Aras debugging



Add this in innovatorconfig.xml

in method add this: if (System.Diagnostics.Debugger.Launch()) System.Diagnostics.Debugger.Break();

when we call method, it will open VS and run debugging
if VS is not opened,
Open VS as admin
Click Tools
Click Attach process
Click Show processes for all users
Search for  w3wp.exe
select right w3wp.exe (should be innovator, not vault)
Attach
OK

Now you will get debugging

Tuesday 11 July 2017

exception of type 'system.outofmemoryexception' was thrown Aras innovator

Root cause: Your AML might returning more data
Solution:
-change AML query, try to avoid select="*", give always select="id,item_number"

Sunday 2 July 2017

Visual Studio compare SQL server table Data Compare



Visual Studio => Tools => SQL Server => New Data Comparison ...
In the new window, Under "Source Database", Click on "Select Connection..."
Enter SQL DB Server name
Select Database
Click on Connect

In the new window, Under "Target Database", Click on "Select Connection..."
Enter SQL DB Server name
Select Database
Click on Connect

Check All check boxes

Click Next

Select Tables which you want to compare
Finish
You will see data difference b/w 2 DBs

Saturday 1 July 2017

Visual Studio - How to Compare Database Schema

Open Visual studio
Tools-->SQL Server-->New Schema Comparison..
You will see a page, where you can select source database using option "Select Source..."
New window will open -->Select "Database"
Click on Select Connection..
Enter Server: SQLLocalhost
Enter Authentication, user name, password
Select "Database Name" Ex: DB1
Click Ok

In the Visual studio page, select target database using option "Select Target..."
New window will open -->Select "Database"
Click on Select Connection..
Enter Server: SQLLocalhost
Enter Authentication, user name, password
Select "Database Name" Ex: DB2
Click Ok

Click on "Compare"

Friday 30 June 2017

Excel Find all the data which start with XYZ, till next number

Input: Column A-->
ABC-2123-XYZ-023111-Test-2-BOX-US-ZAW

Find all the data which start with XYZ, till next number
Formula:
=MID(A1,FIND("-XYZ",A1)+1,10)

Friday 23 June 2017

Copy SQL tables in to new data base



I have a SQL DB name Test
table names are Tbl_1, Tbl_2
Now i would like to create new DB with same tables from Test

Create new DB Test_Copy
Create new query from Test_Copy DB
Now run below query to create tables with data

 select * into [dbo].[Tbl_1] from [Test].[dbo].[Tbl_1]
 select * into [dbo].[Tbl_2] from [Test].[dbo].[Tbl_2]

Wednesday 21 June 2017

Excel find duplicate rows

=countif(M:M, M2)

if you get 1 mean, row is coming 1 time, if it is 2,3,4.... mean, duplicate records are there

Friday 2 June 2017

ASP.net MVC WEB API Angular 2

http://ecollabro.codeplex.com/SourceControl/latest
http://webapiclientgen.codeplex.com/SourceControl/latest

WEB API, Angular 2

ASP.NET MVC Sample App

ProDinner - ASP.NET MVC Sample App

http://prodinner.codeplex.com/

using .net 4.5, ASP.net MVC, EntityFramework
CRUD and search operations for entities
very rich and responsive UI (using ASP.net MVC Awesome jQuery Ajax Helpers)
upload and crop Images for meals (using Jcrop)
mapping entities <-> viewmodels (using ValueInjecter)
Multi-Language User Interface
N-Tier Architecture
Security using Forms Authentication
pagination using "more results" button
Multiple UI themes (using jQuery UI themes)
Unobtrusive Client Side Validation using jQuery.Validate
Nice validation messages using just CSS
tinyMCE as wysiwyg editor
Html Agility Pack for sanitizing html

Thursday 18 May 2017

Cannot start service from the command line or a debugger

Cannot start service from the command line or a debugger.  A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command

When you run windows service debug mode from VS, i got above error.

Solution:

OOTB code:

 static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
             ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new Scheduler()
            };
            ServiceBase.Run(ServicesToRun);    

        }
    }

Change to:


 static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            //ServiceBase[] ServicesToRun;
            //ServicesToRun = new ServiceBase[]
            //{              
            //    new Scheduler()
            //};
            //ServiceBase.Run(ServicesToRun);


            var myService = new Scheduler();
            if (Environment.UserInteractive)
            {
                MtProject.Scheduler objScheduler = new Scheduler();
                objScheduler.GetData();
            }
            else
            {
                var servicesToRun = new ServiceBase[] { myService };
                ServiceBase.Run(servicesToRun);
            }

        }
    }

Saturday 13 May 2017

Process with an ID #### is not running in visual studio

Solution:
Close VS.
Navigate to the folder of the solution and delete the hidden .vs folder.
Restart VS.
Run the application

Friday 12 May 2017

An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll

An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll

Additional information: String was not recognized as a valid DateTime.

I got above error, but same code was working from another system.

My config:
    <add key="sDate" value="16-02-2012 11:13:23"/>

Root cause: The system which i am running the code is having local date format as DD/M/YYYY
But the my input is having MM/DD/YYYY

Solution:
Option 1: Change sDate from    <add key="sDate" value="16-02-2012 11:13:23"/> Value to
<add key="sDate" value="02-16-2012 11:13:23"/>

Option 2: Change system date format to MM/DD/YYYY


vcvarsall.bat missing

Error The command "call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\..\..\vc\vcvarsall.bat" x86
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\..\..\vc\bin\EditBin.exe"


The vcvarsall.bat file is in C:\program files(x86)\Microsoft Visual Studio 14.0\VC\.

Go to Control Panel -> Uninstall a program
Select visual studio 2015, right click, Change -> Modify
Select Visual C++ tools is selected under programming languages
Click on Install

Tuesday 2 May 2017

anguler js sample



    <script>


        var myApp = angular.module("myApp", []);

        (function (app) {
            "use strict";
            app.controller("productController", function ($scope, $http) {
               
                $scope.SendData = function (Data) {
                    alert('ff');
                    var GetAll = new Object();
                    GetAll.FirstName = Data.firstName;
                    GetAll.SecondName = Data.lastName;
                    GetAll.SecondGet = new Object();
                    GetAll.SecondGet.Mobile = Data.mobile;
                    GetAll.SecondGet.EmailId = Data.email;
                    $http({
                        url: "NewRoute/firstCall",
                        dataType: 'json',
                        method: 'POST',
                        data: GetAll,
                        headers: {
                            "Content-Type": "application/json"
                        }
                    }).success(function (response) {
                        $scope.value = response;
                    })
                       .error(function (error) {
                           alert(error);
                       });
                }

            });
        })(myApp);



   
    </script>

<body ng-app="myApp" ng-controller="productController">
    <hr />
    <h3>
        Send Objects of Objects Using AngularJS
    </h3>
    <hr />
    <div>
        <hr />
        <div>
            First Name:
            <input type="text" placeholder="Enter your name" ng-model="details.firstName">
            Last Name:
            <input type="text" placeholder="Enter your last name" ng-model="details.lastName">
        </div>
        <hr />
        <div>
            Mobile Number:
            <input type="text" placeholder="Enter your mobile number" ng-model="details.mobile">
            EmailId:
            <input type="text" placeholder="Enter your email id" ng-model="details.email">
        </div>
        <input type="button" ng-click="SendData(details)" value="Submit" />
        <hr />
        <h4 style="color:blueviolet">{{value}}</h4>
    </div>
    <hr />
</body>
</html>

refer: http://www.c-sharpcorner.com/article/modules-and-controller-in-angularjs/

Sunday 30 April 2017

C# AutoMapper.Mapper does not contain definition for CreateMap

public ClientEntity GetById(int id)
          {
                 ClientEntity returnClientEntity = new ClientEntity();
                 try
                 {
                        using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted }))
                        {
                               using (DBContext context = new DBContext())
                               {

                                      //Get data based on  id                 
                                      var clientInfoDB = context.Clientinfoes.Where(s => s.ClientID == id).FirstOrDefault();

                                      if (clientInfoDB != null)
                                      {

                                             ////I tried below line first
                                             //returnClientEntity = clientInfoDB;
                                             //return clientInfoDB;// get error


                                             //Problem: clientInfoDB is DB object, but method is returning entity object which is not ClientEntity
                                             //So need mapping b/w DB and entity

                                             //Solution--start
                                             var config = new MapperConfiguration(cfg => {
                                                   cfg.CreateMap<Clientinfo, ClientEntity>();
                                             });

                                             IMapper mapper = config.CreateMapper();
//below line is mapping b/w DB and entity
                                             returnClientEntity = mapper.Map<Clientinfo, ClientEntity>(clientInfoDB);
                                             //end
                                      }
                                      else
                                      {
                                             return null;
                                      }
                               }
                        }
                 }
                 catch (Exception ex)
                 {

                 }
                 return returnClientEntity;

              }

Wednesday 26 April 2017

Wednesday 19 April 2017

HTTP Error 500.19 - Internal Server Error on IIS 10

Solution Steps:

Open control panel -->"program" -->
Click on turn windows features on/off -->locate” Internet Information services IIS” in the pop up window and expand its node
Expand the” World Wide Web Service” node
Expand “Application Development Features” node
check the check box of”ASP.NET”
Then click OK  button

radio

http://radio.garden/live

Friday 14 April 2017

Visual studio online create new team project

Open: https://www.visualstudio.com/team-services/
Click on free account
Enter your account details
Click on "create new account"
You will see all u r account: https://app.vsaex.visualstudio.com/me?mkt=en-US&campaign=o~msft~vscom~product-vsts-nav~menu
Click on any account
Ex: https://myaccountName.visualstudio.com/_projects



Click on New Project
Ex: Project Name: Demo
Version Control: TFS
Work Item process: Scrum
Click on "Create"
You will get below screen
https://myaccountName.visualstudio.com/Demo
Under "Members" Click on +
Enter outlook email id

Open Visual studio as administrator
Click  on Team
Select Connect Team foundation server:  : https://myaccountName.visualstudio.com

Click on Plug Icon under "Team Foundation" window
(if you have already connected to TFS, then click on  "Select Team projets...")
Select Right Team Foundation server
It will  load all Team Projects
Select "Demo"
Click on Connect
Double click on "Demo" from TFS window
You will see: Configure your workspace mappings to get started developing
Click on "Configure your workspace mappings to get started developing"

In your local first create a folder strcture ex: F:\tfs\Demo

Enter local folder path as: F:\tfs\Demo
Click on "Map&Get"

If you go to this path: F:\tfs\Demo
You will see "BuildProcessTemplates" folder

Under VS-->Team-->Manage Connections..-->Under Team explorer - connect
Click on Home icon
Click on “Source Control explorer”
Ex:

Right click after “BuildProcessTemplates”, select “new Folder” name it: Sourcecode

Go inside “Sourcecode” folder
Right click Create New folder name as “Dev”
Same way create: “QA”, “UAT”, “Prod”
Go to “Dev” folder

You will see all these folders in local also:
F:\tfs\Demo\Sourcecode\Dev

File "New Project"
Search for blank solution
Select Blank solution
Name it as: Demo
Location as: F:\tfs\Demo\Sourcecode\Dev

Check "Add to source control" check box
Ok
You will get new window to Add solution "Demo" to Source control
Select "Demo"
Click Ok
By this time, in VS, you will see all blank solution with name as "Demo"
From VS
Right click on "Demo" solution
Click on "Check in"
Enter comments
Check In


In VS
File "New Project"
Select "Class Library"
name it: Demo.Entity
Location path: F:\tfs\Demo\Demo
Check "Add to source control" check box
OK

Click on Solution
Add new project
Select "Class Library"
name it "Demo.DAL"
Location path: F:\tfs\Demo\Sourcecode\Dev\Demo
Check "Add to source control" check box
OK



Click on Solution
Add new project
Select "Class Library"
name it "Demo.Services"
Location path: F:\tfs\Demo\Sourcecode\Dev\Demo
Check "Add to source control" check box
OK


Click on Solution
Add new project
Select "Web"-->ASP.NET Web Application
name it "Demo.API"
Location path: F:\tfs\Demo\Sourcecode\Dev\Demo
Check "Add to source control" check box
OK
In the new window select "Web API"

Check "Web Forms" check box

Ok


After Dev completion, move all the file to "QA"

Wednesday 12 April 2017

SQL Create table with primary key and UNIQUE key

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MyTable](
 [SNo] [int] NOT NULL,
 [UserName] [int] NOT NULL,
 [Password] [nvarchar](50) NULL,
 CONSTRAINT [UQ_MyTable_UserName] UNIQUE NONCLUSTERED
(
 [UserName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

In the project column of the "Error List" window, I see DNX Core 5.0.

The type or namespace '[someclass]' could not be found.
In the project column of the "Error List" window, I see DNX Core 5.0.


solution:

In case some people are still struggling with this, you can dereference the DNX Core 5.0 by removing it from your framework references in the project.json file.

The section

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },
Should become

  "frameworks": {
    "dnx451": { }
  },


now i got bellow error:
Error: Please run “dnu restore” to generate a new lock file

solution:
Go to the project where you are getting above error
Right click on "References" then select "Restore Packages"

Friday 17 March 2017

Basic SQL

CREATE TABLE [dbo].[Country] (
    [CountryId]     INT           IDENTITY (1, 1) NOT NULL,
    [Name]    VARCHAR (50)  NOT NULL,  
    PRIMARY KEY CLUSTERED ([CountryId] ASC)
);

CREATE TABLE [dbo].[State] (
    [StateId]     INT           IDENTITY (1, 1) NOT NULL,
[CountryId] int,
    [Name] int NOT NULL,  
    PRIMARY KEY CLUSTERED ([StateId] ASC),
    FOREIGN KEY (CountryId) REFERENCES Country(CountryId)
);

Saturday 4 March 2017

A popup blocker may be preventing Microsoft from launching the course. Please allow pop-ups for Microsoft by adding "https://microsoft.com" to your exception list and reload the page.



Access the Google Chrome menu on the toolbar. The menu on the toolbar is at the top right of your browser.
Choose settings
Find "Show advanced settings" at the bottom of the page and click it.
Under "Privacy," click on "Content settings."
Under the Pop-ups section, choose "Manage exceptions"
Add "https://microsoft.com" and set "Allow"

Friday 3 March 2017

c# decode special characters

public string DecodeSpecial(string strVtext)
{
if (!string.IsNullOrEmpty(strVtext))
{
//strVtext=strVtext.Replace("&", "&amp;").Replace("/&", "&quot;").Replace("/'", "&apos;").Replace("<", "&lt;").Replace(">", "&gt;");
//strVtext= new System.Xml.Linq.XText(strVtext).ToString();
//strVtext=System.Web.HttpUtility.HtmlEncode(strVtext);
}
return strVtext;
}

Sunday 19 February 2017

0x800a1391 - JavaScript runtime error: 'ko' is undefined

Error: 0x800a1391 - JavaScript runtime error: 'ko' is undefined

Solution:
Add KnockOut Js reference.
Ex:
@section scripts {
<script type='text/javascript' src='/Scripts/knockout-2.2.1.js'></script>

<script>
//Your code...
</script?

}

Wednesday 15 February 2017

retrieving the com class factory for component with clsid failed due to the following error asp net



Solution:
Open the project in VS
Right click on project
Select properties
In the Build tab - platform target =Any CPU

if above is not working, try below..

Exact error for me:
Retrieving the COM class factory for component
with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following er
ror: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_
SERVER_EXEC_FAILURE)).
Job Completed
Press any key to continue to close...



Error:

Retrieving the COM class factory for component
with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040153 Invalid value for registry (Exception from HRESULT: 0x80040153 (RE
GDB_E_INVALIDVALUE)).

Solution: 
Go to Run
Type: regedit
Go to this path: HKey_Classes_Root\Wow6432Node\CLSID\[GUID]
Mine is: HKey_Classes_Root\Wow6432Node\CLSID\[0006F03A-0000-0000-C000-000000000046]
Select "0006F03A-0000-0000-C000-000000000046"
Click on Right side pane
Right click "New" -->String Value
Name it: AppID
Value data: 0006F03A-0000-0000-C000-000000000046 (COM object GUID, which u got in above steps)

Right click "New" -->String Value
Name it: DllSurrogate
Value data:

Go to this path: HKey_Local_Machine\Software\Classes\AppID
Search for "0006F03A-0000-0000-C000-000000000046", if it is there don't do anything.
if you don't find it then..
Right click on -->New -->Key
Enter : 0006F03A-0000-0000-C000-000000000046



Error Message:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0×80070005 (E_ACCESSDENIED)).
Solution:

This is a COM permissions problem.

Start > Run > dcomcnfg (or “mmc -32″ and then add the Component Services snap-in manually if you can’t find the app under step 3)
Navigate to Component Services > Computers > My Computer > DCOM Config
Locate the MS application giving you trouble (eg: “Microsoft Outlook Application” )
Right click > Properties
On the security tab: Select Customize under Launch and Activation Permissions and click Edit…
Add the account under which the site is running (eg: Network Service or Everyone) and assign Local Launch & Local Activation permissions

C# Interface

What is Interface in C#?
A) It is as simple as Class with out implementation. Only declaration of the events, methods, properties, mean .
All the methods and events which are there in interface should be inherited in  the class and should be implemented for each members in the interface.


Why Interface in C#?
A) in .Net we can't do multiple inheritance.
Ex:

class Honda
{
    //Honda Relations--Members
}

class Toyota{
    //Toyota Relations--Members
}

class
 myCarHonda,Toyota //Multiple Inheritance

{
    //Accessing both Relations class members.}

When you compile above code, we will get error.
Class " "cannot have multiple base classes: ".....Honda" and "Toyota"

The reason was .Net doesn't support multiple inheritance


So Interface is the option for multiple inheritance

Ex:
 ODDEVEN.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InterFaceDemo
{
    interface IOne
    {
        void ONE();//Pure Abstract Method Signature
    }
    interface ITwo
    {
        void TWO();
    }
    interface IThree:IOne
    {
        void THREE();
    }
    interface IFour
    {
        void FOUR();
    }
    interface IFive:IThree
    {
        void FIVE();
    }
    interface IEVEN:ITwo,IFour
    {

    }
    class ODDEVEN:IEVEN,IFive//Must Implement all the abstract method, in Derived class.
    {
        public void ONE()//Implementation of Abstract Method.
        {
            Console.WriteLine("This is ONE");
        }
        public void TWO()
        {
            Console.WriteLine("This is TWO");
        }
        public void THREE()
        {
            Console.WriteLine("This is THERE");
        }
        public void FOUR()
        {
            Console.WriteLine("This is FOUR");
        }
        public void FIVE()
        {
            Console.WriteLine("This is FIVE");
        }

    }
}

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

namespace InterFaceDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("This is ODD");
            IFive obj1 = new ODDEVEN();
            obj1.ONE();
            obj1.THREE();
            obj1.FIVE();


            Console.WriteLine("\n\nThis is EVEN");
            IEVEN obj2 = new ODDEVEN();
            obj2.TWO();
            obj2.FOUR();


            Console.ReadLine();
        }
    }
}
-----------------

//if( System.Diagnostics.Debugger.Launch() ) System.Diagnostics.Debugger.Break();
        var externalOwner = this.getProperty("external_owner");
        if (!string.IsNullOrEmpty(externalOwner) && externalOwner == "Aras.Document.MS-Office")
        {
            string partId = this.getID();
            try
            {
                IExcelReader excelReader = new ExcelReader(new DataAccessLayer(this.getInnovator()), new ExcelManager());
                excelReader.Extract(partId);
            }
            catch (Exception ex)
            {
                return this.getInnovator().newError(string.Format(CultureInfo.InvariantCulture, "Error occured while reading of excel file. Message: {0}", ex.Message));
            }
            finally
            {

            }
        }
        return this;
    }

    // IExcelApi is added to support unit testing
    internal interface IExcelManager
    {
        List<ExcelDataSet> ReadSheetViaDefindNames(string fname);
    }

    internal class ExcelManager : IExcelManager
    {
        public List<ExcelDataSet> ReadSheetViaDefindNames(string fname)
        {
            var data = new List<ExcelDataSet>();
            using (DocumentFormat.OpenXml.Packaging.SpreadsheetDocument doc = DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(fname, false))
            {
                data = this.Read(doc);
            }
            return data;
        }
        private List<ExcelDataSet> Read(DocumentFormat.OpenXml.Packaging.SpreadsheetDocument doc)
        {
            var data = new List<ExcelDataSet>();

            var definedNames = GetDefinedNames(doc.WorkbookPart);

            foreach (DefinedNameVal definedName in definedNames)
            {
                var worksheetPart = GetWorkSheetPart(doc.WorkbookPart, definedName);
                var cellValue = GetCellValue(worksheetPart, doc.WorkbookPart.SharedStringTablePart, definedName.StartColumn, definedName.StartRow);

                data.Add(new ExcelDataSet { Name = definedName.Key, DisplayText = cellValue });
            }
            return data;
        }
        private List<DefinedNameVal> GetDefinedNames(DocumentFormat.OpenXml.Packaging.WorkbookPart workbookPart)
        {
            List<DefinedNameVal> definedNames = new List<DefinedNameVal>();
            foreach (DocumentFormat.OpenXml.Spreadsheet.DefinedName name in workbookPart.Workbook.GetFirstChild<DocumentFormat.OpenXml.Spreadsheet.DefinedNames>())
            {
                //Parse defined name string…
                string key = name.Name;
                string reference = name.InnerText;
                string sheetName = reference.Split('!')[0];
                sheetName = sheetName.Trim('\"');

                //Assumption: None of my defined names are relative defined names (i.e. A1)
                string range = reference.Split('!')[1];
                string[] rangeArray = range.Split('$');
                string startCol = rangeArray[1];
                string startRow = rangeArray[2].TrimEnd(':');
                string endCol = null;
                string endRow = null;

                if (rangeArray.Length > 3)
                {
                    endCol = rangeArray[3];
                    endRow = rangeArray[4];
                }

                definedNames.Add(new DefinedNameVal()
                {
                    Key = key,
                    SheetName = sheetName,
                    StartColumn = startCol,
                    StartRow = startRow,
                    EndColumn = endCol,
                    EndRow = endRow
                });
            }
            return definedNames;
        }
        private DocumentFormat.OpenXml.Packaging.WorksheetPart GetWorkSheetPart(DocumentFormat.OpenXml.Packaging.WorkbookPart workbookPart, DefinedNameVal definedName)
        {
            //get worksheet based on defined name
            string relId = workbookPart.Workbook.Descendants<DocumentFormat.OpenXml.Spreadsheet.Sheet>()
                            .Where(s => definedName.SheetName.Equals(s.Name))
                            .First()
                            .Id;
            return (DocumentFormat.OpenXml.Packaging.WorksheetPart)workbookPart.GetPartById(relId);
        }
        private string GetCellValue(DocumentFormat.OpenXml.Packaging.WorksheetPart worksheetPart, DocumentFormat.OpenXml.Packaging.SharedStringTablePart stringTablePart, string startCol, string startRow)
        {
            string reference = startCol + startRow;
            //get exact cell based on reference
            DocumentFormat.OpenXml.Spreadsheet.Cell cell = worksheetPart.Worksheet.Descendants<DocumentFormat.OpenXml.Spreadsheet.Cell>()
                       .Where(c => reference.Equals(c.CellReference))
                       .FirstOrDefault();
            if (null == cell)
                return "";
            return GetValue(cell, stringTablePart);

        }
        private string GetValue(DocumentFormat.OpenXml.Spreadsheet.Cell cell, DocumentFormat.OpenXml.Packaging.SharedStringTablePart stringTablePart)
        {
            if (cell.ChildElements.Count == 0)
                return null;
            //get cell value
            string value = cell.CellValue.InnerText;
            //Look up real value from shared string table
            if ((cell.DataType != null) && (cell.DataType == DocumentFormat.OpenXml.Spreadsheet.CellValues.SharedString))
                value = stringTablePart.SharedStringTable.ChildElements[Int32.Parse(value)].InnerText;
            return value;
        }
    }
    internal class DefinedNameVal
    {
        public string Key { get; set; }
        public string SheetName { get; set; }
        public string StartColumn { get; set; }
        public string StartRow { get; set; }
        public string EndColumn { get; set; }
        public string EndRow { get; set; }
    }

    internal class ExcelDataSet
    {
        public string Name { get; set; }
        public string DisplayText { get; set; }
        public string Type { get; set; }
    }
    internal interface IExcelReader
    {
        void Extract(string partId);
    }
    internal class ExcelReader : IExcelReader
    {
        private IDataAccessLayer _dataAccessLayer;
        private IExcelManager _excelManager;

        public ExcelReader(IDataAccessLayer dataAccessLayer, IExcelManager excelManager)
        {
            _dataAccessLayer = dataAccessLayer;
            _excelManager = excelManager;
        }
        public void Extract(string partId)
        {
            string tempFolder = "", excelFilePath = "";
            try
            {
                string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
                Directory.CreateDirectory(tempDirectory);
                tempFolder = tempDirectory;

                //Read the file content
                string aml = "<Item action='get' type='Part File'>" +
                             "  <source_id>" + partId + "</source_id>" +
                             "</Item>";

                var partFiles = _dataAccessLayer.applyAML(string.Format("<AML>{0}</AML>", aml));
                if (partFiles.getItemCount() == 0)//there is no file available
                    return;

                var partExcelFile = partFiles.getItemByIndex(0).getRelatedItem();
                partExcelFile.checkout(tempFolder);

                //fetch data from excel
                excelFilePath = Path.Combine(tempFolder, partExcelFile.getProperty("filename"));
                var data = _excelManager.ReadSheetViaDefindNames(excelFilePath);

                //update the part properties          
                UpdatePartProperties(data, partId);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (File.Exists(excelFilePath))
                    File.Delete(excelFilePath);
                if (Directory.Exists(tempFolder))
                    Directory.Delete(tempFolder);
            }
        }
        private void UpdatePartProperties(List<ExcelDataSet> dataSet, string partId)
        {
            string partPropertyStartTemplate = "<Item type='Part Item Characteristic Value' id='{0}' action='edit'>";
            string itemCharIdTemplate = "<item_characteristic_id>{0}</item_characteristic_id>";
            string displayTextTemplate = "<display_value>{0}</display_value>";
            string propertyTypeTemplate = "<item_characteristic_value_type>{0}</item_characteristic_value_type>";
            string partPropertyEndTemplate = "</Item>";
            string aml = "<Item action='get' type='Part Item Characteristic Value' select='item_characteristic_name,item_characteristic_value_type,item_characteristic_id'>" +
                        "<source_id>" + partId + "</source_id>" +
                        "</Item>";

            var partProperties = _dataAccessLayer.applyAML(string.Format("<AML>{0}</AML>", aml));
            int itemCount = partProperties.getItemCount();

            for (int i = 0; i < itemCount; i++)
            {
                //get the part property
                var partProperty = partProperties.getItemByIndex(i);
                //extract the values
                var itemCharName = partProperty.getProperty("item_characteristic_name");
                var itemCharType = partProperty.getProperty("item_characteristic_value_type");
                var itemCharId = partProperty.getProperty("item_characteristic_id");

                var charName = itemCharName.Replace(" ", "");
                var excelData = dataSet.FirstOrDefault(ds => ds.Name == charName);
                if (null == excelData)
                    continue;

                StringBuilder builder = new StringBuilder();
                builder.Append(string.Format(partPropertyStartTemplate, partProperty.getID()));
                builder.Append(string.Format(itemCharIdTemplate, itemCharId));
                builder.Append(string.Format(displayTextTemplate, excelData.DisplayText));
                builder.Append(string.Format(propertyTypeTemplate, itemCharType));
                builder.Append(partPropertyEndTemplate);

                var result = _dataAccessLayer.applyAML(string.Format("<AML>{0}</AML>", builder.ToString()));

                if (result.isError())
                {
                    throw new Exception("Unable to update the part properties relationships");
                }
            }
        }
    }
    internal interface IDataAccessLayer
    {
        Item apply(Item itemToApply);
        Item applyAML(string amlToApply);
    }

    internal class DataAccessLayer : IDataAccessLayer
    {
        private Innovator _inn;

        public DataAccessLayer(Innovator innovator)
        {
            _inn = innovator;
        }
        public Item apply(Item itemToApply)
        {
            return itemToApply.apply();
        }
        public Item applyAML(string amlToApply)
        {
            return _inn.applyAML(amlToApply);
        }
    }

    #region MethodFooter
    public void func(
                IServerConnection InnovatorServerASP,
                XmlDocument inDom,

                XmlDocument outDom
                )
    {
    #endregion