Wednesday 30 September 2015

how to remove empty line when reading text file using C#



IEnumerable<string> lines = File.ReadLines().Where(line => line != "");

or

List<string> lines = File.ReadLines().Where(line => line != "").ToList();

Sunday 20 September 2015

Not able to connect Integration Services through SSMS


Solution:
To grant access to the Integration Services service

Run Dcomcnfg.exe. Dcomcnfg.exe provides a user interface for modifying certain settings in the registry.
In the Component Services dialog, expand the Component Services > Computers > My Computer > DCOM Config node.
Right-click Microsoft SQL Server Integration Services 11.0, and then click Properties.
On the Security tab, click Edit in the Launch and Activation Permissions area.
Add users and assign appropriate permissions, and then click Ok.
Repeat steps 4 - 5 for Access Permissions.
Restart SQL Server Management Studio.
Restart the Integration Services Service.

Friday 18 September 2015

Aras Innovator create item using IOM Code

Open Aras server.
Get url of Aras Innovator from C:\Program Files (x86)\Aras\Innovator\VaultServerConfig.xml
<AppServerURL>:
Get Databased name from C:\Program Files (x86)\Aras\Innovator\InnovatorServerConfig.xml
DB-Connection
Now get User ID/Password.
Copy IOM dll from: C:\Program Files (x86)\Aras\Innovator\Innovator\Server\bin

Create a class library.
Add IOM.dll as reference.
Add below code to create a part in Aras Innovator.

   String url = "http://localhost/InnovatorServer/Server/InnovatorServer.aspx";
                        String objBb = "MyDb";
                        String loginName = "admin";
                        String pwd = "innovator";
                        HttpServerConnection conn = IomFactory.CreateHttpServerConnection(url, objBb, loginName, pwd);
                        Item login_result = conn.Login();
                        if (login_result.isError())
                            throw new Exception("Login failed");
                        Innovator myInnovator = login_result.getInnovator();
                        var partItem = myInnovator.newItem("Part", "add");
                        //var partItem = myInnovator.newItem("Part", "merge");

                        partItem.setProperty("item_number", strItemNumber);
                        partItem.setProperty("description", strObjectName);
                        var resultItem = partItem.apply();
                        Console.WriteLine("resultItem " + resultItem);
                        conn.Logout();

                        Console.Read();

Aras Innovator Create a class library

Create a class library.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyClass
{
    public class DemoClass
    {

        public string strMy = "";
        public DemoClass(string s)
        {
            this.strMy = s;
        }

        public string GetMethod()
        {
            return "Hell world" + strMy;
        }

    }
}
Note: your class should be public.
Build
Copy the dll.
Go to Aras Server.
Paste your dll in this path: C:\Program Files (x86)\Aras\Innovator\Innovator\Server\bin
Now go to this path and open method-config.xml file.
C:\Program Files (x86)\Aras\Innovator\Innovator\Server\method-config.xml
In the xml file, go to this tag:
<MethodConfig> <ReferencedAssemblies>
Add new tag similar to : <name>$(binpath)/Conversion.Base.dll</name>
Now change dll name: ex: <name>$(binpath)/MyClass.dll</name>
Now in the same file, scroll down.
You will see name space section, where all .net name spaces are added.
Add your dll name space.
Ex: using MyClass;
Do for all references.
Save.
Now Open Aras Innovator from web UI.
Go to Administration

Methods
Right click: New Method
Enter method name,
Select Server-side
Select C#

Now use below IOM code.
IOM Code.
MyClass obj=new MyClass ("Welcome from aras");
Innovator innovator = this.getInnovator();
return innovator.newResult( obj.GetMethod());
Check the syntax.


Run the code using.
Actions-->Run Server Method.
You will get output.
How to set above code to an Item?
First create an Action.
In the action-->It will ask name, enter name.
It will ask method, Enter method name which you have created in earlier.
Save.
Now go to item.
Search for any item ex: “Parts”
Now open part.
Unlock
Under actions, add new action.
Search for your action which you have created.
Save.
Now go to Design
Parts
Search for any part.
Right click on the part you will see your action name.
Click it.




Thursday 3 September 2015

How to delete Manufacturer Part

Go to Sourcing
Manufacturer Part
Search for "Manufacturer Part"
Delete
If you are getting any error then Manufacturer Part has used in some parts.

Right click on "Manufacturer Part", click "Where Used"
You will get all part numbers..
Now go to parts
Search for "part" which used Manufacturer Part
Open part
Click on elated changes
Click on ECO
Open ECO
Lock ECO
Under Affected Item
Select all Affected Items
delete
Save
Now go to Manufacturer Part
Delete




Tuesday 1 September 2015

Aras innovator The underlying connection was closed: An unexpected error occurred on a send

Error:
aras innovator The underlying connection was closed: An unexpected error occurred on a send

<faultcode>999</faultcode>

Solution:
Case 1:
Comment below line.
//if(System.Diagnostics.Debugger.Launch()) System.Diagnostics.Debugger.Break();  //enable/disable the debugger as required

Since you have added debugger, IIS is not responding. So stop debugger.

Case 2: Your AML is takeing more time to execute, IIS is not responding.
So increase IIS Connection Time-out
Open IIS
Expand Sites
Default Web Site-->Right click "Manage website"-->"Advanced Settings"-->Limits-->
Connection Time-out(seconds)
Change to 600 or 1200

Ideally 3 places you will see time out error in Aras

11.Client timeout – If you have developed any application using C#, then you have to increase the timeout value.
     Innovator innovator
     HttpServerConnection connection = IomFactory.CreateHttpServerConnection(“...”, “…”, “…”, “…”);
            connection.Timeout = 10000000;
            ServicePointManager.MaxServicePointIdleTime = 10000000;
            ServicePointManager.MaxServicePoints = 4;
            Item loginOItem = connection.Login();

22. IIS timeout -If you are using any AML code, then you may get timeout error, for that increasing website from 120 to 1800
·         Open IIS
·         Expand Sites
·         Default Web Site-->Right click "Manage website"-->"Advanced Settings"-->Limits-->
·         Connection Time-out(seconds)
·         Change to 600 or 1200
33.SQL timeoutIf you are using any AML code or SQL, then you may get timeout error , for that increasing from 600 to 3000
·         Login to SQL server management studio
·         Connect to sql server
·         Right click on sql serveràPropertiesàConnections
·         Remote query timeout give 600 or 1200

Note: It's always recommended to set back IIS and SQL timeout values as is, after completion of your task