/// <summary> /// delete security /// </summary> /// <param name="id">security id</param> /// <returns></returns> internal string DeleteSecurity(int id) { #region find security in IGroupSecurity int count= Market.IGroupSecurityList.Count; for(int i=0;i<count;i++) { if(Market.IGroupSecurityList[i].SecurityID==id) { return "DSyE004"; } } count = Market.SymbolList.Count; for (int i = 0; i < count; i++) { if (Market.SymbolList[i].SecurityID == id) { return "DSyE011"; } } #endregion #region delete function Business.Security security=new Security(); bool result = security.DFDeleteByID(id); if (result) { //delete function // count = Market.SecurityList.Count; for (int i = 0; i < count; i++) { if (Market.SecurityList[i].SecurityID == id) { Market.SecurityList.RemoveAt(i); break; } } return "DSyE006"; } else { //delete db unsuccess // return "DSyE005"; } #endregion }
/// <summary> /// /// </summary> /// <param name="value"></param> public void ReceiveSecurityNotify(List<string> value) { if (value != null) { Business.Market.SecurityList = new List<Security>(); int count = value.Count; for (int i = 0; i < count; i++) { if (!string.IsNullOrEmpty(value[i])) { string[] subValue = value[i].Split('{'); Business.Security newSecurity = new Security(); newSecurity.SecurityID = int.Parse(subValue[0]); newSecurity.Name = subValue[1]; if (string.IsNullOrEmpty(subValue[2])) newSecurity.Description = "MT4 Security: " + newSecurity.Name; else newSecurity.Description = subValue[2]; Business.Market.SecurityList.Add(newSecurity); } } } }