public void VerifyUniqueUserName(UserDetails newUser) { Debug.Log("get all users"); //List<UserDetails> allUsers = new List<UserDetails>(); DBCommunicator.GetAllUser(allUsers => { bool uniqueName = true; foreach (UserDetails user in allUsers) { if (user.userName.ToLower() == newUser.userName.ToLower()) { uniqueName = false; break; } } if (uniqueName) { RegisterClicked(newUser); } else { Debug.LogError("The UserName is already in use"); } }); }
public void StoreLevel(LevelDetails levelD) { Debug.Log("calling store Level"); DBCommunicator.StoreLevel(levelD, () => { Debug.Log("Level Stored"); }); }
public override void LoadDataFromDB() { base.LoadDataFromDB(); //load fee List <CDBTurnoverFee> lst = DBCommunicator.LoadTurnoverFeesCoef(); _lstTurnOverFeeDep = new List <CDBTurnoverFee>(lst); }
public void RegisterClicked(UserDetails newUserDetails) { DBCommunicator.PutUserRegister(newUserDetails, newUID => { Debug.Log("new user's id is " + newUID); DBCommunicator.GetRegisteredUser(newUID, userDetails => { RegisterToPlayerPref(userDetails); }); }); }
public static string SaveRecord(DepartmentInfo obj) { DBCommunicator db = new DBCommunicator(); string[] p = { "@Title", "@Abbreviation", "@FarsiTitle", "@User", "@Date", "@Error" }; string[] v = { obj.Title, obj.Abbreviation, obj.FarsiTitle, "1", DateTime.Now.ToString() }; string r = db.ExecuteProcedureDML(p, v, "spPageDepartmentSave"); return(r); }
public static string DeleteRecord(int Code) { DBCommunicator db = new DBCommunicator(); string[] p = { "@Code", "@Error" }; string[] v = { Code.ToString() }; string r = db.ExecuteProcedureDML(p, v, "spPageDepartmentDelete"); return(r); }
public static void PutUserRegister(UserDetails newUserDetails, PostNewRegisterCallback callback) { DBCommunicator.GetLastUserID(uID => { uID.LastUserID += 3; DBCommunicator.PostLastUserID(uID, () => { }); newUserDetails.uId = uID.LastUserID; RestClient.Put <UserDetails>($"{databaseURL}Users/{newUserDetails.uId}.json", newUserDetails).Then(response => { callback(newUserDetails.uId); }); }); }
public void UpdateCurrentMinSteps(string instrument, decimal newMinSteps) { var res = Instruments.Find(el => el.instrument == instrument); if (res != null) { Log(String.Format("Changed min_step {0} {1} --> {2}", instrument, res.Min_step, newMinSteps)); res.Min_step = newMinSteps; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-us"); DBCommunicator.UpdateMinStep(instrument, StockExchId, newMinSteps); } }
public void UpdatePriceDecimals(string instrument, int newPriceDecimals) { var res = Instruments.Find(el => el.instrument == instrument); if (res != null) { Log(String.Format("Changed pirce decimals {0} {1} --> {2}", instrument, res.RoundTo, newPriceDecimals)); res.RoundTo = newPriceDecimals; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-us"); DBCommunicator.UpdateRoundTo(instrument, StockExchId, newPriceDecimals); } }
public void UpdateUserPosLogLate(CDBUpdateLate dbUpdateFee) { DBCommunicator.QueueData(dbUpdateFee); _tradersDispatcher.EnqueueUpdateUserPosLogLate(dbUpdateFee.BotId, new TradingLib.ProtoTradingStructs.CUserPosLogUpdLate() { Instrument = dbUpdateFee.Instrument, Fee = dbUpdateFee.Fee, Fee_Total = dbUpdateFee.Fee_Total, VMClosed_RUB = dbUpdateFee.VMClosed_RUB, VMClosed_RUB_user = dbUpdateFee.VMClosed_RUB_user } ); }
public static List <DepartmentInfo> ShowRecord() { DBCommunicator db = new DBCommunicator(); DataTable dt = db.ExecuteProcedureSelect("spPageDepartmentLoad"); List <DepartmentInfo> lst = new List <DepartmentInfo>(); foreach (DataRow row in dt.Rows) { DepartmentInfo d = new DepartmentInfo(); d.ID = row[0].ToString(); d.Title = row["Title"].ToString(); d.Abbreviation = row["Abbreviation"].ToString(); d.FarsiTitle = row["FarsiTitle"].ToString(); d.Edit = true; d.Delete = true; lst.Add(d); } return(lst); }
public void Thread100MsLogics() { DBCommunicator.WaitReadyForOperations(); _moneyTracker = new CMoneyTracker(this); _moneyTracker.LoadDataOnStart(); while (true) { try { _moneyTracker.Process(); Thread.Sleep(100); } catch (Exception e) { Error("Thread100MsLogics", e); Thread.Sleep(100); } } }
public void UpdateFeeTurnoverCoefs() { List <CDBTurnoverFee> lstDbFeesToUpdate = new List <CDBTurnoverFee>(); //iterate turnovers _lstTurnOvers.ForEach(el => { CDBTurnoverFee dbTrn = CalcFeeFromTrunOver(el.turnover); //find accountTradeId in accounts foreach (var kvp in AccountsTrade) { if (kvp.Key == el.account_trade_Id) { bool bChanged = false; if (kvp.Value.proc_fee_turnover_limit != dbTrn.proc_fee_turnover_limit) { Log(String.Format("accountTradeId={0} change proc_fee_turnover_limit {1} => {2}", kvp.Key, kvp.Value.proc_fee_turnover_limit, dbTrn.proc_fee_turnover_limit)); kvp.Value.proc_fee_turnover_limit = dbTrn.proc_fee_turnover_limit; bChanged = true; } if (kvp.Value.proc_fee_turnover_market != dbTrn.proc_fee_turnover_market) { Log(String.Format("accountTradeId={0} change proc_fee_turnover_market {1} => {2}", kvp.Key, kvp.Value.proc_fee_turnover_market, dbTrn.proc_fee_turnover_market)); kvp.Value.proc_fee_turnover_market = dbTrn.proc_fee_turnover_market; bChanged = true; } if (bChanged) { kvp.Value.proc_fee_turnover_limit = dbTrn.proc_fee_turnover_limit; kvp.Value.proc_fee_turnover_market = dbTrn.proc_fee_turnover_market; dbTrn.account_money_id = kvp.Key; lstDbFeesToUpdate.Add(dbTrn); break; } } } } ); if (lstDbFeesToUpdate.Count > 0) { DBCommunicator.UpdateTradersFeeProc(lstDbFeesToUpdate); } }
public void UpdateFeeUserDealsLog(CDBUpdateFeeUserDealsLog dbUpdFeeUserDealsLog) { DBCommunicator.QueueData(dbUpdFeeUserDealsLog); }
public string LoadStockExchPassword(string login) { return(DBCommunicator.LoadStockExchPassword(StockExchId, login)); }
public void SaveNewPassword(string login) { DBCommunicator.SaveNewPassword(StockExchId, login, _newPassword); PasswordChangeReply(true, ""); }
private void ProcessSymbolDetails() { Log("GetSymbolDetails start"); ResponseSymbolDetails[] resp = _bfxRestConnectorV1.GetSymbolDetails(); Log("GetSymbolDetails end"); //--- initial fill of DB (on very first start only) if (_bfxNeedInitInstruments) { for (int i = 0; i < resp.Count(); i++) { string instrument = resp[i].pair; string instrUpper = instrument.ToUpper(); //for now intrested only in Xusd pairs if (instrument.Contains("usd")) { DBCommunicator.TransactAddInstrument(instrUpper, CodesStockExch._04_CryptoBitfinex); } } return; } //--- end of initial DB fill foreach (var dbIsntr in Instruments) { for (int i = 0; i < resp.Count(); i++) { decimal decMinOrdSize = Convert.ToDecimal(resp[i].minimum_order_size); if (resp[i].pair == dbIsntr.instrument.ToLower() && decMinOrdSize != dbIsntr.minimum_order_size) { dbIsntr.minimum_order_size = decMinOrdSize; int oldDecimalVolume = dbIsntr.DecimalVolume; dbIsntr.DecimalVolume = CUtilConv.GetRoundTo(dbIsntr.minimum_order_size); DBCommunicator.UpdateCryptoInstrumentData(resp[i].pair, CodesStockExch._04_CryptoBitfinex, decMinOrdSize, dbIsntr.DecimalVolume); Log(String.Format("Update minimum_order_size={0} {1}", dbIsntr.minimum_order_size, dbIsntr.instrument)); if (oldDecimalVolume != dbIsntr.DecimalVolume) { _bfxWebSockConnector.UpdateDecimalVolume(dbIsntr.instrument, dbIsntr.DecimalVolume); Log(String.Format("Update DecimalVolume {0} {1}", dbIsntr.DecimalVolume, dbIsntr.instrument)); } } } } if (_tradeHistStor == null) { _tradeHistStor = new CTradeHistStor(Instruments.GetInstruments(), DBCommunicator); } }
public void GetLevel(string levelName) { DBCommunicator.GetLevel(levelName, levelDetails => { Debug.Log("levelDetails: " + levelDetails.levelJson); }); }