示例#1
0
 /// <summary>
 /// ���͸��Զ˵ĻỰ�㱨�ģ�ͨ��CONSOLE�����
 /// </summary>
 /// <param name="message"></param>
 /// <param name="pSessionID"></param>
 public void toAdmin(QuickFix.Message message, QuickFix.SessionID pSessionID)
 {
     if (message is QuickFix42 .Logon )//ȷ���ǵ�½����
     {
         string rawdata = option .Rawdata ;
         message.setString(96, rawdata);
     }
     else if (message is QuickFix42.Logout)
     {
         if (message.isSetField(58))
         {
             string note = message.getString(58);
             if (OnError != null)
             {
                 OnError(note, EventArgs.Empty);
             }
         }
     }
     //Console.WriteLine("Enter toAdmin");
     //Console.WriteLine(message.ToString());
     //Console.WriteLine("Exit toAdmin");
       //  MessageBox.Show("toAdmin"+message .ToString ());  //20091229
 }
		protected void ConvertMessage(QuickFix.Message srcMessage, FIXMessage dstMessage)
		{
			foreach (Field field1 in srcMessage)
			{
				int field2 = field1.getField();
				switch (EFIXFieldTypes.GetFIXType(field2))
				{
					case FIXType.Bool:
						dstMessage.SetBoolValue(field2, srcMessage.getBoolean(field2));
						continue;
					case FIXType.Int:
						dstMessage.SetIntValue(field2, srcMessage.getInt(field2));
						continue;
					case FIXType.Double:
						dstMessage.SetDoubleValue(field2, srcMessage.getDouble(field2));
						continue;
					case FIXType.Char:
						dstMessage.SetCharValue(field2, srcMessage.getChar(field2));
						continue;
					case FIXType.String:
						dstMessage.SetStringValue(field2, srcMessage.getString(field2));
						continue;
					case FIXType.DateTime:
						DateTime? nullable = new DateTime?();
						if (!nullable.HasValue)
						{
							try
							{
								nullable = new DateTime?(srcMessage.getUtcTimeStamp(field2));
							}
							catch
							{
							}
						}
						if (!nullable.HasValue)
						{
							try
							{
								nullable = new DateTime?(srcMessage.getUtcDateOnly(field2));
							}
							catch
							{
							}
						}
						if (!nullable.HasValue)
						{
							try
							{
								nullable = new DateTime?(srcMessage.getUtcTimeOnly(field2));
							}
							catch
							{
							}
						}
						if (nullable.HasValue)
						{
							dstMessage.SetDateTimeValue(field2, nullable.Value);
							continue;
						}
						else
							continue;
					default:
						continue;
				}
			}
		}