//[Authorize(Roles ="SAdmin")] public async Task <HttpResponseMessage> GetDeletedList(MT_Instrument IMD) { Db = con.SurgeryCenterDb(IMD.Slug); InstrumentResponse Response = new InstrumentResponse(); try { List <MT_Instrument> AnesList = new List <MT_Instrument>(); Query docRef = Db.Collection("MT_Instrument").WhereEqualTo("Instru_Is_Deleted", true); QuerySnapshot ObjQuerySnap = await docRef.GetSnapshotAsync(); if (ObjQuerySnap != null) { foreach (DocumentSnapshot Docsnapshot in ObjQuerySnap.Documents) { AnesList.Add(Docsnapshot.ConvertTo <MT_Instrument>()); } Response.DataList = AnesList.OrderBy(o => o.Instru_Name).ToList(); } Response.Status = con.StatusNotDeleted; Response.Message = con.MessageNotDeleted; } catch (Exception ex) { Response.Status = con.StatusFailed; Response.Message = con.MessageFailed + ", Exception : " + ex.Message; } return(ConvertToJSON(Response)); }
private bool HandleObjectMessage(string msg) { // ******************** // ADD OBJECT HANDLERS BELOW // ******************** return (ErrorResponse.TryHandle(msg, Streams.ErrorSubject) || SubscribeResponse.TryHandle(msg, Streams.SubscribeSubject) || BookResponse.TryHandle(msg, Streams.BookSubject) || TradeResponse.TryHandle(msg, Streams.TradesSubject) || QuoteResponse.TryHandle(msg, Streams.QuoteSubject) || LiquidationResponse.TryHandle(msg, Streams.LiquidationSubject) || PositionResponse.TryHandle(msg, Streams.PositionSubject) || MarginResponse.TryHandle(msg, Streams.MarginSubject) || OrderResponse.TryHandle(msg, Streams.OrderSubject) || WalletResponse.TryHandle(msg, Streams.WalletSubject) || ExecutionResponse.TryHandle(msg, Streams.ExecutionSubject) || FundingResponse.TryHandle(msg, Streams.FundingsSubject) || InstrumentResponse.TryHandle(msg, Streams.InstrumentSubject) || TradeBinResponse.TryHandle(msg, Streams.TradeBinSubject) || InfoResponse.TryHandle(msg, Streams.InfoSubject) || AuthenticationResponse.TryHandle(msg, Streams.AuthenticationSubject)); }
public async Task <HttpResponseMessage> CreateAsync(MT_Instrument IMD) { Db = con.SurgeryCenterDb(IMD.Slug); InstrumentResponse Response = new InstrumentResponse(); try { UniqueID = con.GetUniqueKey(); IMD.Instru_Unique_ID = UniqueID; IMD.Instru_Create_Date = con.ConvertTimeZone(IMD.Instru_TimeZone, Convert.ToDateTime(IMD.Instru_Create_Date)); IMD.Instru_Modify_Date = con.ConvertTimeZone(IMD.Instru_TimeZone, Convert.ToDateTime(IMD.Instru_Modify_Date)); DocumentReference docRef = Db.Collection("MT_Instrument").Document(UniqueID); WriteResult Result = await docRef.SetAsync(IMD); if (Result != null) { Response.Status = con.StatusSuccess; Response.Message = con.MessageSuccess; Response.Data = IMD; } else { Response.Status = con.StatusNotInsert; Response.Message = con.MessageNotInsert; Response.Data = null; } } catch (Exception ex) { Response.Status = con.StatusFailed; Response.Message = con.MessageFailed + ", Exception : " + ex.Message; } return(ConvertToJSON(Response)); }
//[Authorize(Roles = "Admin")] public async Task <HttpResponseMessage> Select(MT_Instrument IMD) { Db = con.SurgeryCenterDb(IMD.Slug); InstrumentResponse Response = new InstrumentResponse(); try { MT_Instrument AnesList = new MT_Instrument(); Query docRef = Db.Collection("MT_Instrument").WhereEqualTo("Instru_Unique_ID", IMD.Instru_Unique_ID).WhereEqualTo("Instru_Is_Deleted", false); QuerySnapshot ObjQuerySnap = await docRef.GetSnapshotAsync(); if (ObjQuerySnap != null) { AnesList = ObjQuerySnap.Documents[0].ConvertTo <MT_Instrument>(); Response.Data = AnesList; } Response.Status = con.StatusNotDeleted; Response.Message = con.MessageNotDeleted; } catch (Exception ex) { Response.Status = con.StatusFailed; Response.Message = con.MessageFailed + ", Exception : " + ex.Message; } return(ConvertToJSON(Response)); }
public async Task <HttpResponseMessage> Remove(MT_Instrument IMD) { Db = con.SurgeryCenterDb(IMD.Slug); InstrumentResponse Response = new InstrumentResponse(); try { DocumentReference docRef = Db.Collection("MT_Instrument").Document(IMD.Instru_Unique_ID); WriteResult Result = await docRef.DeleteAsync(); if (Result != null) { Response.Status = con.StatusSuccess; Response.Message = con.MessageSuccess; Response.Data = null; } else { Response.Status = con.StatusNotDeleted; Response.Message = con.MessageNotDeleted; Response.Data = null; } } catch (Exception ex) { Response.Status = con.StatusFailed; Response.Message = con.MessageFailed + ", Exception : " + ex.Message; } return(ConvertToJSON(Response)); }
private bool HandleObjectMessage(string msg) { var response = BitmexJsonSerializer.Deserialize <JObject>(msg); // ******************** // ADD OBJECT HANDLERS BELOW // ******************** return (TradeResponse.TryHandle(response, Streams.TradesSubject) || TradeBinResponse.TryHandle(response, Streams.TradeBinSubject) || BookResponse.TryHandle(response, Streams.BookSubject) || QuoteResponse.TryHandle(response, Streams.QuoteSubject) || LiquidationResponse.TryHandle(response, Streams.LiquidationSubject) || PositionResponse.TryHandle(response, Streams.PositionSubject) || MarginResponse.TryHandle(response, Streams.MarginSubject) || OrderResponse.TryHandle(response, Streams.OrderSubject) || WalletResponse.TryHandle(response, Streams.WalletSubject) || InstrumentResponse.TryHandle(response, Streams.InstrumentSubject) || ErrorResponse.TryHandle(response, Streams.ErrorSubject) || SubscribeResponse.TryHandle(response, Streams.SubscribeSubject) || InfoResponse.TryHandle(response, Streams.InfoSubject) || AuthenticationResponse.TryHandle(response, Streams.AuthenticationSubject)); }
private void HandleMarketSafe(InstrumentResponse response) { try { HandleMarket(response); } catch (Exception e) { Log.Error(e, $"[Bitmex] Failed to handle market info, error: '{e.Message}'"); } }
public async Task <HttpResponseMessage> UpdateAsync(MT_Instrument IMD) { Db = con.SurgeryCenterDb(IMD.Slug); InstrumentResponse Response = new InstrumentResponse(); try { Dictionary <string, object> initialData = new Dictionary <string, object> { { "Instru_Name", IMD.Instru_Name }, { "Instru_Type", IMD.Instru_Type }, { "Instru_Description", IMD.Instru_Description }, { "Instru_Modify_Date", con.ConvertTimeZone(IMD.Instru_TimeZone, Convert.ToDateTime(IMD.Instru_Modify_Date)) }, { "Instru_Surgery_Physician_Id", IMD.Instru_Surgery_Physician_Id } }; DocumentReference docRef = Db.Collection("MT_Instrument").Document(IMD.Instru_Unique_ID); WriteResult Result = await docRef.UpdateAsync(initialData); if (Result != null) { Response.Status = con.StatusSuccess; Response.Message = con.MessageSuccess; Response.Data = IMD; } else { Response.Status = con.StatusNotUpdate; Response.Message = con.MessageNotUpdate; Response.Data = null; } } catch (Exception ex) { Response.Status = con.StatusFailed; Response.Message = con.MessageFailed + ", Exception : " + ex.Message; } return(ConvertToJSON(Response)); }
private void HandleMarket(InstrumentResponse response) { MarketsSubject.OnNext(ConvertMarkets(response.Data)); }