Archive for May 2009


Crystal Reports Web Deployment Gözükmeyen Resimler – Grafikler

May 26th, 2009 — 7:37am

CrystalDecisions.Web.CrystalImageHandler web config’den tanıtılmadığı için grafikleri göremiyor olabiliriz.

uygun versiyonda handler’ı ekleyerek aşabiliriz.

 
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" 
        type="CrystalDecisions.Web.CrystalImageHandler, 
       CrystalDecisions.Web, Version=10.2.3600.0, 
       Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>

toolbar’daki resimler gözükmüyorsa,
server’da inetpub klasöründe aspnet_client klasörü var. O klasörü projenizin çalıştığı klasöre kopyalayarak aşabiliriz.

Comments Off on Crystal Reports Web Deployment Gözükmeyen Resimler – Grafikler | Asp.Net

C# ile EAN 13

May 8th, 2009 — 5:23am

Bu yazıda, EAN-13 (European Article Number) standardında barkot oluşturan ve oluşturduğu barkottan geri dönüş (encode / decode) yapan örnek kodu bulacaksınız.

linkler
codeproject
wikipedia

using System;
using System.Text;
 
public static class Ean13BarcodeHelper
{
public static string EncodeData(string inData)
{
    if (inData.Length != 12)
        throw new ApplicationException("Barkod data uzunluğu hatalı");
 
    for (int i = 0; i < inData.Length; i++)
    {
        if (!char.IsDigit(inData[i]))
            throw new ApplicationException("Barkod data numerik değil");
    }
 
    char[] outData = new char[12];
    for (int i = 0; i < 12; i++)
    {
        outData[i] = inData[i];
    }
 
    outData[0] = (char)(((byte)inData[0]) - 13);
    for (int i = 7; i < inData.Length; i++)
    {
        outData[i] = (char)(((byte)inData[i]) + 49);
    }
 
    char[] B3_B7 = GetB3_B7(inData);
    char BCSUM = (char)(((byte)CheckSum(inData)) + 49);
 
    StringBuilder sb = new StringBuilder();
    sb.Append(outData[0]);
    sb.Append("!");
    sb.Append(outData[1]);
    sb.Append(B3_B7);
    sb.Append("-");
    for (int i = 7; i < 12; i++)
    {
        sb.Append(outData[i]);
    }
    sb.Append(BCSUM);
    sb.Append("!");
    return sb.ToString();
}
 
public static string DecodeData(string inData)
{
    StringBuilder sb = new StringBuilder();
 
    sb.Append((char)(((byte)inData[0]) + 13));
    sb.Append(inData[2]);
    sb.Append(UndoGetB3_B7(inData));
 
    for (int i = 9; i < 14; i++)
    {
        sb.Append((char)(((byte)inData[i]) - 49));
    }
    return sb.ToString();
}
 
private static char CheckSum(string inData)
{
    int CSUM1 = 0;
    int CSUM_TEK = 0, CSUM_CIFT = 0, CSUM_TOP = 0;
    for (int jj = 0; jj < 6; jj++)
    {
        CSUM_TEK = Convert.ToInt32(inData.Substring(jj * 2, 1));
        CSUM_CIFT = Convert.ToInt32(inData.Substring(jj * 2 + 1, 1));
        CSUM_TOP += CSUM_TEK + (CSUM_CIFT * 3);
    }
 
    CSUM1 = ((10 - (CSUM_TOP % 10)) % 10);
    return CSUM1.ToString()[0];
}
 
private static char[] UndoGetB3_B7(string inData)
{
    char[] B3_B7 = null;
 
    char B0 = ((char)(((byte)inData[0]) + 13));
 
    char B2 = inData[3];
    char B3 = inData[4];
    char B4 = inData[5];
    char B5 = inData[6];
    char B6 = inData[7];
 
    switch (B0)
    {
        case '0':
            B3_B7 = new char[5] { B2, B3, B4, B5, B6 };
            break;
        case '1':
            B3_B7 = new char[5] { B2, UndoBC3(B3), 
                        B4, UndoBC3(B5), UndoBC3(B6) };
            break;
        case '2':
            B3_B7 = new char[5] { B2, UndoBC3(B3), 
                        UndoBC3(B4), B5, UndoBC3(B6) };
            break;
        case '3':
            B3_B7 = new char[5] { B2, UndoBC3(B3), 
                        UndoBC3(B4), UndoBC3(B5), B6 };
            break;
        case '4':
            B3_B7 = new char[5] { UndoBC3(B2), B3, 
                        B4, UndoBC3(B5), UndoBC3(B6) };
            break;
        case '5':
            B3_B7 = new char[5] { UndoBC3(B2), 
                        UndoBC3(B3), B4, B5, UndoBC3(B6) };
            break;
        case '6':
            B3_B7 = new char[5] { UndoBC3(B2), UndoBC3(B3), 
                        UndoBC3(B4), B5, B6 };
            break;
        case '7':
            B3_B7 = new char[5] { UndoBC3(B2), B3, 
                        UndoBC3(B4), B5, UndoBC3(B6) };
            break;
        case '8':
            B3_B7 = new char[5] { UndoBC3(B2), B3, 
                        UndoBC3(B4), UndoBC3(B5), B6 };
            break;
        case '9':
            B3_B7 = new char[5] { UndoBC3(B2), UndoBC3(B3), 
                        B4, UndoBC3(B5), B6 };
            break;
    }
 
    return B3_B7;
}
 
private static char[] GetB3_B7(string inData)
{
    char[] B3_B7 = null;
 
    char B0 = inData[0];
 
    char B2 = inData[2];
    char B3 = inData[3];
    char B4 = inData[4];
    char B5 = inData[5];
    char B6 = inData[6];
 
    switch (B0)
    {
        case '0':
            B3_B7 = new char[5] { B2, B3, B4, B5, B6 };
            break;
        case '1':
            B3_B7 = new char[5] { B2, BC3(B3), B4, 
                                    BC3(B5), BC3(B6) };
            break;
        case '2':
            B3_B7 = new char[5] { B2, BC3(B3), BC3(B4), 
                                    B5, BC3(B6) };
            break;
        case '3':
            B3_B7 = new char[5] { B2, BC3(B3), BC3(B4), 
                                    BC3(B5), B6 };
            break;
        case '4':
            B3_B7 = new char[5] { BC3(B2), B3, B4, 
                                    BC3(B5), BC3(B6) };
            break;
        case '5':
            B3_B7 = new char[5] { BC3(B2), BC3(B3),
                                    B4, B5, BC3(B6) };
            break;
        case '6':
            B3_B7 = new char[5] { BC3(B2), BC3(B3), 
                                    BC3(B4), B5, B6 };
            break;
        case '7':
            B3_B7 = new char[5] { BC3(B2), B3, BC3(B4), 
                                    B5, BC3(B6) };
            break;
        case '8':
            B3_B7 = new char[5] { BC3(B2), B3, BC3(B4), 
                                    BC3(B5), B6 };
            break;
        case '9':
            B3_B7 = new char[5] { BC3(B2), BC3(B3), B4, 
                                    BC3(B5), B6 };
            break;
    }
    return B3_B7;
}
 
private static char UndoBC3(char B)
{
    return (char)(((byte)B) - 17);
}
 
private static char BC3(char B)
{
    return (char)(((byte)B) + 17);
}
}

Comments Off on C# ile EAN 13 | Csharp - C#


Back to top