Archive for ‘.NET’

July 14, 2013

The dilemma of Double-Hop Dogma

Was wondering about the subject of the post which i am going to write. okay fine and its Double Hop Dogma. This is related to Exchange Web Services API. you can download the API from this link. Let me explain what happened. There was a requirement raised due to the fact that we cant view OWA websites (Outlook Webmail) inside an IFRAME. When we used the OWAInputWebPart the owa site used to display within the ifram of the OWAInputWebPart. Hence there was an exception saying that it cannot be displayed within IFRAME. So as a solution we had to develop our own custom web part to view the inbox emails.

Initially i was playing around with a single mail box and was able to fetch the mails without any problem. I refered this MSDN article for my reference.

binding.Credentials = new NetworkCredential("userid", "password", "domain");

So the above code works fine and was able to read the emails. As the next step the requirement was to read the emails based on the currently logged in user in Share Point. So started working on a new web part for this.

as per the link it says that…

If you want to connect to EWS from a computer that is logged on to the domain, using the credentials of the authenticated user, set the UseDefaultCredentials property on the ExchangeService object to true.

// Connect by using the default credentials of the authenticated user.
service.UseDefaultCredentials = true;

i kept trying the above code to work but unfortunately it didn’t work. I spent full whole day trying on this. I searched on the web and found the blog post about the double hop dogma. it says “The user who’s browsing the application from a client machine passes his credentials to the IIS server, i.e. the credentials of the user hop from the client to the IIS server. Subsequent to that, when the IIS application executes EWS calls, it is supposed to pass those same credentials to the Exchange server, to authenticate the logged on user. This works fine in the ideal scenario, and falters in alternative scenarios.”

They have mentioned following scenarios related to the above sentence as below:

Ideal scenario: Kerberos authentication method is being used within the organization
Frequent Scenarios: The non-ideal scenario is not being observed, i.e. NTLM might be the active authentication mechanism, or Kerberos could be failing and the application falls back on attempting authentication via NTLM which would eventually fail in a double-hop situation.”

In my case when i checked the active directory structure on the client site, i learnt that they are not using the Kebreros authentication instead they are using the NTLM authentication on AD.

So i came across the blog post : Need a way to authenticate to Exchange Web Services and based on the fact which explains that: “Create a service account that has either impersonation rights or delegate access over the employee mailboxes. Then log in as the service account.” I advised the network administrator to create a service account for me. Uplon creating the account i resumed my work as usual.

// Setup connection string
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
service.Credentials = new NetworkCredential("superadmin", "password", "domain");

Impersonating the service using a difference user id.

// Impersonation
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "useremail1@domain.com");

In this place i was able to get the currently logged in user by executing the following code

HttpContext.Current.User.Identity.Name.ToString()

Finally was able to retrieve mail details as below:

SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));

var inbox = new FolderId(WellKnownFolderName.Inbox);
var iv = new ItemView(9999);

FindItemsResults<Item> findResults = service.FindItems(inbox, searchFilter, iv);

if (findResults.Items.Count > 0)
{
foreach (Item item in findResults.Items)
{
mailboxDetails a = new mailboxDetails();
a.Subject = item.Subject;
}
}

Refer example post here by Jens Willmer.

Please refer the following articles to understand about Exchange Impersonation:

Delegate Access with Exchange Web Services

Exchange Impersonation vs. Delegate Access

The thread i posted on MSDN

Threads which was posted by others:

Exchange Web Services (EWS), GetItem() call produces AccessDenied error

ServiceRequestException Message : Request failed. The remote server returned an error: (401) Unauthorized

Exchange Web Services: UseDefaultCredentials property

please refer some samples related to the Exchange Web Services through this link.

Exchange Tutorial Part 1 – Impresonated Exchange Service Binding

Advertisements
October 29, 2012

Google Map Visual Web Part

Finally was able to finish the share point 2010 visual web part which i was working on. Seems the webpart looks cool. Its nothing other than JQuery and Google MAP API v 3.o with customization.

refer the google map API documentation for the v 3.0 via this link.

the interesting part of the above web part is that the markers used to fly in to the locations based on the category. you can refer the following out of the box source code below with zero customization:

http://code.google.com/

April 21, 2012

Calling Oracle WLI and BPM Web Services using .NET

Oracle Web Logic Integration is a comprehensive and flexible java-based solution that allows integrating systems, data and people within and across companies to make the most of existing assets wherever they are. This is something similar to the Microsoft BizTalk Server.

Orcale BPM is the suite which used to manage business processes and its a tool which comes with the Oracle Business Process Management Suite, is a complete set of tools for creating, executing, and optimizing business processes.

I used the WSE 3.0 implementation to go ahead with the above web service calls. You can download the WSE 3.0 for .NET from this link. You can read more about the Web Services Enhancements 3.0 from this link.

By defualt the WSE 3.0 plugin used to support the Visual Studio 2005. If you need the same addin to be added to VS 2008 or 2010 please follow this link. We use this addin to create the proxy class for the web service that we are going to use in our implementations.

I had to face lots of issues, obstacles when implementing these web service calls using C#.NET hence the resources are limited. I will do update this post soon with the code samples…

Follwing code snippet explains you the way to get the running processes in BPM.

//using directives
using System;
using Microsoft.Web.Services3.Security.Tokens;
using Microsoft.Web.Services3.Design;
using Microsoft.Web.Services3;
using System.Text;
using System.Web.Services.Protocols;
using PapiWebService;
using WLIWebService;

private void PapiWebServiceCall()
{
try
{

PapiWebService.PapiWebServiceWse proxy = new PapiWebService.PapiWebServiceWse();

//configure authentication
UsernameToken token = new UsernameToken("username", "password", PasswordOption.SendPlainText);
proxy.SetClientCredential(token);
proxy.SetPolicy("ALBPM_Policy");

//set timeout and encoding
proxy.Timeout = 60000;
proxy.RequestEncoding = Encoding.UTF8;

string[] processIds = proxy.processesGetIds(false);

foreach (string processId in processIds)
{
instanceInfoBean[] instances = proxy.processGetInstances(processId);
foreach (instanceInfoBean instance in instances)
{
lstItems.Items.Add(instance.id);
}
}

}
catch (SoapException ex)
{
OperationException oe = new OperationException(ex.Message);
throw oe;
}
}
 public class OperationException : Exception
    {
        public OperationException(String message)
            : base(message)
        {
        }

    }

please refer this How to: Secure an Application Using a Custom Policy Assertion to know about custom policy assertion.

February 14, 2012

ASPXPageControl tabbing problem

I Was working with the ASPXPAgeControl to dispaly some tabbed pages in the website.

Based on some user roles I had to enable/disable some tabs. There were two properties with this ASPXPageControl viz .visible property and the .clientvisible property. Initially i was playing around the .visible property and it didnt give me a proper results when i made visible=true after doing a visble =false. Hence at the time of makeing the visible true of the tabbed pages it started to show me all the hidden tabs even.

So i switched to the .clientvisible property. This was works fine, but the problem is this used to show all the tabs to the user initially and then one by one it started to hide based on the condition. anyhow this is the by default functoinality of the control.

So started to search little bit deeper into the .visible property of the control and was able to find a property named  EnableHierarchyRecreation.

If we are using the .visbile property, make sure to make the EnableHierarchyRecreation to true to make sure that you wont face a situation where i did explained above.

 

February 13, 2012

PageRequestManagerParserErrorException

Was getting the above error at the time of exporting an excel file using the ASPxGridViewExporter. I had a tab control (ASPxPageControl) with some ASPxGridView controls inside all the tab pages. So using the ASPxGridViewExporter when i tried to export an excel file was battered with the following error every time when i tried to export.

Sys.WebForms.PageRequestManagerParserErrorException:  The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. To sort out the problem you had to register the control which triggers the postback in the page init of the page. The code as follows.

<br />
protected void Page_Init(object sender, EventArgs e)<br />
{<br />
RegisterPostBackControl();<br />
}</p>
<p>private void RegisterPostBackControl()<br />
{<br />
ScriptManager sm = (ScriptManager)Page.Master.FindControl(&quot;MainScriptManager&quot;);<br />
sm.RegisterPostBackControl(ASPxPageControl1);<br />
}

please refer the KB article.

PageRequestManagerParserErrorException – what it is and how to avoid it

January 29, 2012

Accessing a control inside a Loginview

you can access a control which is inside a login view using the following code:

 ASPxNavBar MyNavigationControl = (ASPxNavBar)viewPreSales.FindControl("nbMenuSPISPreSales");
January 22, 2012

The specified forest does not exist or cannot be contacted

I was trying to get the active directory group details of a user for me to authenticate an Application. The scenario is that when the server machine lives in another domain than the domain your machine is connected to.

The following code was works fine when i am in the same domain as the concerned domain which i am testing the application:

/// <summary>
        /// Gets a list of the users group memberships
        /// </summary>
        /// <param name="sUserName">The user you want to get the group memberships</param>
        /// <returns>Returns an arraylist of group memberships</returns>
        public static ArrayList GetUserGroups(string sUserName)
        {
            ArrayList myItems = new ArrayList();
            UserPrincipal oUserPrincipal = GetUser(sUserName);

            PrincipalSearchResult<Principal> oPrincipalSearchResult = oUserPrincipal.GetGroups();

            foreach (Principal oResult in oPrincipalSearchResult)
            {
                myItems.Add(oResult.Name);
            }
            return myItems;
        }

if not it means when the domain is different, you will get the error “The specified forest does not exist or cannot be contacted.”.

for you to sort out the above error assuming I am in a different domain at the same time the testing domain is different:

/// <summary>
        /// Gets a list of the users group memberships
        /// </summary>
        /// <param name="sUserName">The user you want to get the group memberships</param>
        /// <returns>Returns an arraylist of group memberships</returns>
        public static ArrayList GetUserGroups(string sUserName)
        {

            ArrayList myItems = new ArrayList();
            UserPrincipal oUserPrincipal = GetUser(sUserName);

            PrincipalSearchResult<Principal> groups = oUserPrincipal.GetAuthorizationGroups();
            var iterGroup = groups.GetEnumerator();
            using (iterGroup)
            {
                while (iterGroup.MoveNext())
                {
                    try
                    {
                        Principal p = iterGroup.Current;
                        myItems.Add(p.Name);
                    }
                    catch (NoMatchingPrincipalException pex)
                    {
                        continue;
                    }
                }
            }
            return myItems;
        }
May 11, 2011

Passing NULL values to SQL Server, SQLDateTime and DateTIme

DateTime.MinValue indicates a NULL value in .NET. When you tried to insert the same to SQL Server you will come up with an over flow error saying only allowed values are in between the range 1/1/1753 to 12/31/9999. But in .NET the DateTime type can accept the date time values in between 0:00 1/1/000 (MinValue) and 23:59 12/31/9999 (MaxValue). That is why we are getting the error “SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM”.

The work around would be like this : if you need to pass NULL value to a datetime field from the .NET code behind pass the DateTime.Min value to the variable, and then at the time of assigning the same to SQL parameter check for that DateTime.Min value and assign the DBNull.Value when inserting.


if (strStartDate.Contains("1/1/0001 12:00:00 AM"))
 {
 comm.Parameters.Add(new SqlParameter("@startDate", SqlDbType.VarChar)).Value = DBNull.Value;
 }
 else
 {
 comm.Parameters.AddWithValue("@startDate", Employee.StartDate);
 }

May 11, 2011

DevExpress : Cannot unregister UpdatePanel with ID ‘UpdatePanel1’

I was using the DevExpress tab control and was suddenly came across the error : “Cannot unregister UpdatePanel with ID ‘UpdatePanel1’ since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported. Parameter name: updatePanel”

the solution to the above error instead of the line


tabControl.TabPages['abc"].Visible = false;

//Or setting

tabControl.TabPages['abc"].Enabled = false;

change to


tabControl.TabPages['abc"].ClientVisible = false;

//Or setting

tabControl.TabPages['abc"].ClientEnabled = false;

refer this link for more details.

April 6, 2011

Import data from Excel (.xls/xlsx)

If you need to read data from Microsoft Excel file you can use the following code snippet.

 private void LoadExcelData()
 {
 try
 {
 string strPath = lblExcelPath.Text.Trim();

 if (strPath != "")
 {

 string strConn = GetConnString(strPath);
 string strExcelSheetName = ddlTemplates.SelectedItem.ToString();
 OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [" + GetExcelSheetNames(strPath)[0] + "]", strConn);
 DataSet myDataSet = new DataSet();
 myCommand.Fill(myDataSet, "ExcelInfo");
 Session["myDataSet"] = myDataSet;
 GridView1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView;
 GridView1.DataBind();
 }
 else
 {
DisplayUIMessage("Select a excel file to Upload", MessageType.Information);
 }
 }
 catch (Exception ee)
 {
 LoggingProvider.Log(ee.Message, TraceEventType.Error, ApplicationLayer.UserInterface, LoggingMode.Debug);
 return;
 }
 }

the way to read data from a excel sheet.

 private static String[] GetExcelSheetNames(string excelFile)
 {
 OleDbConnection objConn = null; System.Data.DataTable dtExcel = null;
 try
 {
 String connString = GetConnString(excelFile);
 objConn = new OleDbConnection(connString);
 objConn.Open();
 dtExcel = objConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
 if (dtExcel == null)
 {
 return null;
 }
 String[] excelSheets = new String[dtExcel.Rows.Count];
 int i = 0;
 foreach (DataRow row in dtExcel.Rows)
 {
 excelSheets[i] = row["TABLE_NAME"].ToString();
 i++;
 }
 return excelSheets;
 }
 catch (Exception ex)
 {
 return null;
 }
 finally
 {
 if (objConn != null)
 {
 objConn.Close();
 objConn.Dispose();
 }
 if (dtExcel != null)
 {
 dtExcel.Dispose();
 }
 }
 }

As well as as i had to deal with both MS Excel 2003 and 2010 formats file and was using the following method to pick the proper connectionstring.


private static String GetConnString(string excelFilePath)
 {
 String connString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + excelFilePath + ";Extended Properties=Excel 8.0;";

 if (excelFilePath.Contains("xlsx"))
 {
 connString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + excelFilePath + ";Extended Properties='Excel 12.0 Xml; HDR=YES; IMEX=1';";
 }
 return connString;
 }

Usually when you specify connectionstring to load a excel file, the header columns in the excel file will be the Columns Names in your Dataset. But when you used the following connectionstring the header columns will be returned as the first data row of the dataset. for that you have to set the HDR value to NO.


private static String GetHeaderConnString(string excelFilePath)
 {
 String connString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + excelFilePath + ";Extended Properties='Excel 12.0 Xml; HDR=NO; IMEX=1';";
 return connString;
 }
December 30, 2010

H56H1R/ H56HSR Wrapper Programs

H56H1R/ H56HSR Wrapper

The above wrapper accepts following parameters at the time of calling the program. The same following list applies when calling the program H56HSR.

These are the parameters and the details you can find below.

  1. @RPGM – Function identifier
  2. @BRNM – Input branch
  3. @USID – User identifier
  4. @WSID – Workstation identifier
  5. @JTT – Function type
  6. DSAIM – Transaction serialisation
  7. @RREC – Return code
  8. @RMES7 – Error Message
  9. AOW – Warning Messages
  10. @ETK – Enigma transaction
  11. @ETN – Enigma transaction number
  12. @AEXT – Apply transaction during external input
  13. @AREC – Apply transaction during recovery

Function identifier

@RPGM – A(10)

This mandatory input field is used to identify the function API that is to be used.

Positions 1-6 must contain the name of the function’s API module to be used to process the transaction. For details of function API module names see the earlier section Function identification.

Positions 7-10 will normally be blank. However positions 7-9 may be used to specify an Equation option identifier. This is required when the same module is used to process two types of input, for example Open Customer Account and Open Internal Account. Specifying the option identifier ensures the correct option description appears on the journal report. It does not affect processing

Input branch

@BRNM – A(4)

This optional input field defines the default branch mnemonic for user entering the transaction.

The default is derived from the user profile of the job being used to call the API.

User identifier

@USID –  A(4)

This optional input field is used to identify the user entering the transaction.

The default is the user profile of the job being used to call the API.

As an Equation user’s branch and other regional settings are often read once only by Equation programs in their initialization, sometimes changing the @USID throughout the lifecycle of transaction entry through one job may lead to unexpected results.

Workstation identifier

@WSID – A(4)

This optional input field is used to identify the workstation from which the transaction is being entered.

The default is the workstation of the job being used to call the API.

If any transactions are applied using on line external input during the day phase that would be actually called again during recovery (for example if called from an update user exit procedure) it is recommended that the field is set to @GEN’ for inline processes and @ASN’ for asynchronous processes.

If any translations are applied during the C15 phase of the end of day that would be executed again during recovery processing it is recommended that the field is set to ‘@EOD’.

This will ensure that the transactions appear on the Equation journal reports but in the event of recovery transactions where the @WSID is @ASN’, @GEN’ or @EOD’ are ignored.

Function type

@JTT – A(1)

This mandatory input field is used to identify the type of transaction to be executed.

A             Add transaction

M             Maintain an existing transaction

D             Delete or cancel an existing transaction.

Transaction serialisation

DSAIM – A(9999)

This mandatory input field is used to pass the details of the transaction to be entered. This is in the format of the journal detail file for the transaction type being processed.

The external system must ensure that each packed field passed across the interface into Equation contains valid numeric data. It must ensure that transaction identifiers such as deal references contain only characters in upper case.

Note that the key fields usually in positions 1-17 of all journal detail files are passed as blanks. If values are set up in these fields they are ignored. For further details see the individual journal file descriptions.

DSAIM must contain the data necessary for the transaction.

If the transaction would result in a continuation record on the GZVF1P file, the data from position 36 on the continuation record must be added to the end of the DSAIM parameter. The data must be added to overlap at the position of the hexadecimal x’0E’ delimiter character at the end of the initial transaction.

Return code

@RREC – A(1)

This returned parameter is a status indicator returned by the function API.

R             The transaction was processed successfully

F    The transaction failed.

Error Message

@RMES7  – A(37)

This returned parameter provides details of the first error message received by the recovery module. This field will only ever be returned if @RREC contains an F. The errors will be the standard Equation KSM messages that are catalogued in the message file KSMMSGF.

Up to three blocks of substitution text are returned for inclusion in the message. Each can be 10 characters long and relate to variables &1, &2 and &3 in the message. To determine the error message details, look up the message identifier on the System Messages List (see the Report Tailoring Guide).

1 – 7        KSM message identifier

8 – 17     Message parameter one

18 – 27  Message parameter two

28 – 37  Message parameter three

Warning Messages

AOW – A(740)

This returned parameter provides details of up to twenty warning messages that the function API module has automatically overridden.

The parameter is made of 20 blocks of 37.

1 – 7        KSM message identifier

8 – 17     Message parameter one

18 – 27  Message parameter two

28 – 37 Message parameter three

Enigma transaction

@ETK – A(4)

Not used.

Enigma transaction number

@ETN – S(7,0)

Not used.

Apply transaction during external input

@AEXT – A(1)

This optional Y/N indicator determines if the API should be applied during batch external input.

Apply transaction during recovery

@AREC – A(1)

This optional Y/N indicator determines if the API should be applied during Equation recovery.

Basically the equation units uses string (A), packed(P) and zoned type(S) of values. In other words the stings will be the normal texts, the packed are the numeric/decimal data and the zoned are the date values. A(10) means the data type of the field is string with the length of 10 digits. S(7) means the data type of the field is date and its length is 7 digits (including the century) with no decimal values. P(15,3) means the data type of the field is decimal and the length is 15 digits and it accepts 3 decimal places.

References: Misys Documentation

December 29, 2010

Calling AS/400 (AS400) RPG Programs using .NET

IBM’s iSeries Client Access provides a library named cwbx.dll (you will find the DLL in this location : c:\Program Files\IBM\Client Access\Shared\ and you need to install the IBM Client – iSeries Access for Windows to find the DLL,  Install IBM iSeries Access to Windows. Also check for service packs updates if there any from this link.) , which makes it possible to call RPG programs running on an AS/400 from any Microsoft .NET application. Basically we have to call equation related enquiry and posting wrapper programs used in DB2 through our .NET application or component . There are scenarios where we may have to execute direct DB calls  as we are doing in TSQL/PLSQL instead solely depending on only Equation API enquiry calls. In such cases we have to use the same IBMDA400 data provider to establish the connection between the application and the Equation Database.

Each Posting APIs are wrapped by following ILE (Integrated Language Environment) programs as mentioned below:

  • X56H1R
  • X56HMR
  • H56HSR

In addition to the posting APIs each enquiry APIs are wrapped by an ILE program as mentioned below:

  • H46HMR

The input parameters that we should pass to the above mentioned wrappers are different to each other. In other words the parameters that we should pass for the posting programs are different than for the Inquiry program.

just refer this link for start up.

iSeries Access for Windows

July 26, 2010

Error: This row already belongs to another table

I came across a situation where i had to loop through one of the DataTable and to import the same data into another datable where the data order is different. I was trying to do it but the data is not getting copied to the new DataTable. What I have found out is that you can’t just add rows from one DataTable to another. Initially the table structure must be Cloned and then the rows has to be imported. Cloning the DataTable clones the structure including all DataTable schemas and constraints.

DataTable newTable = new DataTable("Sorted");
newTable = transactionHistoryTable.Clone();
for (int j = transactionHistoryTable.Rows.Count - 1; j &gt;= 0; j—)
{
newTable.ImportRow(transactionHistoryTable.Rows[j]);
}
_dsResponse.Tables.Add(newTable);

as a summary what i am doing is, initially the data what i have is some data in some order which was populated from AS400 API. I need the same data other way around, bottom to top (For ex: transactionHistoryTable has some data and i need to traverse it back).

May 30, 2010

Calling AS400 RPG Programs using C#

Throughout last few months i had a chance to work with AS400, Equation APIs. The purpose of these equations calls are that we have to develop WCF services on top of these API calls. These calls will be consumed by the BizTalk. Initially it was too hard as i couldn’t find any resources online. When i searched in gOOgle about the errors which come across at the time of developments, it does not return anything! It was some hard times and thank for my team lead for helping out on those situations. Hope to write something about  AS400, C# in coming days…

What is an AS400?

The AS/400 (Application System/400) was introduced by IBM on June 20th, 1988. Some of AS400 models are designed as Servers, while others are used as terminals or “display stations”. OS400 is the operating system for the AS/400.

In October of 2000, IBM rebranded the AS/400 and announced its name as the IBM iSeries 400. AS400 uses RPG (Report Program Generator) as its own programming language. Initially the RPG originated as a report-building program used in DEC and IBM minicomputer operating systems and evolved into a fully procedural programming language.

Here is the lovely interface of Equation.

image

As the starting point refer following links :

http://www.netsplore.com/PublicPortal/Default.aspx?tabid=246

http://www.netsplore.com/PublicPortal/Blog/tabid/284/EntryID/13/Default.aspx

November 9, 2009

Cannot implicitly convert type ‘System.DBNull’ to ‘int’

There will be situations where you have to set null values to an Integer field. So when you tried to assign a DBNull.Value to an integer varialbe you will prompt for the error : “Cannot implicitly convert type ‘System.DBNull’ to ‘int’ “.

to resolve this matter, let it be as its in the interface level, but at the time of passing the parameter to the Database just make it DBNull.Value.

‘With your command object

1: myCmd.Parameters.Add(“@myParameter”,SQLDBType.INT).Value = IIf(myTextBox.Text <> “”, myTextBox.Text, DBNull.Value)

another code snippet :
  1. if (Employee.EmployeeManagerID == 0) { AddParameter(“@EmployeeManagerID”, DBNull.Value, DbType.Int32, null, ParameterDirection.Input); } else AddParameter(“@Manager”,Employee.EmployeeManagerID, DbType.Int32, null, ParameterDirection.Input);

 

 

February 10, 2007

POS for .NET and OPOS

OPOS is an existing implementation of UPOS for Microsoft Windows, based on Component Object Model (COM) technology. POS for .NET constitutes an improved, next-generation implementation of UPOS for Microsoft Windows, based on .NET. In comparison to OPOS, POS for .NET increases productivity of developers of both POS applications and service objects, by providing all the benefits of .NET managed code while at the same time exposing a set of easy to use interfaces and base classes.

POS for .NET is backward-compatible with OPOS version 1.8 service objects. In other words, applications using POS for .NET can simultaneously interact with .NET service objects written for POS for .NET and OPOS service objects.

POS for .NET Device Basic Classes

Each hardware device in POS for .NET is represented by both an abstract interface, such as CashDrawer class, and a “basic” class, such as CashDrawerBasic. Basic classes derive from the underlying interface and contain basic functional support for the device. POS for .NET provides generic support for opening, claiming, and enabling the device; device statistics; and management of delivery of events to the application. In addition, each basic class contains a set of inherited and protected methods that can be implemented by the service object. This topic provides summary information about basic classes that can be used by service objects that wish to derive from the device’s basic class, rather than taking advantage of the more fully implemented device base class

http://msdn2.microsoft.com/en-us/library/ms827970.aspx

February 6, 2007

New ConfigurationManager in VS 2005

Using .NET Framework 1.1 i have used following code to pull a encrypted connection string from the app.conf file, I used….
System.Configuration.ConfigurationSettings.AppSettings[“connstr”].ToString();


And the compiler gave me the following error.
Warning 1 ‘System.Configuration.ConfigurationSettings.AppSettings’ is obsolete: ‘This method is obsolete, it has been replaced by ConfigurationManager.AppSettings’

So I try and change my Code to the following …
System.Configuration.ConfigurationManager.AppSettings[“connstr”].ToString();

and I get a compiler error, saying the compiler can’t find ConfigurationManager.

Well here’s the confusion…. The Original System.Configuration.ConfigurationSettings class is found in the System.dll assembly. There is a new assembly with all the new ConfigurationManager classes as System.Configuration.dll. Before using the ConfigurationManager class, you must first set a reference to the new System.Configuration.dll.

Add a reference to System.Configuration by clicking Project -> Add Reference… and searching through the .NET components for System.Configuration

January 5, 2007

.NET Framework 3.0 is released!

The .NET Framework 3.0 has officially been released! You can download the .NET Framework 3.0 components here:

.NET Framework 3.0 Runtime Components
Windows SDK for Vista and the .NET Framework 3.0
Visual Studio 2005 Extensions for .NET Framework 3.0 (Windows Workflow Foundation)
Visual Studio 2005 Extensions for .NET Framework 3.0 (WCF & WPF), November 2006 CTP

Note, if you are using Windows Vista the .NET Framework 3.0 Runtime Components are installed by default.