public bool UpdateState(long transId, int state) { try { if (UserContext.UserInfo.GroupID != 0) { var agencyAccount = AgencyDAO.GetById(UserContext.UserInfo.AccountID); if (agencyAccount == null) { return(false); } TransactionDAO.UpdateState(transId, state, agencyAccount.GameAccountId); } else { TransactionDAO.UpdateStateAdmin(transId, state); } return(true); } catch (Exception ex) { NLogManager.PublishException(ex); } return(false); }
public dynamic GetDashboard(int month, int year) { try { var result = new List <AgencyCashFlow>(); var refundLogs = new List <RefundLog>(); var transactionLogs = new List <TransactionLog>(); int from = int.Parse($"{year.ToString("D4")}{month.ToString("D2")}01"); DateTime _end = new DateTime(year, month, 1).AddMonths(1).AddDays(-1); int to = int.Parse($"{year.ToString("D4")}{month.ToString("D2")}{_end.Day.ToString("D2")}"); var agencies = new List <Ag>(); var curLevel = UserContext.UserInfo.GroupID; if (curLevel == 0) { agencies = AgencyDAO.GetAgencies(null); refundLogs = TransactionDAO.GetRefundLogs(null, from, to); transactionLogs = TransactionDAO.GetTransactionLogs(null, from, to); } else { var curId = UserContext.UserInfo.AccountID; agencies = AgencyDAO.GetAgencies(curId); refundLogs = TransactionDAO.GetRefundLogs(curId, from, to); transactionLogs = TransactionDAO.GetTransactionLogs(curId, from, to); } var rootAgenciesId = agencies.Select(x => x.GameAccountId); foreach (var item in agencies) { var trf = refundLogs.Where(x => x.AccountId == item.ID).Sum(x => x.TotalRefund); var totalGold = transactionLogs.Where(x => (x.SenderID == item.GameAccountId && !rootAgenciesId.Contains(x.RecvID)) || (x.RecvID == item.GameAccountId && !rootAgenciesId.Contains(x.SenderID))).Sum(x => x.Amount); var transactionCount = transactionLogs.Where(x => (x.SenderID == item.GameAccountId && !rootAgenciesId.Contains(x.RecvID)) || (x.RecvID == item.GameAccountId && !rootAgenciesId.Contains(x.SenderID))).Count(); var statisticItem = new AgencyCashFlow { Displayname = item.Displayname, Gold = item.Gold, LockedGold = item.LockedGold, TotalGold = totalGold, TRF = trf, TRF2 = 0, TransactionCount = transactionCount, Level = item.Level }; result.Add(statisticItem); } return(result); } catch (Exception ex) { NLogManager.PublishException(ex); } return(null); }
public List <Models.Agency> GetAll() { try { if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["CloseAgencies"])) { return(new List <Models.Agency>()); } var accountSandbox = ConfigurationManager.AppSettings["AccountSandbox"].Split(',').ToList(); var accountId = AccountSession.AccountID; if (accountSandbox.Count() > 0) { if (accountSandbox.Count(x => x == accountId.ToString()) > 0) { return(AgencyDAO.GetAllAgency_v1()); } } return(AgencyDAO.GetAllAgency()); } catch (Exception ex) { NLogManager.PublishException(ex); } return(null); }
private void GetData() { DBHelper helper = null; helper = new DBHelper(_conStrPortalDbRoot); DataTable dt; long accID = 0; var query = ""; if (_id > 0) { var account = AgencyDAO.GetById(_id); if (UserContext.UserInfo.GroupID == 0) { if (account != null) { if (account.IsAgency == true) { accID = account.ID; } } } else { if (account != null) { if (account.IsAgency == true) { var agencyInfo = TransactionDAO.GetAgencyInfo(account.GameAccountId); if (agencyInfo != null && agencyInfo.Creator == UserContext.UserInfo.AccountID) { accID = account.GameAccountId; } } } } } else { var agency = AgencyDAO.GetById(UserContext.UserInfo.AccountID); accID = agency.GameAccountId; } if (_type == 0) { query = $"select top 1000 * from ag.[Transaction] where {accID} in (SenderID, RecvID) and CreatedTimeInt >= {_start} and CreatedTimeInt <= {_end} order by id desc"; } else if (_type == 1) { query = $"select top 1000 * from ag.[Transaction] where RecvID = {accID} and CreatedTimeInt >= {_start} and CreatedTimeInt <= {_end} order by id desc"; } else { query = $"select top 1000 * from ag.[Transaction] where SenderID = {accID} and CreatedTimeInt >= {_start} and CreatedTimeInt <= {_end} order by id desc"; } dt = helper.GetDataTable(query); CreateSheet("Lịch sử giao dịch", dt); }
public dynamic GetAllAgencies() { var level = UserContext.UserInfo.GroupID; if (level == 0) { return(AgencyDAO.GetAllAgencies()); } return(null); }
public dynamic GetAll() { try { return(AgencyDAO.GetAll()); } catch (Exception ex) { NLogManager.PublishException(ex); } return(null); }
public bool HideAgency(long id, int display) { try { AgencyDAO.HideAgency(id, display); return(true); } catch (Exception ex) { NLogManager.PublishException(ex); } return(false); }
public bool DeleteAgency(long id) { try { AgencyDAO.DeleteAgency(id); return(true); } catch (Exception ex) { NLogManager.PublishException(ex); } return(false); }
public dynamic Management(int month, int year) { try { DateTime start = new DateTime(year, month, 1); DateTime end = new DateTime(year, month, 1).AddMonths(1).AddDays(-1); return(AgencyDAO.Management(start, end)); } catch (Exception ex) { NLogManager.PublishException(ex); } return(null); }
public bool AuthorizeAgency(long gameAccountId, string gameName, string display, string tel, string fb, string tele, string address) { try { if (string.IsNullOrEmpty(display) || UserContext.UserInfo.GroupID > 1) { return(false); } AgencyDAO.AuthorizeAgency(gameAccountId, UserContext.UserInfo.AccountID, UserContext.UserInfo.FullName, display, Utilities.Encryption.Security.MD5Encrypt(gameName), tel, fb, tele, address, gameName, UserContext.UserInfo.GroupID + 1); return(true); } catch (Exception ex) { NLogManager.PublishException(ex); } return(false); }
public async Task <dynamic> GetListTransAccount(long gameAccountId, int from, int to) { try { var data = new List <RewardInfoItemVM>(); // Rate giao dich cua tung tai khoan voi dai ly hien tai var rates = AgencyDAO.GetAccountTransactionRateDetail(gameAccountId, from, to); if (!rates.Any()) { return(data); } string list = string.Empty; foreach (var item in rates) { list += item.AccountId.ToString() + ";" + item.CreatedDateInt.ToString() + ","; } list = list.TrimEnd(','); // Luong tien cua cac tai khoan giao dich voi dai ly hien tai var accountMoney = new List <AccountMoneyFlow>(); using (var financial = new FinancialSoapClient()) { var response = await financial.GetAccountsMoneyStreamAsync(list); var accountMoneyStreams = response.Body.GetAccountsMoneyStreamResult; if (accountMoneyStreams.Length < 1) { return(data); } foreach (var i in accountMoneyStreams) { accountMoney.Add(new AccountMoneyFlow { AccountId = i.AccountId, CreatedDateInt = i.CreatedDateInt, Money = i.Money }); } } var linq = (from rate in rates join account in accountMoney on new { rate.AccountId, rate.CreatedDateInt } equals new { account.AccountId, account.CreatedDateInt } into accountRates from accountRate in accountRates select new AccountMoneyStreamDetailVM { AccountId = rate.AccountId, DisplayName = rate.DisplayName, CreatedDateInt = rate.CreatedDateInt, Money = (long)(rate.Rate * accountRate.Money), }); var result = linq.GroupBy(x => new { x.AccountId, x.DisplayName }).Select(t => new AccountMoneyFlowDetail { AccountId = t.Key.AccountId, DisplayName = t.Key.DisplayName, TotalMoney = t.Sum(i => i.Money) }); return(result); } catch (Exception ex) { NLogManager.PublishException(ex); } return(null); }
public dynamic GetAgencyInfos(int from, int to) { return(AgencyDAO.GetAgencies(from, to)); }
public dynamic AgencyTransaction(int id, string start, string end, int type, int page = 0) { try { DateTime from = new DateTime(Convert.ToInt32(start.Substring(0, 4)), Convert.ToInt32(start.Substring(4, 2)), Convert.ToInt32(start.Substring(6, 2))); DateTime to = new DateTime(Convert.ToInt32(end.Substring(0, 4)), Convert.ToInt32(end.Substring(4, 2)), Convert.ToInt32(end.Substring(6, 2))); var skip = page * 50; long totalMoney = 0, totalFee = 0; if (id > 0) { var account = AgencyDAO.GetById(id); if (UserContext.UserInfo.GroupID == 0) { if (account != null) { if (account.IsAgency == true) { var _data = TransactionDAO.TransactionHistory(account.GameAccountId, from, to, type, skip, 50, out totalMoney, out totalFee); return(new { TotalMoney = totalMoney, TotalFee = totalFee, Data = _data }); } } } else { if (account != null) { if (account.IsAgency == true) { var agencyInfo = TransactionDAO.GetAgencyInfo(account.GameAccountId); if (agencyInfo != null && agencyInfo.Creator == UserContext.UserInfo.AccountID) { var _data = TransactionDAO.TransactionHistory(account.GameAccountId, from, to, type, skip, 50, out totalMoney, out totalFee); return(new { TotalMoney = totalMoney, TotalFee = totalFee, Data = _data }); } } } } } else { var agency = AgencyDAO.GetById(UserContext.UserInfo.AccountID); if (agency != null) { var _data = TransactionDAO.TransactionHistory(agency.GameAccountId, from, to, type, skip, 50, out totalMoney, out totalFee); return(new { TotalMoney = totalMoney, TotalFee = totalFee, Data = _data }); } } return(null); } catch (Exception ex) { NLogManager.PublishException(ex); } return(null); }