Category Archives: Software Developing

Json Parser

One of my friend asked me what can be a good JSON parser. In past i’ve used Json.Net from NewtonSoft. It is a good an very strong library to use. Is simple to implement as you want.

I’ve attached an project sample, with what i’ve used in my work project. Project for test. Don’t forget to modify it as you want.  

Posted in C#.

Get Date Entity

I’ve created an scalar function who returns the following date parts: year, month, day, quarter, week, hour, minute, second, day of year, day of week, date format (yyymmdd, yymmdd, ddmmyyyy, ddmmyy, ddmm, mmdd).

The example of usage is:

The result for this is something like this. Don’t forget to create also the function “FormatDate”  from the previous post. Enjoy and feel free to modify it as you need. 🙂

Posted in MSSQL.

Format Date

Next i show to you an scalar function who should return an text  with the date. The format of the date is according to the  @FormatMask  parameter.

The execution for this function should be something like this.

I’ve created an SP for testing this function.

Result of execution is the following.   Feel free to modify it as you need. 🙂

Posted in MSSQL.

EAN13 Middle Check Digit

In one of my job project, i’ve needed to implement the middle check digit for EAN13. If you search on internet nobody will tell you how to determine the digit. On of my foreign collegues from Bizerba, gave me the mecanism for the digit calculation. I’ve attached the source code for my implemention. Enjoy and don’t forget to modify it as you need. 🙂

Posted in C#.

Business Entity, Data Access Object,Business Component

In this article i will present my implementation for Business Entity and Data Access Object. Generally the access to database object, should be separated in 2 or more layers. In my case i’ve created only 2 layers – DAO and BC. Business Entity – according to MSDN article, the object should be an representation of data. In my case i’ve created an CommonDatabase class who implements ICloneable and IDisposable interfaces. This object is always Serializable.

The Business Entity Object is defined as an inherit object from CommonDatabase:

The Data Access Object – is generally an class who can access the database and execute the Insert,Update,Delete,Select functions. As following …

Continue reading

Posted in C#.

Reorganize Indexes

This stored procedure reorganize the indexes for the DB_Name() – DB_ID() 🙂 I don’t remember from where i took some parts for this stored procedure. I’ve modify it according to my need in order to be used. I generally use this SP in a maintenance plan from RBCGxServerGeneral – RBC Etiqette

The procedure can be modified so that should reorganize indexes with an specific maximum fragementation percentage. Now this SP, reorganize indexes who are fragmented with more then 5 %. The execution of this SP should be as following.

The output message should be something like this. Enjoy it, and don’t forget to modify it as you need. …

Continue reading

Posted in MSSQL.

Database Truncate Log

This stored procedure “truncates” the log file for the DB_Name().

The execution of the stored procedure is made something like this:

The result output after the execution should be as following. The message result after the execution is the next. Feel free to modify it as you need. 🙂 Enjoy  

Posted in MSSQL.

Database Backup SP

Next I present you my implementation of an stored procedure for making backup to an database. This stored procedure works very good on SQL Server 2005 Express Edition.

This stored procedure can be used like this:

The return value should be 0 in case of success, or -1 in case of error. 🙂 The output messages should look something like this:   Enjoy and feel free to modify it as you need. 🙂

Posted in MSSQL.

Expando Objects

Since C# 4.0 .Net Framework permits creation of dynamic object from xml content. On MSDN is presented an article about this new type. 🙂 This type i’ve used in a big project in order to load an xml, and use the members from the tags. I’ve created an static class who has only an public method who returns an ExpandoObject. Here is my implementation:

The usage of this class is presented next:

As you can see any type of xml content can be loaded, and then the “dynamic” object can be used like an object with members. For this type of data i’ve found an object dumper so …

Continue reading

Posted in C#.

Cross Table – Lines from Table1 are columns and Lines from Table2 are lines

When you need to create a table that imitates an cross tab in mssql – you can create a temporary table that can get the columns from an table, and the rows form another table. At the cross for this two tables, can be a bit type who can show if the relation between those two table has some value. First you need to see the  table schema. All the rows from table CodeTypes will be considered like table columns. All the rows from table CodeContents will be considered like table lines. The table CodeContentPerCodeType contains the cross values between this two tables. The mechanism for this stored procedure is …

Continue reading

Posted in MSSQL.