public static string Format(InsType type) { var builder = new StringBuilder(); new Context(builder).FormatType('\0', 0, type); return(builder.ToString()); }
public static string Diff(InsType type1, InsType type2) { var builder = new StringBuilder(); new Context(builder).DiffType(0, type1, type2); return(builder.ToString()); }
public override string ToString() { string ret = Time.ToString() + ","; ret += TransactionCode.ToString() + ","; ret += TransactionSubcode.ToString() + ","; ret += TransID.ToString() + ","; ret += (Symbol != null ? Symbol.ToString() : "") + ","; ret += (BuySell != null ? BuySell.ToString() : "") + ","; ret += (OpenClose != null ? OpenClose.ToString() : "") + ","; ret += Quantity.ToString() + ","; ret += ExpireDate.ToString() + ","; ret += Strike.ToString() + ","; ret += (InsType != null ? InsType.ToString() : "") + ","; ret += Price.ToString() + ","; ret += Fees.ToString() + ","; ret += Amount.ToString() + ","; ret += Description.ToString() + ","; ret += AccountRef.ToString(); return(ret); }
private void SaveInsTypebtn_Click(object sender, RoutedEventArgs e) { try { bool flag = IsInsTypeAlreadyExist(InsTyp); if (flag) { var type = unitOfWork.InsTypeRepository.Entities .FirstOrDefault(n => n.Type == InsTyp); type.Type = TypeTextBox.Text; type.Fee = Convert.ToInt32(FeeTextBox.Text); type.MaxPayout = Convert.ToInt32(MaxPayoutTextBox.Text); unitOfWork.Commit(); } else { if (TypeTextBox.Text != "" && FeeTextBox.Text != "" && MaxPayoutTextBox.Text != "") { var newtype = new InsType(); newtype.Type = TypeTextBox.Text; newtype.Fee = Convert.ToInt32(FeeTextBox.Text); newtype.MaxPayout = Convert.ToInt32(MaxPayoutTextBox.Text); unitOfWork.InsTypeRepository.Add(newtype); unitOfWork.Commit(); MessageBox.Show("Добавлен новый тип страховки"); } else { MessageBox.Show("Все поля должны быть заполнены"); } } this.Close(); } catch (Exception ex) { MessageBox.Show("Ошибка добавления нового контакта\n" + ex.Message); } }
/// <summary> /// 格式化具体指令返回 /// </summary> /// <param name="SendIns"></param> /// <param name="code"></param> /// <param name="type"></param> /// <returns></returns> public InsModel FormatIns(SendDataHandler SendIns, ParamObject pm, InsType type) { InsModel IModel = new InsModel(); if (SendIns != null) { if (!pm.code.ToLower().Trim().StartsWith("detr:")) { //发送指令 string strRecvData = SendIns(pm); int MaxPNCount = 6;//最大PN数 if (type == InsType.AVH) { List <string> avhList = new List <string>(); avhList.Add(strRecvData); pm.code = "PN"; Thread.Sleep(pm.PNSleep); strRecvData = SendIns(pm); int i = 0; while (i < MaxPNCount) { if (strRecvData.Contains("下一页") || strRecvData == avhList[avhList.Count - 1]) { break; } else { if (!strRecvData.Contains("指令频繁")) { avhList.Add(strRecvData); } strRecvData = SendIns(pm); Thread.Sleep(pm.PNSleep); i++; } } IModel._avh = GetAVHData(avhList); } else if (type == InsType.FD) { #region 获取FD数据 if (!strRecvData.Contains("没有适用运价")) { //FD数据列表 List <string> FdList = new List <string>(); FdList.Add(strRecvData); int PageIndex = 1, PageCount = 1; string PagePattern = @"(?<=PAGE)\s*(?<PageIndex>\d+)\/(?<PageCount>\d+)\s*"; Match PageMch = Regex.Match(strRecvData, PagePattern, RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase); if (PageMch.Success) { int.TryParse(PageMch.Groups["PageIndex"].Value.Trim(), out PageIndex); int.TryParse(PageMch.Groups["PageCount"].Value.Trim(), out PageCount); } if (PageIndex != PageCount) { for (int i = PageIndex; i < PageCount; i++) { pm.code = "PN"; strRecvData = SendIns(pm); FdList.Add(strRecvData); } } IModel._fd = GetFDData(FdList); } #endregion } else if (type == InsType.PAT) { FormatPNR pnr = new FormatPNR(); string errMsg = ""; IModel._pat = pnr.GetPATInfo(strRecvData, out errMsg); } } else { if (type == InsType.Detr) { List <string> avhList = new List <string>(); IModel._detr = GetDetrModel(avhList, SendIns, pm); } } } return(IModel); }