Thursday, December 24, 2009

We can answer on qestion: What should I wear?

I create sometime software for my wife. Usually, it's simple utility for women life.She want to be always dressed immaculately and think about each details in her outfit. But she doesn't have time to think about it every time before leaving home.
We've created a program for manage a warderobe and creating the clothing sets beforehand.Use our Victoria's Clothes Organizer that answers the perennial question: What should I wear?. This program will make you happy!

Monday, December 21, 2009

Remote warehouses and XML orders. in Golden Inventory System


You can have many storage locations in your company and you may want to automate all. You can use two approaches to this. First, install MS SQL Server and connect to it from all remote locations through the internet. You use one inventory database in this case but you must have a reliable connection to the network in all your branches.Any break down of the internet connection will lead to stop work in your branches.The second approach is that you are installing a separate database for each storage location and synchronize them using XML orders.We consider each location as your customer or reseller. We create invoices when we ship goods to your remote location. We call these invoices as internal invoices and denote their the special group "internal". Then, create copies of these files in XML format. You can download Golden Inventory software for testing this function. You can send these XML invoices via email or on any flash device with a truck driver. Personal of your remote warehouse receive XML invoices and upload them in the local inventory database using the function Add from XML file at a New Item Receipt. You'll have item receipts in remote databases as copies of invoices from the main base. This provides full synchronization of data in the main and remote databases. Golden Inventory has a lot of XML functions and you can create purchase and sales orders in the XML format.This allows you to automate your workflow with remote warehouse.

Saturday, December 19, 2009

Do you like classical piano music ?

Probably, you know that piano music is a huge area of musical culture. Beginning of piano music was laid in second quarter of XVIII century, when was designed a new keyboard-stringed instrument - piano.
The real flowering of piano music associated with the period of romanticism.
Earlier known genres was reinvented, often turning into something else: a prelude becomes an independent poetic miniatures;
romantic content and images are saturated genres of fantasy,
variations, suites, is transformed and a piano sonata concert.
There are new purely romantic genres appear.For example, musical moments and Impromptus, Nocturnes and ballads, transcribed for piano of orchestral works and songs without words.
XXI century has taught piano sound in new ways. The images of piano music appeared sharp, tight rhythms, complex melodies, new piano techniques.

Kirill Korsunenko is a bright representative of the new school of piano play. He is a pianist and composer. A lot of people love his excellent performance of Clair De Lune by Debussy

How to add a meta tag to a "child" ASP.Net page.

I usually use a master page for creation all pages in my inventory software projects. It's a good way for fast creation web pages but I had only one problem. I could not edit meta tags in project's pages because we don't see the "head" section of child pages. But search engines like to see different "description" tags on all pages. You can add any meta tag on your page using the next code snippet in the Sub Page_Load :
Dim metaTag As New HtmlMeta, metaTagD As New HtmlMeta
metaTag.Name = "keywords"
metaTag.Content = "inventory software,systems"
Header.Controls.Add(metaTag)
metaTagD.Name = "description"
metaTagD.Content = "List Receiving orders or item receipts,inventory software,systems"
Header.Controls.Add(metaTagD)

It is a simple and workable solution.You have to enter an appropriate description and keywords for each your page.

Friday, December 18, 2009

Import data from an Excel file to ASP.Net application

My customers very often ask how to import their products in our SilverNet inventory system. Usually they have Excel files in various formats. Therefore we are forced to write a new utility for each client. First we create the upload function.Add the the Label, Fileupload and Button controls to our aspx file:


<asp:Label ID="ExceptionDetails" runat="server" CssClass="Warning" EnableViewState="False"
Visible="False" Width="568px"></asp:Label>
<asp:FileUpload ID="FileUpload1" runat="server" Width="500px" />

<asp:Button ID="Button1" runat="server" Text="Upload file" Width="130px" />

Then we have to add the Button click handler to our vb file for checking uploaded files and import data in the inventory database.


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

If Not FileUpload1.HasFile Then

'-- Missing file selection

ExceptionDetails.Text = "Please choose a file to upload."

ExceptionDetails.Visible = True

ElseIf InStr(UCase(FileUpload1.FileName), ".XLS") = 0 Then

'-- Selection of non-JPG file

ExceptionDetails.Text = "You can upload only xls files."

ExceptionDetails.Visible = True

ElseIf FileUpload1.PostedFile.ContentLength > 5000000 Then

'-- File too large

ExceptionDetails.Text = "Uploaded file size must be less than 5 MB."

ExceptionDetails.Visible = True

Else

'-- File upload


Dim fileName As String = "products.xls"


FileUpload1.SaveAs(Server.MapPath("~/files/") & fileName)



Now we have uploaded the Excel file on server and we have to open this file and load all records to a dataset. Add the special function ExcelConnection:


Protected Function ExcelConnection() As OleDbCommand


' Connect to the Excel Spreadsheet

Dim xConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

"Data Source=" & Server.MapPath("~/Pictures/products.xls") & ";" & _

"Extended Properties=Excel 8.0;"


' create your excel connection object using the connection string

Dim objXConn As New OleDbConnection(xConnStr)

objXConn.Open()


' use a SQL Select command to retrieve the data from the Excel Spreadsheet

' the "table name" is the name of the worksheet within the spreadsheet

' in this case, the worksheet name is "Sheet1" and is coded as: [Sheet1$]

Dim objCommand As New OleDbCommand("SELECT * FROM [Sheet1$]", objXConn)

Return objCommand


End Function


Using this function we can extend our sub for the Button click handler:


' Create a new Adapter

Dim objDataAdapter As New OleDbDataAdapter()


' retrieve the Select command for the Spreadsheet

objDataAdapter.SelectCommand = ExcelConnection()


' Create a DataSet

Dim objDataSet As New DataSet()

' Populate the DataSet with the spreadsheet worksheet data

objDataAdapter.Fill(objDataSet)


ExceptionDetails.Visible = True

ExceptionDetails.Text = "File Uploaded"

ExceptionDetails.Text &= "File Name: " & FileUpload1.FileName & "<br/>"

ExceptionDetails.Text &= "File Size: " & FileUpload1.PostedFile.ContentLength & _
" bytes<br/>"


Now we have the dataset with data about products from the customer's Excel file but we want save all these records in our sever database. Usually we use MS SQL Server database and have the special table "Product" . Create a new function for inserting one record in the inventory database.


Function Add_ProductFull( ByVal InvDescription As String, ByVal ProductName As String, ByVal Serial As String) As long

Dim DBConnection As SqlConnection

Dim DBCommand As SqlCommand, InsCommand As SqlCommand

Dim SQLString As String, SQLInString As String, pKey As Long


DBConnection = New
SqlConnection(WebConfigurationManager.ConnectionStrings.Item(1).ConnectionString)

DBConnection.Open()

SQLString = "SELECT ProductKey FROM Product WHERE ProductName = @ProductName"

DBCommand = New SqlCommand(SQLString, DBConnection)

DBCommand.Parameters.AddWithValue("@ProductName", ProductName)

pKey = DBCommand.ExecuteScalar

'check the availability of the product in our database

If pKey > 0 Then


Add_ProductFull = pKey

Else

SQLInString = "INSERT INTO Product (ProductName,InvDescription, Serial)VALUES (@ProductName, @InvDescription,@Serial)"

InsCommand = New SqlCommand(SQLInString, DBConnection)

InsCommand.Parameters.AddWithValue("@ProductName", ProductName)

InsCommand.Parameters.AddWithValue("@InvDescription", InvDescription)

InsCommand.Parameters.AddWithValue("@Serial", Serial)

InsCommand.ExecuteNonQuery()

pKey = DBCommand.ExecuteScalar

Add_ProductFull = pKey

End If

DBConnection.Close()

End Function


It's a very simple example with three columns and you can add more fields. Sometime our customers send us file with 20-30 columns.

Finally we can finish our function for our Button handler.


Dim i As Integer = 0

Try

For i = 0 To objDataSet.Tables(0).Rows.Count - 1

Dim InvDescription As String = objDataSet.Tables(0).Rows(i).Item("Item Name").ToString

Dim Serial As String = objDataSet.Tables(0).Rows(i).Item("Serial").ToString

Dim ProductName As String = objDataSet.Tables(0).Rows(i).Item("Product ID").ToString

Add_ProductFull(ProductName, InvDescription, Serial)

Next

Catch ee As System.InvalidCastException


ExceptionDetails.Text &= "Problem with import file " & ee.Message.ToString "

Exit Sub

End Try

ExceptionDetails.Text &= objDataSet.Tables(0).Rows.Count & " records "


End If


End Sub


That is all. I think this is useful information for those who use ASP.NET in their work.

Thursday, December 10, 2009

Printing documents with GridView in IE

It's a good idea using ASP.NET web based systems for inventory and business control. But any browser is not a good place for printing documents.
I had a bit of a problem in printing GridView in Internet Explorer. I needed to print only two rows on one page. The first problem was how to break page. I used the special style
"page-break-before:always;" for the tag "br". The second problem was how to insert this unit before each odd row but exclude the first row. I used the property Container.DataItemIndex And now we have this very simple solution:
<asp:gridview....

<Itemtemplate >

<%#IIf(Container.DataItemIndex Mod 2 = 0 AND Container.DataItemIndex <> 0, "<br style=""page-break-before:always;""> ", "<br> ")%>
<div>..information....</div >
</Itemtemplate >
If you will print this gridview you will have only two rows on each page