public void OnVolumeChange(VolumeDataRespose volumeData, MarketCapData capData) { try { HelperForLog.WriteLogIntoFile("OnVolumeChange", ControllerName, "Call OnVolumeChangeMethod : volumeData : " + JsonConvert.SerializeObject(volumeData) + " : Market Data : " + JsonConvert.SerializeObject(capData)); if (volumeData != null && capData != null) { LastPriceViewModel lastPriceData = new LastPriceViewModel(); lastPriceData.LastPrice = capData.LastPrice; lastPriceData.UpDownBit = volumeData.UpDownBit; string Base = volumeData.PairName.Split("_")[1]; PairData(volumeData, Base); HelperForLog.WriteLogIntoFile("OnVolumeChange", ControllerName, "After Pair Data Call Base :" + Base + " DATA :" + JsonConvert.SerializeObject(volumeData)); MarketData(capData, volumeData.PairName); HelperForLog.WriteLogIntoFile("OnVolumeChange", ControllerName, "After Market Data Call Pair :" + volumeData.PairName + " DATA :" + JsonConvert.SerializeObject(capData)); LastPrice(lastPriceData, volumeData.PairName); HelperForLog.WriteLogIntoFile("OnVolumeChange", ControllerName, "After Last price Call Pair :" + volumeData.PairName + " DATA :" + JsonConvert.SerializeObject(lastPriceData)); } } catch (Exception ex) { _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error); //throw ex; } }
public void InsertTradePoolQueue(long MemberID, long MakerTrnNo, long PoolID, decimal MakerQty, decimal MakerPrice, long TakerTrnNo, decimal TakerQty, decimal TakerPrice, decimal TakerDisc, decimal TakerLoss, long SellerListID) { try { TradePoolQueueObj = new TradePoolQueue() { CreatedDate = Helpers.UTC_To_IST(), CreatedBy = MemberID, MakerTrnNo = MakerTrnNo, PoolID = PoolID, SellerListID = SellerListID, MakerQty = MakerQty, MakerPrice = MakerPrice, TakerTrnNo = TakerTrnNo, TakerQty = TakerQty, TakerPrice = TakerPrice, TakerDisc = TakerDisc, TakerLoss = TakerLoss, Status = Convert.ToInt16(enTransactionStatus.Success),//always etry after settlement done }; //TradePoolQueueObj = _TradePoolQueue.Add(TradePoolQueueObj); //return (new BizResponse { ReturnMsg = EnResponseMessage.CommSuccessMsgInternal, ReturnCode = enResponseCodeService.Success }); } catch (Exception ex) { HelperForLog.WriteErrorLog("InsertTradePoolQueue:##TrnNo " + TakerTrnNo, ControllerName, ex); //return (new BizResponse { ReturnMsg = EnResponseMessage.CommFailMsgInternal, ReturnCode = enResponseCodeService.InternalError }); throw ex; } }
public void ActivityNotification(string Msg, string Token) { try { SignalRComm <String> CommonData = new SignalRComm <String>(); CommonData.EventType = Enum.GetName(typeof(enSignalREventType), enSignalREventType.Channel); CommonData.Method = Enum.GetName(typeof(enMethodName), enMethodName.ActivityNotification); CommonData.ReturnMethod = Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveNotification); CommonData.Subscription = Enum.GetName(typeof(enSubscriptionType), enSubscriptionType.OneToOne); CommonData.ParamType = Enum.GetName(typeof(enSignalRParmType), enSignalRParmType.AccessToken); CommonData.Data = Msg; CommonData.Parameter = null; //SignalRDataNotify SendData = new SignalRDataNotify(); SignalRData SendData = new SignalRData(); SendData.Method = enMethodName.ActivityNotification; SendData.Parameter = Token; SendData.DataObj = JsonConvert.SerializeObject(CommonData); //SendData.WalletName = Wallet; HelperForLog.WriteLogIntoFile("ActivityNotification", ControllerName, " MSG :" + Msg); _mediator.Send(SendData); } catch (Exception ex) { _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error); //throw ex; } }
public PoolOrder CreatePoolOrderForSettlement(long OMemberID, long DMemberID, long UserID, long PoolID, long TrnNo, decimal Amount, long CreditWalletID, string CreditAccountID) { try { PoolOrderObj = new PoolOrder() { CreatedDate = Helpers.UTC_To_IST(), CreatedBy = UserID, UserID = UserID, DMemberID = DMemberID, //Pool gives Amount to Member/User OMemberID = OMemberID, //Member/User Take Amount from Pool TrnNo = TrnNo, TrnMode = 0, PayMode = Convert.ToInt16(enWebAPIRouteType.TradeServiceLocal), ORemarks = "Order Created", OrderAmt = Amount, DeliveryAmt = Amount, DiscPer = 0, DiscRs = 0, Status = Convert.ToInt16(enTransactionStatus.Initialize),//txn type status UserWalletID = CreditWalletID, UserWalletAccID = CreditAccountID, }; PoolOrderObj = _PoolOrder.Add(PoolOrderObj); return(PoolOrderObj); //return (new BizResponse { ReturnMsg = EnResponseMessage.CommSuccessMsgInternal, ReturnCode = enResponseCodeService.Success }); } catch (Exception ex) { HelperForLog.WriteErrorLog("CreatePoolOrder:##TrnNo " + TrnNo, ControllerName, ex); //return (new BizResponse { ReturnMsg = EnResponseMessage.CommFailMsgInternal, ReturnCode = enResponseCodeService.InternalError }); throw ex; } }
public void CancellQueueEntry(TradeCancelQueue tradeCancelQueue, long TrnNo, long DeliverServiceID, decimal PendingBuyQty, decimal DeliverQty, short OrderType, decimal DeliverBidPrice, long UserID) { try { tradeCancelQueue = new TradeCancelQueue() { TrnNo = TrnNo, DeliverServiceID = DeliverServiceID, TrnDate = Helpers.UTC_To_IST(), PendingBuyQty = PendingBuyQty, DeliverQty = DeliverQty, OrderType = OrderType, DeliverBidPrice = DeliverBidPrice, Status = 0, OrderID = 0, SettledDate = Helpers.UTC_To_IST(), StatusMsg = "Cancel Order", CreatedBy = UserID, CreatedDate = Helpers.UTC_To_IST() }; } catch (Exception ex) { HelperForLog.WriteErrorLog("CancellQueueEntry:##TrnNo " + TrnNo, ControllerName, ex); } }
public Cities GetCity(long CityID) { try { Cities cities = new Cities(); BizResponseClass Resp = new BizResponseClass(); var IsExist = _commonRepoCity.GetSingle(item => item.Id == CityID); if (IsExist != null) { cities.CityName = IsExist.CityName; cities.Status = IsExist.Status; Resp.ErrorCode = enErrorCode.Success; Resp.ReturnCode = enResponseCode.Success; Resp.ReturnMsg = EnResponseMessage.FindRecored; } else { Resp.ErrorCode = enErrorCode.NotFound; Resp.ReturnCode = enResponseCode.Fail; Resp.ReturnMsg = EnResponseMessage.NotFound; } cities.BizResponseObj = Resp; return(cities); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw; } }
public BizResponseClass AddState(AddStateReq Request, long UserID)//string StateName, string StateCode, long CountryID, short Status { BizResponseClass Resp = new BizResponseClass(); try { StateMaster obj = new StateMaster(); obj.StateName = Request.StateName; obj.StateCode = Request.StateCode; obj.Status = Request.Status; obj.CountryID = Request.CountryID; obj.CreatedBy = UserID; obj.CreatedDate = UTC_To_IST(); _commonRepoState.Add(obj); Resp.ErrorCode = enErrorCode.Success; Resp.ReturnCode = enResponseCode.Success; Resp.ReturnMsg = EnResponseMessage.RecordAdded; return(Resp); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
public BizResponseClass UpdateZipCode(AddZipCodeReq Request, long UserID) { try { BizResponseClass Resp = new BizResponseClass(); var IsExist = _commonRepoZipCode.GetSingle(item => item.Id == Request.ZipCodeID && item.Status == Convert.ToInt16(ServiceStatus.Active)); if (IsExist != null) { IsExist.ZipCode = Request.ZipCode; IsExist.ZipAreaName = Request.AreaName; IsExist.CityID = Request.CityID; IsExist.Status = Request.Status; IsExist.UpdatedBy = UserID; IsExist.UpdatedDate = UTC_To_IST(); _commonRepoZipCode.Update(IsExist); Resp.ErrorCode = enErrorCode.Success; Resp.ReturnCode = enResponseCode.Success; Resp.ReturnMsg = EnResponseMessage.RecordUpdated; } else { Resp.ErrorCode = enErrorCode.NotFound; Resp.ReturnCode = enResponseCode.Fail; Resp.ReturnMsg = EnResponseMessage.NotFound; } return(Resp); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw; } }
//Uday 30-10-2018 public ServiceLimitChargeValue GetServiceLimitChargeValue(enTrnType TrnType, string CoinName) { try { ServiceLimitChargeValue response; var walletType = _WalletTypeMasterRepository.GetSingle(x => x.WalletTypeName == CoinName); if (walletType != null) { response = new ServiceLimitChargeValue(); var limitData = _limitRuleMaster.GetSingle(x => x.TrnType == TrnType && x.WalletType == walletType.Id); var chargeData = _chargeRuleMaster.GetSingle(x => x.TrnType == TrnType && x.WalletType == walletType.Id); if (limitData != null && chargeData != null) { response.CoinName = walletType.WalletTypeName; response.TrnType = limitData.TrnType; response.MinAmount = limitData.MinAmount; response.MaxAmount = limitData.MaxAmount; response.ChargeType = chargeData.ChargeType; response.ChargeValue = chargeData.ChargeValue; } return(response); } else { return(null); } } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
public TransactionAccount GetTransactionAccount(long WalletID, short isSettled, long batchNo, decimal drAmount, decimal crAmount, long trnNo, string remarks, byte status) { try { var walletLedger2 = new TransactionAccount(); walletLedger2.CreatedBy = WalletID; walletLedger2.CreatedDate = UTC_To_IST(); walletLedger2.DrAmt = drAmount; walletLedger2.CrAmt = crAmount; walletLedger2.RefNo = trnNo; walletLedger2.Remarks = remarks; walletLedger2.Status = status; walletLedger2.TrnDate = UTC_To_IST(); walletLedger2.UpdatedBy = WalletID; walletLedger2.WalletID = WalletID; walletLedger2.IsSettled = isSettled; walletLedger2.BatchNo = batchNo; return(walletLedger2); } catch (Exception ex) { //_log.LogError(ex, "Date: " + UTC_To_IST() + ",\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error); HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
public GetTradeHistoryInfo GetAndSendTradeHistoryInfoData(TransactionQueue Newtransaction, TradeTransactionQueue NewTradeTransaction, short OrderType, short IsPop = 0) { try { //var OrderHistoryList = _frontTrnRepository.GetTradeHistory(0, "", "", "", 0, 0, Newtransaction.Id); GetTradeHistoryInfo model = new GetTradeHistoryInfo(); model.TrnNo = NewTradeTransaction.TrnNo; model.Type = (NewTradeTransaction.TrnType == 4) ? "BUY" : "SELL"; model.Price = (NewTradeTransaction.BidPrice == 0) ? NewTradeTransaction.AskPrice : (NewTradeTransaction.AskPrice == 0) ? NewTradeTransaction.BidPrice : NewTradeTransaction.BidPrice; model.Amount = (NewTradeTransaction.TrnType == 4) ? NewTradeTransaction.SettledBuyQty : NewTradeTransaction.SettledSellQty; model.Total = model.Type == "BUY" ? ((model.Price * model.Amount) - model.ChargeRs) : ((model.Price * model.Amount)); model.DateTime = Convert.ToDateTime(NewTradeTransaction.SettledDate); model.Status = NewTradeTransaction.Status; model.StatusText = Enum.GetName(typeof(enTransactionStatus), model.Status); model.PairName = NewTradeTransaction.PairName; model.ChargeRs = Convert.ToDecimal(Newtransaction.ChargeRs); model.IsCancel = NewTradeTransaction.IsCancelled; model.OrderType = Enum.GetName(typeof(enTransactionMarketType), OrderType); return(model); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); //throw ex; return(null); } }
public List <GetGraphResponsePairWise> GetGraphDataEveryLastMin(string Interval) { try { string Query = ""; IQueryable <GetGraphResponsePairWise> Result; Query = "Select (Select Top 1 PairName From TradePairMaster TPM Where TPM.Id = T.PairId) As PairName," + " DATEADD(MINUTE, DATEDIFF(MINUTE, 0, T.DataDate) / 1 * 1, 0) As DataDate," + " MAX(T.High) As High, MIN(T.Low) As Low, SUM(T.Volume) As Volume," + " (Select T1.OpenVal From TradeData T1 Where T1.TranNo = MAX(T.TranNo)) As OpenVal," + " (Select T1.CloseVal From TradeData T1 Where T1.TranNo = MIN(T.TranNo)) As CloseVal From TradeData T" + " Where PairId In (Select TM.Id From TradePairMaster TM) And DataDate = {0}" + " GROUP BY DATEADD(MINUTE, DATEDIFF(MINUTE, 0, T.DataDate) / 1 * 1, 0),PairId" + " Order By DATEADD(MINUTE, DATEDIFF(MINUTE, 0, T.DataDate) / 1 * 1, 0) desc"; //Query = Query.Replace("#IntervalData#", IntervalData).Replace("#IntervalTime#", IntervalTime.ToString()); //string MinuteData = Minute.ToString("yyyy-MM-dd HH:mm:00:000"); //Interval = "2018-10-11 23:06:00"; Result = _dbContext.GetGraphResponseByPair.FromSql(Query, Interval); return(Result.ToList()); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
public async Task <IActionResult> Withdrawal(string coin, string accWalletID, [FromBody] WithdrawalReq Request) { var accessToken = await HttpContext.GetTokenAsync("access_token"); HelperForLog.WriteLogIntoFile(1, _basePage.UTC_To_IST(), this.ControllerContext.RouteData.Values["action"].ToString(), this.GetType().Name, JsonConvert.SerializeObject(Request), accessToken); WithdrawalRes Response = new WithdrawalRes(); try { var user = await _userManager.GetUserAsync(HttpContext.User); if (user == null) { Response.ReturnCode = enResponseCode.Fail; Response.ReturnMsg = EnResponseMessage.StandardLoginfailed; Response.ErrorCode = enErrorCode.StandardLoginfailed; } else { Response = _walletService.Withdrawl(coin, accWalletID, Request, user.Id); } HelperForLog.WriteLogIntoFile(2, _basePage.UTC_To_IST(), this.ControllerContext.RouteData.Values["action"].ToString(), this.GetType().Name, JsonConvert.SerializeObject(Response), ""); return(Ok(Response)); } catch (Exception ex) { //HelperForLog.WriteErrorLog(_basePage.UTC_To_IST(), this.ControllerContext.RouteData.Values["action"].ToString(), this.GetType().Name, ex.ToString()); //Response.ReturnCode = enResponseCode.InternalError; //return BadRequest(Response); return(BadRequest(new BizResponseClass { ReturnCode = enResponseCode.InternalError, ReturnMsg = ex.ToString(), ErrorCode = enErrorCode.Status500InternalServerError })); } }
//vsoalnki 13-11-2018 public ListLimitRuleMasterRes GetAllLimitRule() { ListLimitRuleMasterRes res = new ListLimitRuleMasterRes(); try { var items = _masterConfigurationRepository.GetAllLimitRule(); if (items.Count == 0) { res.ReturnCode = enResponseCode.Fail; res.ErrorCode = enErrorCode.RecordNotFound; res.ReturnMsg = EnResponseMessage.NotFound; return(res); } res.ReturnCode = enResponseCode.Success; res.ErrorCode = enErrorCode.Success; res.ReturnMsg = EnResponseMessage.FindRecored; res.LimitRuleObj = items; return(res); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
//vsoalnki 14-11-2018 public List <MessagingQueueRes> GetMessagingQueue(DateTime FromDate, DateTime ToDate, short?Status, long?MobileNo, int Page) { try { //MessageStatusType //var val = Enum.GetNames(typeof(MessageStatusType)) // .Cast<string>() // .Select(x => x.ToString()) // .ToArray(); //List<int> msgInt = Helpers.GetEnumValue<MessageStatusType>(); var items = (from u in _dbContext.MessagingQueue //join q in msgInt //on u.Status equals q where u.CreatedDate >= FromDate && u.CreatedDate <= ToDate && (Status == null || (u.Status == Status && Status != null)) && (MobileNo == null || (u.MobileNo == MobileNo && MobileNo != null)) select new MessagingQueueRes { Status = u.Status, MobileNo = u.MobileNo, SMSDate = u.CreatedDate.ToString("dd-MM-yyyy h:mm:ss tt"), SMSText = u.SMSText, StrStatus = (u.Status == 0) ? "Initialize" : (u.Status == 1) ? "Success" : (u.Status == 6) ? "Pending" : "Fail" } ).ToList(); return(items); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
public Task SellerSideWalletBal(string Token, string WalletName, string Data) { try { //_chatHubContext.Clients.Group("SellerSideWalletBal:" + Pair).SendAsync("RecieveSellerSideWalletBal", Data); //++++++++++++++++++++++// //var Redis = new RadisServices<ConnetedClientList>(this._fact); //ConnetedClientList User = new ConnetedClientList(); //User = Redis.GetConnectionID(Token); //_chatHubContext.Clients.Client(User.ConnectionId).SendAsync("RecieveSellerSideWalletBal", Data); var Redis = new RadisServices <ConnetedClientToken>(this._fact); IEnumerable <string> ClientList = Redis.GetKey(Token); foreach (string s in ClientList.ToList()) { var Key = s; Key = Key.Split(":")[1].ToString(); string Pair = Redis.GetPairOrMarketData(Key, ":", "Pairs"); if (Pair.Split("_")[0].ToString() == WalletName) { _chatHubContext.Clients.Client(Key).SendAsync(Enum.GetName(typeof(enReturnMethod), enReturnMethod.RecieveSellerSideWalletBal), Data); HelperForLog.WriteLogIntoFile("SellerSideWalletBal", "SocketHub", " Send Data :" + Data); } else { // ignore Data } } return(Task.FromResult(0)); } catch (Exception ex) { _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error); return(Task.FromResult(0)); } }
//vsoalnki 13-11-2018 public ListLimitRuleMasterRes GetLimitRuleById(long LimitRuleMasterId) { ListLimitRuleMasterRes res = new ListLimitRuleMasterRes(); try { var template = _masterConfigurationRepository.GetLimitRuleById(LimitRuleMasterId); // var template = _TemplateMaster.GetById(TemplateMasterId); if (template != null) { res.ReturnCode = enResponseCode.Success; res.ErrorCode = enErrorCode.Success; res.ReturnMsg = EnResponseMessage.FindRecored; res.LimitRuleObj = template; return(res); } res.ReturnCode = enResponseCode.Fail; res.ErrorCode = enErrorCode.RecordNotFound; res.ReturnMsg = EnResponseMessage.NotFound; return(res); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
//vsoalnki 13-11-2018 public ListTemplateMasterRes GetAllTemplateMaster() { ListTemplateMasterRes res = new ListTemplateMasterRes(); try { var items = _masterConfigurationRepository.GetAllTemplateMaster(); //var items = _TemplateMaster.List(); // var items = _TemplateMaster.FindBy(i => i.Status == Convert.ToInt16(ServiceStatus.Active)); if (items.Count == 0) { res.ReturnCode = enResponseCode.Fail; res.ErrorCode = enErrorCode.RecordNotFound; res.ReturnMsg = EnResponseMessage.NotFound; return(res); } res.ReturnCode = enResponseCode.Success; res.ErrorCode = enErrorCode.Success; res.ReturnMsg = EnResponseMessage.FindRecored; res.TemplateMasterObj = items; return(res); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
//vsoalnki 13-11-2018 public BizResponseClass UpdateLimitRule(long LimitRuleMasterId, LimitRuleMasterReq Request, long userid) { try { var template = _LimitRuleMaster.GetSingle(i => i.Id == LimitRuleMasterId); if (Request != null) { template.Status = Convert.ToInt16(ServiceStatus.Active); template.UpdatedDate = UTC_To_IST(); template.CreatedDate = template.CreatedDate; //UTC_To_IST(); template.CreatedBy = template.CreatedBy; // userid; template.UpdatedBy = userid; template.MaxAmount = Request.MaxAmount; template.MinAmount = Request.MinAmount; template.Name = Request.Name; template.TrnType = Request.TrnType; template.WalletType = Request.WalletType; _LimitRuleMaster.Update(template); return(new BizResponseClass { ReturnCode = enResponseCode.Success, ReturnMsg = EnResponseMessage.RecordUpdated, ErrorCode = enErrorCode.Success }); } return(new BizResponseClass { ReturnCode = enResponseCode.Fail, ReturnMsg = EnResponseMessage.InvalidInput, ErrorCode = enErrorCode.InvalidInput }); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
//vsoalnki 13-11-2018 public BizResponseClass DisableLimitRule(long LimitRuleMasterId) { try { var template = _LimitRuleMaster.GetById(LimitRuleMasterId); if (template != null) { //disable status template.DisableService(); //update in DB _LimitRuleMaster.Update(template); return(new BizResponseClass { ReturnCode = enResponseCode.Success, ReturnMsg = EnResponseMessage.RecordDisable, ErrorCode = enErrorCode.Success }); } return(new BizResponseClass { ReturnCode = enResponseCode.Fail, ReturnMsg = EnResponseMessage.InvalidInput, ErrorCode = enErrorCode.InvalidInput }); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
//vsoalnki 13-11-2018 public BizResponseClass AddTemplateMaster(TemplateMasterReq Request, long userid) { try { TemplateMaster template = new TemplateMaster(); if (Request != null) { template.Status = Convert.ToInt16(ServiceStatus.Active); template.UpdatedDate = UTC_To_IST(); template.CreatedDate = UTC_To_IST(); template.CreatedBy = userid; template.TemplateID = Convert.ToInt64(Request.TemplateID); template.TemplateName = Request.TemplateName; template.AdditionalInfo = Request.AdditionalInfo; template.CommServiceTypeID = Request.CommServiceTypeID; template.Content = Request.Content; _TemplateMaster.Add(template); return(new BizResponseClass { ReturnCode = enResponseCode.Success, ReturnMsg = EnResponseMessage.RecordAdded, ErrorCode = enErrorCode.Success }); } return(new BizResponseClass { ReturnCode = enResponseCode.Fail, ReturnMsg = EnResponseMessage.InvalidInput, ErrorCode = enErrorCode.InvalidInput }); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
//vsolanki 11-10-2018 List the wallettypemaster public ListWalletTypeMasterResponse ListAllWalletTypeMaster() { ListWalletTypeMasterResponse listWalletTypeMasterResponse = new ListWalletTypeMasterResponse(); try { IEnumerable <WalletTypeMaster> coin = new List <WalletTypeMaster>(); coin = _WalletTypeMasterRepository.FindBy(item => item.Status != Convert.ToInt16(ServiceStatus.Disable)); if (coin == null) { listWalletTypeMasterResponse.ReturnCode = enResponseCode.Fail; listWalletTypeMasterResponse.ReturnMsg = EnResponseMessage.NotFound; listWalletTypeMasterResponse.ErrorCode = enErrorCode.RecordNotFound; } else { listWalletTypeMasterResponse.walletTypeMasters = coin; listWalletTypeMasterResponse.ReturnCode = enResponseCode.Success; listWalletTypeMasterResponse.ErrorCode = enErrorCode.Success; listWalletTypeMasterResponse.ReturnMsg = EnResponseMessage.FindRecored; } return(listWalletTypeMasterResponse); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); listWalletTypeMasterResponse.ReturnCode = enResponseCode.InternalError; return(listWalletTypeMasterResponse); } }
public TransferInOutRes GetTransferOutHistory(string CoinName, DateTime?FromDate, DateTime?ToDate, short Status) { TransferInOutRes transfer = new TransferInOutRes(); transfer.BizResponseObj = new BizResponseClass(); try { var trans = _walletRepository.TransferOutHistory(CoinName, FromDate, ToDate, Status); if (trans == null || trans.Count == 0) { transfer.BizResponseObj.ReturnCode = enResponseCode.Fail; transfer.BizResponseObj.ReturnMsg = EnResponseMessage.NotFound; transfer.BizResponseObj.ErrorCode = enErrorCode.NotFound; return(transfer); } else { transfer.Transfers = trans; transfer.BizResponseObj.ReturnCode = enResponseCode.Success; transfer.BizResponseObj.ReturnMsg = EnResponseMessage.FindRecored; transfer.BizResponseObj.ErrorCode = enErrorCode.Success; return(transfer); } } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
//vsolanki 11-10-2018 wallettypemaster Get by id public WalletTypeMasterResponse GetWalletTypeMasterById(long WalletTypeId) { WalletTypeMasterResponse walletTypeMasterResponse = new WalletTypeMasterResponse(); try { var _walletTypeMaster = _WalletTypeMasterRepository.GetSingle(item => item.Id == WalletTypeId && item.Status != Convert.ToInt16(ServiceStatus.Disable)); if (_walletTypeMaster == null) { walletTypeMasterResponse.ReturnCode = enResponseCode.Fail; walletTypeMasterResponse.ReturnMsg = EnResponseMessage.NotFound; return(walletTypeMasterResponse); } else { walletTypeMasterResponse.walletTypeMaster = _walletTypeMaster; walletTypeMasterResponse.ReturnCode = enResponseCode.Success; walletTypeMasterResponse.ErrorCode = enErrorCode.Success; walletTypeMasterResponse.ReturnMsg = EnResponseMessage.FindRecored; return(walletTypeMasterResponse); } //return _walletTypeMaster; } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); walletTypeMasterResponse.ReturnCode = enResponseCode.InternalError; return(walletTypeMasterResponse); } }
//vsolanki 11-10-2018 delete from wallettypemaster public BizResponseClass DisableWalletTypeMaster(long WalletTypeId) { try { var _walletTypeMaster = _WalletTypeMasterRepository.GetById(WalletTypeId); if (_walletTypeMaster == null) { return(new BizResponseClass { ErrorCode = enErrorCode.InvalidWallet, ReturnCode = enResponseCode.Fail, ReturnMsg = EnResponseMessage.InvalidWallet }); } else { //_WalletTypeMasterRepository.Delete(_walletTypeMaster); _walletTypeMaster.DisableStatus(); _WalletTypeMasterRepository.Update(_walletTypeMaster); return(new BizResponseClass { ReturnCode = enResponseCode.Success, ReturnMsg = EnResponseMessage.RecordDisable, ErrorCode = enErrorCode.Success }); } } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); return(new BizResponseClass { ReturnCode = enResponseCode.InternalError, }); } }
public string SendJsonRpcAPIRequestAsync(string Url, string RequestStr, WebHeaderCollection headerDictionary = null) { try { string WSResponse = ""; try { //var authInfo = UserName + ":" + Password; //authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo)); var myReqrpc = WebRequest.Create(Url); //myReqrpc.Headers.Add("Authorization", "Basic " + authInfo); myReqrpc.Headers = headerDictionary; myReqrpc.Method = "Post"; var sw = new StreamWriter(myReqrpc.GetRequestStream()); sw.Write(RequestStr); sw.Close(); WebResponse response; response = myReqrpc.GetResponse(); StreamReader StreamReader = new StreamReader(response.GetResponseStream()); WSResponse = StreamReader.ReadToEnd(); StreamReader.Close(); response.Close(); return(WSResponse); } catch (WebException webex) { if (webex.Response != null) { WebResponse errResp = webex.Response; Stream respStream = errResp.GetResponseStream(); StreamReader reader = new StreamReader(respStream); string Text = reader.ReadToEnd(); if (Text.ToLower().Contains("code")) { WSResponse = Text; } } else { WSResponse = webex.Message; } webex = null; return(WSResponse); } } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }
public void OnStatusSuccess(short Status, TransactionQueue Newtransaction, TradeTransactionQueue NewTradeTransaction, string Token, short OrderType) { try { GetTradeHistoryInfo historyInfo = new GetTradeHistoryInfo(); GetBuySellBook BuySellmodel = new GetBuySellBook(); //update Recent Order //pop OpenOrder //add tradehistory //add orderhistory //pop buyer/seller book; //HelperForLog.WriteLogIntoFile("OnStatusSuccess", ControllerName, "Call ---- TransactionQueue :" + JsonConvert.SerializeObject(Newtransaction) + " TradeTransactionQueue :" + JsonConvert.SerializeObject(NewTradeTransaction)); if (string.IsNullOrEmpty(Token)) { Token = GetTokenByUserID(NewTradeTransaction.MemberID.ToString()); } if (!string.IsNullOrEmpty(Token)) { BuySellmodel.Amount = 0; BuySellmodel.OrderId = new Guid(); BuySellmodel.RecordCount = 0; if (NewTradeTransaction.TrnType == 4)//Buy { BuySellmodel.Price = NewTradeTransaction.BidPrice; BuyerBook(BuySellmodel, NewTradeTransaction.PairName); HelperForLog.WriteLogIntoFile("OnStatusSuccess", ControllerName, "BuyerBook call TRNNO:" + Newtransaction.Id); } else//Sell { BuySellmodel.Price = NewTradeTransaction.AskPrice; SellerBook(BuySellmodel, NewTradeTransaction.PairName); HelperForLog.WriteLogIntoFile("OnStatusSuccess", ControllerName, "SellerBook call TRNNO:" + Newtransaction.Id); } GetAndSendRecentOrderData(Newtransaction, NewTradeTransaction, Token, OrderType); //Update Recent HelperForLog.WriteLogIntoFile("OnStatusSuccess", ControllerName, " Aftre Recent Order Socket call TRNNO:" + Newtransaction.Id); GetAndSendOpenOrderData(Newtransaction, NewTradeTransaction, Token, OrderType, 1); //update OpenOrder HelperForLog.WriteLogIntoFile("OnStatusSuccess", ControllerName, " Aftre Open Order Socket call TRNNO:" + Newtransaction.Id); historyInfo = GetAndSendTradeHistoryInfoData(Newtransaction, NewTradeTransaction, OrderType); OrderHistory(historyInfo, historyInfo.PairName); //Order HelperForLog.WriteLogIntoFile("OnStatusSuccess", ControllerName, " Aftre Order History Socket call : TRNNO:" + Newtransaction.Id); TradeHistory(historyInfo, Token); //TradeHistory HelperForLog.WriteLogIntoFile("OnStatusSuccess", ControllerName, " Aftre Trade History Socket call : TRNNO:" + Newtransaction.Id); var msg = EnResponseMessage.SignalRTrnSuccessfullySettled; msg = msg.Replace("#Price#", historyInfo.Price.ToString()); msg = msg.Replace("#Qty#", historyInfo.Amount.ToString()); msg = msg.Replace("#Total#", historyInfo.Total.ToString()); ActivityNotification(msg, Token); } } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); //throw ex; } }
//public readonly ILogger<WebAPISendRequest> _log; //public WebAPISendRequest(ILogger<WebAPISendRequest> log) //{ // _log = log; //} public string SendAPIRequestAsync(string Url, string Request, string ContentType, int Timeout = 180000, WebHeaderCollection headerDictionary = null, string MethodType = "POST") { string responseFromServer = ""; try { object ResponseObj = new object(); // ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls //| SecurityProtocolType.Tls11 //| SecurityProtocolType.Tls12 //| SecurityProtocolType.Ssl3; ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; var httpWebRequest = (HttpWebRequest)WebRequest.Create(Url); httpWebRequest.ContentType = ContentType; httpWebRequest.Method = MethodType.ToUpper(); httpWebRequest.KeepAlive = false; httpWebRequest.Timeout = Timeout; httpWebRequest.Headers = headerDictionary; //_log.LogInformation(System.Reflection.MethodBase.GetCurrentMethod().Name, Url, Request); HelperForLog.WriteLogIntoFile(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, Url + "Request::" + Request); if (Request != null) { using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { streamWriter.Write(Request); streamWriter.Flush(); streamWriter.Close(); } } HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse; using (StreamReader sr = new StreamReader(httpWebResponse.GetResponseStream())) { responseFromServer = sr.ReadToEnd(); sr.Close(); sr.Dispose(); } httpWebResponse.Close(); //_log.LogInformation(System.Reflection.MethodBase.GetCurrentMethod().Name, responseFromServer); HelperForLog.WriteLogIntoFile(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, responseFromServer); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); //throw ex; } return(responseFromServer); }
public void OnStatusCancel(short Status, TransactionQueue Newtransaction, TradeTransactionQueue NewTradeTransaction, string Token, short OrderType) { try { GetTradeHistoryInfo historyInfo = new GetTradeHistoryInfo(); //pop from OpenOrder //update Recent order //add Trade history //HelperForLog.WriteLogIntoFile("OnStatusCancel", ControllerName, " TransactionQueue :" + JsonConvert.SerializeObject(Newtransaction) + " TradeTransactionQueue :" + JsonConvert.SerializeObject(NewTradeTransaction)); if (string.IsNullOrEmpty(Token)) { Token = GetTokenByUserID(NewTradeTransaction.MemberID.ToString()); } if (!string.IsNullOrEmpty(Token)) { GetAndSendOpenOrderData(Newtransaction, NewTradeTransaction, Token, OrderType, 1); //with amount 0, remove from OpenOrder HelperForLog.WriteLogIntoFile("OnStatusCancel", ControllerName, " Aftre Open Order Socket call : TRNNO:" + Newtransaction.Id); GetAndSendRecentOrderData(Newtransaction, NewTradeTransaction, Token, OrderType); //Update Recent HelperForLog.WriteLogIntoFile("OnStatusCancel", ControllerName, " Aftre Recent Order Socket call : TRNNO:" + Newtransaction.Id); historyInfo = GetAndSendTradeHistoryInfoData(Newtransaction, NewTradeTransaction, OrderType); TradeHistory(historyInfo, Token);//TradeHistory HelperForLog.WriteLogIntoFile("OnStatusCancel", ControllerName, " Aftre Trade History Socket call : TRNNO:" + Newtransaction.Id); } } catch (Exception ex) { _logger.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error); //throw ex; } //public void OnWalletBalChangeByUserID(WalletMasterResponse Data, string WalletTypeName, long UserID) //{ // try // { // //string str = "clientId=cleanarchitecture&grant_type=password&[email protected]&password=P@ssw0rd!&scope=openid profile email offline_access client_id roles phone"; // //str = str.Replace("=","\":\""); // //str = str.Replace("&", "\",\""); // //str = "{\"" + str + "\"}"; // //var obj = JsonConvert.DeserializeObject(str); // //var jsonData= JsonConvert.SerializeObject(obj); // var Redis = new RadisServices<ConnetedClientToken>(this._fact); // string AccessToken = Redis.GetHashData("Tokens:" + UserID.ToString(), "Token"); // Token = AccessToken; // BuyerSideWalletBal(Data, WalletTypeName, Token); // SellerSideWalletBal(Data, WalletTypeName, Token); // } // catch (Exception ex) // { // HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); // //throw ex; // } }
public decimal GetLedgerLastPostBal(long walletId) { try { var bal = _repository.GetLedgerLastPostBal(walletId); return(0); } catch (Exception ex) { HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex); throw ex; } }