30 Eylül 2011 Cuma

Rapor Projesi Derlenmiyorsa, ClassLibrary Hatası Veriyor İse

YNAREPORT2008 de , derlenmeyen proje varsa, rapor önizleme yapmıyorsa , ClassLibrary Hatası Veriyor İse

 

Rapor Projesini Açıyoruz..

 

YNAClassLibrary Projesini Derliyoruz.  Oluşan DLL’leri

 

C:\Projects\YENI NESIL ACENTELIK (YNA)\Genel\YnaReport2008\YNAClassLibrary\bin\Debug

 

Klasöründen kopyalayıp

 

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies

 

Klasörüne yapıştırıyoruz.

Count(*) Count(1) Count(Kolon_adi)

SELECT

       COUNT (*) CountYildiz_NulldaOlsaSayar,

       COUNT (1) Count1_Nulldahil1KabulEdpSayr,

       COUNT (D.TRANSIT_TASIMA_TIPI_ID) CountAlanAdi_NullariSaymaz,

       COUNT (DISTINCT D.TRANSIT_TASIMA_TIPI_ID) CntDistinct_NulldnFrkliKacAdt

  FROM dok_konsimento d

 

 

 

The parameter to the COUNT function is an expression that is to be evaluated for each row. The COUNT function returns the number of rows for which the expression evaluates to a non-null value. ( * is a special expression that is not evaluated, it simply returns the number of rows.)

 

There are two additional modifiers for the expression: ALL and DISTINCT. These determine whether duplicates are discarded. Since ALL is the default, your example is the same as count(ALL 1), which means that duplicates are retained.

Since the expression "1" evaluates to non-null for every row, and since you are not removing duplicates, COUNT(1) should always return the same number as COUNT(*).

27 Eylül 2011 Salı

Calling WCF Service with Service Reference

Doğru Kullanım
ServiceReference1.ArdTarifeServiceClient obj = new ServiceReference1.ArdTarifeServiceClient();
                    using (obj)
                    {
                        string s = (obj.Increment().ToString());
                    }

Daha Doğru Kullanım
bool mSuccess = false;
            ServiceReference1.ArdTarifeServiceClient obj = new ServiceReference1.ArdTarifeServiceClient();
            try
            {
                string s = obj.Increment().ToString();
                obj.Close();
                mSuccess = true;
            }
            finally
            {
                if (!mSuccess)
                    obj.Abort();
            }

Yanlış Kullanım ve Olacaklar

int t = 0;
            try
            {
                for (int i = 0; i < 500; i++)
                {
                    t = i;
                    ServiceReference1.ArdTarifeServiceClient obj = new ServiceReference1.ArdTarifeServiceClient();
                    string s = (obj.Increment().ToString());
                }
            }
            catch (Exception ex)
            {
                string hata = t + ".ci satirda : " + ex.ToString();
            }


System.TimeoutException: The open operation did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The socket transfer timed out after 00:00:59.9990000. You have exceeded the timeout set on your binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
   --- End of inner exception stack trace ---
   at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
   at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
   at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
   at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
   --- End of inner exception stack trace ---

Server stack trace:
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
   at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)





26 Eylül 2011 Pazartesi

ORACLE RECURSIVE QUERY CONNECT BY PRIOR

Örnek
ust_mal_id tablodaki başka bir kayıdı (id’yi) göstersin (seviye mal tablosu üzerindeki bir alandır. En üst seviye=1 dir ve seviye=1 olan kayıtların ust_mal_id değeri bostur).

SELECT seviye,id, ust_mal_id
FROM mal
CONNECT BY PRIOR ust_mal_id=id
START WITH ID = 25909
ORDER BY SEVIYE DESC

ÇIKTI
SEVIYE      ID    UST_MAL_ID
3           25909 24916
2           24916 25051
1           25051


Bir Function Yazarak Bu Sorguyu Program içinden kullanabiliriz

/* Formatted on 26.09.2011 15:59:27 (QP5 v5.149.1003.31008) */
CREATE OR REPLACE FUNCTION "MAL_USTMALIDLERI_BIRLESTIR" (P_MAL_ID IN NUMBER)
   RETURN VARCHAR2
IS
   CURSOR C1
   IS
          SELECT seviye, id, ust_mal_id
            FROM mal
      CONNECT BY PRIOR ust_mal_id = id
      START WITH ID = P_MAL_ID
        ORDER BY SEVIYE DESC;

   V_MAL_IDLER   VARCHAR2 (100);
BEGIN
   V_MAL_IDLER := '';

   FOR C1REC IN C1
   LOOP
      V_MAL_IDLER := V_MAL_IDLER  || C1REC.ID || ';';
   END LOOP;

   RETURN V_MAL_IDLER;
END MAL_USTMALIDLERI_BIRLESTIR;

Grant
DBMS_UTILITY.EXEC_DDL_STATEMENT('grant execute on MAL_USTMALIDLERI_BIRLESTIR to vtuser');

Kullanım
SELECT MAL_USTMALIDLERI_BIRLESTIR(25909) FROM DUAL;

ÇIKTI
25909;24916;25051;

20 Eylül 2011 Salı

Gelen Edi Mesajlarının kendisini, xml halini ve varsa hatalarını Orchestration üzerine Pipeline kullanarak alma

          Bilindiği üzere geliştirilen pipelineları orchestrationlar üzerinde çalıştırabiliyoruz ve gelen giden mesajları etkin bir şekilde kullanıyoruz. Fakat bu yazılan pipeline ve componentlerin bir tanesi bu iş için uygun değil. Oda EDIFACT mesajları. Microsoft EDI mesajlarını Pipelinelar üzerinden geçirerek Orchestration içerisinde çalıştırmayı desteklemiyor. (http://msdn.microsoft.com/en-us/library/bb226497(v=BTS.10).aspx)

Eğer EDIFACT mesajlarının geldiği hali koruyarak orchestrationların içerisine almak istiyorsanız Microsoft Pipeline componentleri üzerine pipeline componentler yazarak mesajı ve xml halini elde edebilirsiniz.

Önce bu işi yapacak olacak componenti yazmak gerekiyor. Burada dikkat edilmesi EdiDisassembler i kullanarak kod yazmak.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.BizTalk.Component.Interop;
using System.Runtime.InteropServices;
using Microsoft.BizTalk.Message.Interop;
using System.IO;
using Microsoft.BizTalk.PipelineOM;
using System.Xml;
using Microsoft.BizTalk.Edi.Pipelines;
using Microsoft.BizTalk.Edi.BatchMarker;
using System.Text.RegularExpressions;
using HelperBase.Genel.Executers;

namespace EdiLogDisassembler
{

    [ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
    [ComponentCategory(CategoryTypes.CATID_DisassemblingParser)]
    [ComponentCategory("9d0e4100-4cce-4536-83fa-4a5040674ad6"), Guid("4bc3957c-85c1-4c62-a5be-4e4a57b819f7"), ComponentCategory("9d0e4105-4cce-4536-83fa-4a5040674ad6")]
    public class LogDisassembler : EdiDisassembler,
                                   IBaseComponent,
                                   IDisassemblerComponent,
                                   IComponentUI,
                                   IPersistPropertyBag
                                  

    {
        Stream strmFile = null ;
        public LogDisassembler() { }

        # region IBASECOMPONENT
        public string Description
        {
            get
            {
                return "Edi için Pipeline";
            }
        }
        public string Name
        {
            get
            {
                return "LogDisassemblerComponent";
            }
        }
        public string Version
        {
            get
            {
                return "1.0.0.0";
            }
        }
        # endregion

        # region ICOMPONENTUI

        public System.Collections.IEnumerator Validate(object projectSystem)
        {
            return null;
        }

        public System.IntPtr Icon
        {
            get
            {
                return new System.IntPtr();
            }
        }

        #endregion

        #region IPERSISTPROPERTYBAG

        public bool Probe(IPipelineContext pContext, IBaseMessage pInMsg)
        {
            return base.Probe(pContext,pInMsg);
        }

        public void InitNew()
        {
            base.InitNew();// TODO:  Add LogDisassemblerComponent.InitNew implementation

        }

        public void Load(IPropertyBag propertyBag, int errorLog)
        {
            string xmlPropertyBag = "<?xml version=\"1.0\" encoding=\"utf-16\"?><PropertyBag xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">  <Properties>    <Property Name=\"XmlSchemaValidation\">      <Value xsi:type=\"xsd:boolean\">false</Value>    </Property>    <Property Name=\"OverrideFallbackSettings\">      <Value xsi:type=\"xsd:boolean\">true</Value>    </Property>    <Property Name=\"EdiDataValidation\">      <Value xsi:type=\"xsd:boolean\">true</Value>    </Property>    <Property Name=\"AllowTrailingDelimiters\">      <Value xsi:type=\"xsd:boolean\">false</Value>    </Property>    <Property Name=\"UseIsa11AsRepetitionSeparator\">      <Value xsi:type=\"xsd:boolean\">false</Value>    </Property>    <Property Name=\"PreserveInterchange\">      <Value xsi:type=\"xsd:boolean\">false</Value>    </Property>    <Property Name=\"EfactDelimiters\">      <Value xsi:type=\"xsd:string\">0x3A, 0x2B, 0x2C, 0x3F, 0x20, 0x27</Value>    </Property>    <Property Name=\"CreateXmlTagForTrailingSeparators\">      <Value xsi:type=\"xsd:boolean\">false</Value>    </Property>    <Property Name=\"MaskSecurityInformation\">      <Value xsi:type=\"xsd:boolean\">true</Value>    </Property>    <Property Name=\"ConvertToImpliedDecimal\">      <Value xsi:type=\"xsd:boolean\">false</Value>    </Property>    <Property Name=\"RouteAckOn2WayPort\">      <Value xsi:type=\"xsd:boolean\">true</Value>    </Property>    <Property Name=\"CharacterSet\">      <Value xsi:type=\"xsd:string\">UTF8</Value>    </Property>    <Property Name=\"DetectMID\">      <Value xsi:type=\"xsd:boolean\">true</Value>    </Property>    <Property Name=\"UseDotAsDecimalSeparator\">      <Value xsi:type=\"xsd:boolean\">false</Value>    </Property>  </Properties></PropertyBag>";
            PropertyBag propertyBag1 = PropertyBag.DeserializeFromXml(xmlPropertyBag);
            base.Load(propertyBag1, 0);

        }

        public void Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)
        {
            base.Save(propertyBag, clearDirty, saveAllProperties);

        }

        public void GetClassID(out Guid classID)
        {
            classID = new Guid("99534A16-91CF-4186-A7A6-2F5193166299");
        }

        #endregion

        #region IDISASSEMBLERCOMPONENT

        public void Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
        {
            IBaseMessagePart msgPart = pInMsg.BodyPart;
            strmFile = msgPart.GetOriginalDataStream();

            base.Disassemble(pContext, pInMsg);
        }

        public IBaseMessage GetNext(IPipelineContext pContext)
        {

            try
            {

                IBaseMessage returnIbaseMessage = null;
                IBaseMessage iBaseMessage = null;
                int bodyPartCount = 0;

                while ((iBaseMessage = base.GetNext(pContext)) != null)
                {
                    if (iBaseMessage.GetErrorInfo() != null)
                    {

                        IBaseMessage outMsg = pContext.GetMessageFactory().CreateMessage();
                        outMsg.AddPart("Body", pContext.GetMessageFactory().CreateMessagePart(), true);
                        outMsg.BodyPart.Data = iBaseMessage.BodyPart.Data;
                        outMsg.BodyPart.ContentType = iBaseMessage.BodyPart.ContentType;
                        outMsg.BodyPart.Charset = iBaseMessage.BodyPart.Charset;
                        outMsg.BodyPart.PartProperties = iBaseMessage.BodyPart.PartProperties;

                        for (int iProp = 0; iProp < iBaseMessage.Context.CountProperties; iProp++)
                        {
                            string strName;
                            string strNSpace;

                            object val = iBaseMessage.Context.ReadAt(iProp, out strName, out strNSpace);
                            if (!strName.ToString().Equals("MessageDestination"))
                            {
                                if (iBaseMessage.Context.IsPromoted(strName, strNSpace))
                                {
                                    if (strName.ToString().Equals("MessageType"))
                                        outMsg.Context.Promote(strName, strNSpace, "Error");
                                    else
                                        outMsg.Context.Promote(strName, strNSpace, val);
                                }
                                else
                                    outMsg.Context.Write(strName, strNSpace, val);
                            }
                        }
                       

                        byte[] byteArray = Encoding.ASCII.GetBytes(iBaseMessage.GetErrorInfo().ToString());
                        MemoryStream stream = new MemoryStream(byteArray);
                        outMsg.AddPart("Error", pContext.GetMessageFactory().CreateMessagePart(), false);
                        outMsg.GetPart("Error").Data = stream;

                        strmFile.Seek(0, SeekOrigin.Begin);
                        outMsg.AddPart("EdiMessage", pContext.GetMessageFactory().CreateMessagePart(), false);
                        outMsg.GetPart("EdiMessage").Data = strmFile;

                        while ((iBaseMessage = base.GetNext(pContext)) != null) ;

                        return outMsg;

                    }
                    if (returnIbaseMessage == null)
                    {
                         returnIbaseMessage = iBaseMessage;
                    }
                    else
                    {
                        returnIbaseMessage.AddPart(iBaseMessage.BodyPartName + bodyPartCount.ToString(), iBaseMessage.BodyPart, false);
                        returnIbaseMessage.GetPart(iBaseMessage.BodyPartName + bodyPartCount.ToString()).Data = iBaseMessage.BodyPart.Data;
                    }
                    bodyPartCount++;
                }

                if (returnIbaseMessage != null)
                {
                    returnIbaseMessage.AddPart("EdiMessage", pContext.GetMessageFactory().CreateMessagePart(), false);
                    strmFile.Seek(0, SeekOrigin.Begin);  
                    returnIbaseMessage.GetPart("EdiMessage").Data = strmFile;
                }

                return returnIbaseMessage;
            }
            catch
            {
                throw;
            }
        }

        #endregion

    }
}

Bu yazılan component için receive pipeline içeren bir proje hazırlıyoruz ve bu pipeline kullanıyoruz. Böylece mesajın kendisi ve oluşan xml ler orchestration üzerine geliyor. Ayrıca edi dönüşümünde karşılaşacağınız problemleride text halinde orchestration üzerinde görebiliyorsunuz.

Tabi bu oluşan pipeline projesini deploy ediyor ve alacağımız portta receive pipeline olarak seçiyoruz. Orchestration içine mesajı System.Xml.XmlDocument olarak alıyoruz. Ve aşağıdaki kodla mesajı, xml i, varsa hatalarına ulaşabiliyoruz.

Microsoft.XLANGs.BaseTypes.XLANGMessage xLangMessages = MsgIn;
MsgEdi = new System.Xml.XmlDocument();
MsgEdi = xLangMessages[xLangMessages.Count-1];
Microsoft.XLANGs.BaseTypes.XLANGPart xPartError = xLangMessages[xLangMessages.Count-2];

xLangMessages[0]; dönüşüme uğrayan xml edi mesajı.