public static AccountInfo Create(IAccountInfo src) { return(new AccountInfo { AccountId = src.AccountId }); }
/// <summary>获取我的文档列表数据</summary> /// <param name="doc"></param> /// <returns></returns> public string GetMyListPaging(XmlDocument doc) { StringBuilder outString = new StringBuilder(); PagingHelper paging = PagingHelper.Create(XmlHelper.Fetch("paging", doc, "xml"), XmlHelper.Fetch("query", doc, "xml")); // 设置当前用户权限 if (XmlHelper.Fetch("su", doc) == "1" && AppsSecurity.IsAdministrator(KernelContext.Current.User, ConnectConfiguration.ApplicationName)) { paging.Query.Variables["elevatedPrivileges"] = "1"; } paging.Query.Variables["accountId"] = KernelContext.Current.User.Id; IAccountInfo account = KernelContext.Current.User; int rowCount = -1; IList <ConnectQueryInfo> list = this.service.GetQueryObjectPaging(paging.RowIndex, paging.PageSize, paging.Query, out rowCount); paging.RowCount = rowCount; outString.Append("{\"data\":" + AjaxUtil.Parse <ConnectQueryInfo>(list) + ","); outString.Append("\"paging\":" + paging + ","); outString.Append(MessageObject.Stringify("0", I18n.Strings["msg_query_success"], true) + "}"); return(outString.ToString()); }
private void AddCacheItem(IAccountInfo item) { if (!string.IsNullOrEmpty(item.Id)) { if (this.dictionary["id"].ContainsKey(item.Id)) { this.dictionary["id"].Add(item.Id, item); } else { this.dictionary["id"][item.Id] = item; } } if (!string.IsNullOrEmpty(item.LoginName)) { if (this.dictionary["loginName"].ContainsKey(item.LoginName)) { this.dictionary["loginName"].Add(item.LoginName, item); } else { this.dictionary["loginName"][item.LoginName] = item; } } }
public string GetApplicationMenu(IAccountInfo account, string applicationName, string parentMenuFullPath) { return(GetApplicationMenu(account, applicationName, new Dictionary <string, string>() { { "parentMenuFullPath", parentMenuFullPath } })); }
// ------------------------------------------------------- // 保存 删除 // ------------------------------------------------------- #region 函数:Save(BugCategoryInfo param) /// <summary>保存记录</summary> /// <param name="param">实例<see cref="BugCategoryInfo"/>详细信息</param> /// <returns>实例<see cref="BugCategoryInfo"/>详细信息</returns> public BugCategoryInfo Save(BugCategoryInfo param) { if (string.IsNullOrEmpty(param.Id)) { throw new Exception("实例标识不能为空。"); } bool isNewObject = !this.IsExist(param.Id); string methodName = isNewObject ? "新增" : "编辑"; IAccountInfo account = KernelContext.Current.User; if (methodName == "新增") { param.AccountId = account.Id; param.AccountName = account.Name; } this.provider.Save(param); // 保存实体数据操作记录 EntityLifeHistoryInfo history = new EntityLifeHistoryInfo(); history.Id = DigitalNumberContext.Generate("Key_Guid"); history.AccountId = account.Id; history.MethodName = methodName; history.EntityId = param.Id; history.EntityClassName = KernelContext.ParseObjectType(typeof(BugInfo)); history.ContextDiffLog = string.Empty; EntitiesManagement.Instance.EntityLifeHistoryService.Save(history); return(param); }
/// <summary></summary> public string SetLoginName(XmlDocument doc) { string id = XmlHelper.Fetch("id", doc); string loginName = XmlHelper.Fetch("loginName", doc); IAccountInfo account = MembershipManagement.Instance.AccountService.FindOne(id); IAccountInfo optionAccount = KernelContext.Current.User; if (account == null || optionAccount == null) { return("{message:{\"returnCode\":1,\"value\":\"未检测到当前用户的合法信息。\"}}"); } if (string.IsNullOrEmpty(loginName)) { return("{message:{\"returnCode\":1,\"value\":\"登录名不能为空。\"}}"); } else if (!this.service.IsExistLoginName(loginName)) { this.service.SetLoginName(id, loginName); // 记录帐号操作日志 MembershipManagement.Instance.AccountLogService.Log(account.Id, "设置登录名", "【" + optionAccount.Name + "】将用户【" + account.Name + "】的登录名设置为【" + loginName + "】,【IP:" + IPQueryContext.GetClientIP() + "】。", optionAccount.Id); return("{message:{\"returnCode\":0,\"value\":\"设置登录名成功。\"}}"); } else { return("{message:{\"returnCode\":1,\"value\":\"已存在此登录名。\"}}"); } }
/// <summary>提交界面</summary> /// <returns></returns> public ActionResult Form(string options) { // 所属应用信息 ApplicationInfo application = ViewBag.application = AppsContext.Instance.ApplicationService[EntitiesConfiguration.ApplicationName]; JsonData request = JsonMapper.ToObject(options == null ? "{}" : options); string id = JsonHelper.GetDataValue(request, "id"); string entitySchemaId = JsonHelper.GetDataValue(request, "entitySchemaId"); EntityMetaDataInfo param = null; if (string.IsNullOrEmpty(id)) { IAccountInfo account = KernelContext.Current.User; param = new EntityMetaDataInfo(); param.Id = DigitalNumberContext.Generate("Key_Guid"); param.EntitySchemaId = entitySchemaId; param.Status = 1; param.CreatedDate = param.ModifiedDate = DateTime.Now; } else { param = EntitiesManagement.Instance.EntityMetaDataService.FindOne(id); } ViewBag.param = param; // 视图 return(View("/views/main/entities/entity-metadata-form.cshtml")); }
private string GetAccountType(IAccountInfo newAccount) { string result = ""; switch (newAccount.AccountType) { case Utility.AccountType.CHECKING: result = "Checking"; break; case Utility.AccountType.BUSINESS: result = "Business"; break; case Utility.AccountType.TERM: result = "CD"; break; case Utility.AccountType.LOAN: result = "Loan"; break; default: result = "INVALID!"; break; } return(result); }
/// <summary>序列化缓存信息</summary> /// <returns></returns> public virtual AccountCacheInfo Serialize(string appKey, string sessionId, IAccountInfo account) { AccountCacheInfo accountCache = new AccountCacheInfo(); accountCache.AccountIdentity = sessionId; accountCache.AppKey = appKey; accountCache.AccountCacheValue = account.LoginName; accountCache.AccountObject = this.SerializeObject(account); accountCache.AccountObjectType = KernelContext.ParseObjectType(account.GetType()); accountCache.IP = account.IP; accountCache.HttpUserAgent = HttpContext.Current == null ? string.Empty : HttpContext.Current.Request.UserAgent; accountCache.ValidFrom = DateTime.Now; accountCache.ValidTo = accountCache.ValidFrom.AddMonths(3); accountCache.Date = DateTime.Now; return(accountCache); }
//------------------------------------------------------- // 保存 删除 //------------------------------------------------------- #region 函数:SetMemberCard(XmlDocument doc) /// <summary>设置员工卡片信息</summary> /// <param name="doc">Xml 文档对象</param> /// <returns>返回操作结果</returns> public string SetMemberCard(XmlDocument doc) { IAccountInfo account = KernelContext.Current.User; MemberInfo member = new MemberInfo(); MemberExtensionInformation memberProperties = new MemberExtensionInformation(); member = (MemberInfo)AjaxUtil.Deserialize(member, doc); member.ExtensionInformation.Load(doc); // 更新自己的帐号信息 member.Id = member.AccountId = account.Id; if (string.IsNullOrEmpty(member.AccountId)) { return("{\"message\":{\"returnCode\":1,\"value\":\"必须填写相关帐号标识。\"}}"); } else { member.Account.IdentityCard = XmlHelper.Fetch("identityCard", doc); } this.service.SetMemberCard(member); // 记录帐号操作日志 MembershipManagement.Instance.AccountLogService.Log(account.Id, "hr.general.setMemberCard", "【" + account.Name + "】更新了自己的个人信息,【IP:" + IPQueryContext.GetClientIP() + "】。", account.Id); return(MessageObject.Stringify("0", I18n.Strings["msg_save_success"])); }
/// <summary>添加帐号与相关群组的关系</summary> /// <param name="accountId">帐号标识</param> /// <param name="groupId">群组标识</param> /// <param name="beginDate">启用时间</param> /// <param name="endDate">停用时间</param> public int AddRelation(string accountId, string groupId, DateTime beginDate, DateTime endDate) { if (string.IsNullOrEmpty(accountId)) { // 帐号标识不能为空 return(1); } if (string.IsNullOrEmpty(groupId)) { // 群组标识不能为空 return(2); } if (LDAPConfigurationView.Instance.IntegratedMode == "ON") { IAccountInfo account = MembershipManagement.Instance.AccountService[accountId]; IGroupInfo group = MembershipManagement.Instance.GroupService[groupId]; // 帐号对象、帐号的全局名称、帐号的登录名、群组对象、群组的全局名称等不能为空。 if (account != null && !string.IsNullOrEmpty(account.GlobalName) && !string.IsNullOrEmpty(account.LoginName) && group != null && !string.IsNullOrEmpty(group.GlobalName)) { LDAPManagement.Instance.Group.AddRelation(account.LoginName, LDAPSchemaClassType.User, group.Name); } } return(this.provider.AddRelation(accountId, groupId, beginDate, endDate)); }
// ------------------------------------------------------- // 保存 删除 // ------------------------------------------------------- #region 函数:Save(CustomizePageInfo param, IAccountInfo account, string effectScope) /// <summary>保存记录</summary> /// <param name="param">CustomizePageInfo 实例详细信息</param> /// <returns>CustomizePageInfo 实例详细信息</returns> public CustomizePageInfo Save(CustomizePageInfo param, IAccountInfo account, string effectScope) { switch (effectScope) { case "Corporation": param.AuthorizationObjectType = "Organization"; param.AuthorizationObjectId = MembershipManagement.Instance.MemberService[account.Id].CorporationId; break; case "Department": param.AuthorizationObjectType = "Organization"; param.AuthorizationObjectId = MembershipManagement.Instance.MemberService[account.Id].DepartmentId; break; case "Department2": param.AuthorizationObjectType = "Organization"; param.AuthorizationObjectId = MembershipManagement.Instance.MemberService[account.Id].Department2Id; break; case "Organization": param.AuthorizationObjectType = "Organization"; param.AuthorizationObjectId = MembershipManagement.Instance.MemberService[account.Id].OrganizationUnitId; break; default: param.AuthorizationObjectType = "Account"; param.AuthorizationObjectId = account.Id; break; } return(this.Save(param)); }
public TermDepositAccount(Customer newCustomer, AccountData newAccount, double newBalance = 0.0) : base(newAccount) { if (newAccount != null) { // Set initial account. newAccount.ID = IAccountInfo.GetNewAccountNumber(); newAccount.AccountType = Utility.AccountType.TERM; newAccount.LastTransactionState = Utility.TransactionCodes.SUCCESS; if (newBalance > 0.0) { newAccount.AccountBalance = newBalance; totalRecords.Add(new TransactionRecord(Utility.TransactionType.OPEN_ACCOUNT) { TransactionAmount = newBalance }); } else { newAccount.AccountBalance = 0.0; } // Set customer references. myCustomer = newCustomer; newAccount.CustomerID = newCustomer.CustomerID; // Default 1 Year term. newAccount.MaturityDate = DateTime.Now.AddYears(1); myCustomer.AddAccount(this); } }
/// <summary>获取头像信息</summary> /// <param name="doc">Xml 文档对象</param> /// <returns>返回操作结果</returns> public string GetCertifiedAvatar(XmlDocument doc) { string accountId = XmlHelper.Fetch("accountId", doc); IAccountInfo account = null; if (string.IsNullOrEmpty(accountId)) { account = KernelContext.Current.User; } else { account = MembershipManagement.Instance.AccountService[accountId]; } string avatar_120x120 = string.Empty; if (string.IsNullOrEmpty(account.CertifiedAvatar)) { avatar_120x120 = AttachmentStorageConfigurationView.Instance.VirtualUploadFolder + "avatar/default_120x120.png"; } else { avatar_120x120 = account.CertifiedAvatar.Replace("{uploads}", AttachmentStorageConfigurationView.Instance.VirtualUploadFolder); } return(avatar_120x120); }
/// <summary>提交界面</summary> /// <returns></returns> public ActionResult Form(string options) { // 所属应用信息 ApplicationInfo application = ViewBag.application = AppsContext.Instance.ApplicationService[BugConfiguration.ApplicationName]; JsonData request = JsonMapper.ToObject(options == null ? "{}" : options); string id = !request.Keys.Contains("id") ? string.Empty : request["id"].ToString(); BugCategoryInfo param = null; if (string.IsNullOrEmpty(id)) { IAccountInfo account = KernelContext.Current.User; param = new BugCategoryInfo(); param.Id = DigitalNumberContext.Generate("Key_Guid"); param.AccountId = account.Id; param.CreatedDate = param.ModifiedDate = DateTime.Now; } else { param = BugContext.Instance.BugCategoryService[id]; } ViewBag.param = param; // 视图 return(View("/views/main/bugs/bug-category-form.cshtml")); }
private string GetNavigationPortalShortcut(IAccountInfo account) { StringBuilder outString = new StringBuilder(); string whereClause = string.Format(@" PortalId = ##{0}## AND Status = 1 ORDER BY OrderId ", this.TryGetNavigationPortalIdentity(account)); IList <NavigationPortalShortcutInfo> list = NavigationContext.Instance.NavigationPortalShortcutService.FindAll(whereClause); outString.Append("<table class=\"table-style\" summary=\"\" ><tr>"); if (list.Count == 0) { outString.Append("<td> </td>"); } else { foreach (NavigationPortalShortcutInfo item in list) { outString.AppendFormat("<td><a href=\"{0}\" target=\"{1}\" ><img border=\"0\" src=\"{2}\" alt=\"{4}\" /></a><div><a href=\"{0}\" target=\"{1}\" >{3}</a></div></td>", item.Url, item.Target, item.BigIconPath, item.Text, item.Description); } } outString.Append("</tr></table>"); return(outString.ToString()); }
public BusinessAccount(Customer newCustomer, AccountData newAccount, double newBalance = 0.0) : base(newAccount) { // Initialize new account. if (newAccount != null) { newAccount.ID = IAccountInfo.GetNewAccountNumber(); newAccount.AccountType = Utility.AccountType.BUSINESS; newAccount.LastTransactionState = Utility.TransactionCodes.SUCCESS; if (newBalance > 0.0) { newAccount.AccountBalance = newBalance; totalRecords.Add(new TransactionRecord(Utility.TransactionType.OPEN_ACCOUNT) { TransactionAmount = newBalance }); } else { newAccount.AccountBalance = 0.0; } // Set customer references. myCustomer = newCustomer; newAccount.CustomerID = newCustomer?.CustomerID ?? -1; myCustomer.AddAccount(this); } }
public string GetShortcutMenu(IAccountInfo account) { StringBuilder outString = new StringBuilder(); string whereClause = string.Format(" ParentId=##{0}## AND MenuType = ##ShortcutMenu## AND Status = 1 ORDER BY OrderId ", Guid.Empty); AppsContext.Instance.ApplicationMenuService.FindAll(whereClause).ToList().ForEach(item => { // // 菜单 DisplayType = "MenuItem" , 菜单项. // 菜单 Status = 0 , 禁用. // //if (item.DisplayType == "MenuItem") //{ //} if (item.DisplayType == "MenuSplitLine") { outString.Append("<li class=\"line\">-*- 华丽的分隔线 -*-</li>"); } else { string dropdownMenu = GetStartDropdownMenu(item.Id); outString.AppendFormat("<li><a href=\"{2}\" title=\"{1}\" target=\"{3}\">{0}", StringHelper.NullOrEmptyTo(I18n.Menu[item.Id], item.Name), item.Description, item.Url, string.IsNullOrEmpty(item.Target) ? "_self" : item.Target); if (string.IsNullOrEmpty(dropdownMenu)) { // outString.Append("</a></li>\r\n"); outString.Append("<!--[if gte IE 7]><!--></a><!--<![endif]-->\r\n"); outString.Append("<!--[if lte IE 6]><table><tr><td><![endif]-->\r\n"); // outString.AppendFormat("<ul>{0}</ul>\r\n", links); outString.Append("<!--[if lte IE 6]></td></tr></table><![endif]-->\r\n"); outString.Append("<!--[if lte IE 6]></a><![endif]-->\r\n"); outString.Append("</li>\r\n"); } else { outString.Append("<!--[if gte IE 7]><!--></a><!--<![endif]-->\r\n"); outString.Append("<!--[if lte IE 6]><table><tr><td><![endif]-->\r\n"); outString.AppendFormat("<ul>{0}</ul>\r\n", dropdownMenu); outString.Append("<!--[if lte IE 6]></td></tr></table><![endif]-->\r\n"); outString.Append("<!--[if lte IE 6]></a><![endif]-->\r\n"); outString.Append("</li>\r\n"); } } }); return(outString.ToString()); }
/// <summary> /// Write-off bank account with bonuses. /// </summary> /// <param name="account"> Account for write-off.</param> /// <param name="amount"> Amount for write-off bank account.</param> /// <param name="bonus"> Bonus.</param> public virtual void WithdrawWithBonuses(IAccountInfo account, decimal amount, decimal bonus) { if (account is null) { throw new ArgumentNullException(nameof(account)); } this.bank.WithdrawWithBonuses(account, amount, bonus); }
public List<ICharacterInfo> GetCharacterInfos(IAccountInfo account, IServerDescription server) { ServerConsole.DebugLine("Auth-server requested character list for account: {0}", account.Username); return new List<ICharacterInfo>(new[] { new CharacterInfo(815, "Test Character") }); }
public void GetInfoNormalBehaviour() { Guid accountid = storage.Account.GetId("accountThatExists"); IAccountInfo accountinfo = storage.Account.GetInfo(accountid); Assert.AreEqual(accountinfo.Name, "accountThatExists"); Assert.AreEqual(accountinfo.Description, "accountThatExistsDesc"); }
/// <summary></summary> public static IList <IAccountInfo> ToAccounts(IAccountInfo Account) { IList <IAccountInfo> objects = new List <IAccountInfo>(); objects.Add(Account); return(objects); }
public List <ICharacterInfo> GetCharacterInfos(IAccountInfo account, IServerDescription server) { ServerConsole.DebugLine("Auth-server requested character list for account: {0}", account.Username); return(new List <ICharacterInfo>(new[] { new CharacterInfo(815, "Test Character") })); }
public Account AddLocalAccount(string userId, IAccountInfo info) { Account account = new Account(userId, info.AccountName, info.AccountType); account.ContributionRoom = info.ContributionRoom; m_context.Accounts.Add(account); m_context.SaveChanges(); return(account); }
/// <inheritdoc/> public void AddBankAccount(IAccountInfo account) { if (account == null) { throw new ArgumentNullException(nameof(account), "Account is null"); } this.accountInfos.Add(account); }
public BtceModels(IConfiguration configuration) { this.configuration = configuration; accountInfo = new AccountInfo(); ApiMessages = new ObservableCollection <ApiMessage>(); ActiveOrders = new List <IOrder>(); marketDepths = new Dictionary <BtcePairEnum, IMarketDepth>(); PairTrades = new Dictionary <BtcePairEnum, List <IMarketTrade> >(); }
/// <summary>解析页面</summary> /// <param name="account">帐号信息</param> /// <param name="pageName">页面名称</param> /// <returns></returns> public string ParsePage(IAccountInfo account, string pageName) { if (account == null) { return(string.Empty); } return(this.ParsePage("Account", account.Id, pageName)); }
// ------------------------------------------------------- // 授权范围管理 // ------------------------------------------------------- #region 函数:HasAuthority(string entityId, string authorityName, IAccountInfo account) /// <summary>判断用户是否拥数据权限信息</summary> /// <param name="entityId">实体标识</param> /// <param name="authorityName">权限名称</param> /// <param name="account">帐号</param> /// <returns>布尔值</returns> public bool HasAuthority(string entityId, string authorityName, IAccountInfo account) { return(MembershipManagement.Instance.AuthorizationObjectService.HasAuthority( string.Format("{0}_Scope", this.tableName), entityId, KernelContext.ParseObjectType(typeof(ApplicationSettingInfo)), authorityName, account)); }
public static bool IsHumanResourceOfficer(IAccountInfo account) { if (AppsSecurity.IsAdministrator(KernelContext.Current.User, HumanResourcesConfiguration.ApplicationName)) { return(true); } return(Instance.HumanResourceOfficerService.IsHumanResourceOfficer(account)); }
public BtceModels(IConfiguration configuration) { this.configuration = configuration; accountInfo = new AccountInfo(); ApiMessages = new ObservableCollection<ApiMessage>(); ActiveOrders = new List<IOrder>(); marketDepths = new Dictionary<BtcePairEnum, IMarketDepth>(); PairTrades = new Dictionary<BtcePairEnum, List<IMarketTrade>>(); }
/// <summary>判断用户是否是应用的默认审查员</summary> /// <param name="account">帐号</param> /// <param name="applicationId">应用的标识</param> /// <returns>布尔值</returns> public bool IsReviewer(IAccountInfo account, string applicationId) { if (IsAdministrator(account, applicationId)) { return(true); } return(HasAuthority(account, applicationId, "应用_默认_审查员")); }
/// <summary>获取顶部菜单信息</summary> /// <param name="account"></param> /// <param name="topMenu"></param> /// <returns></returns> public string GetTopMenu(IAccountInfo account) { StringBuilder outString = new StringBuilder(); string whereClause = string.Format(" ParentId=##{0}## AND MenuType = ##TopMenu## AND Status = 1 ORDER BY OrderId ", Guid.Empty); outString.Append("<!-- 顶部菜单【开始】-->"); AppsContext.Instance.ApplicationMenuService.FindAll(whereClause).ToList().ForEach(item => { // // 菜单 DisplayType = "MenuItem" , 菜单项. // 菜单 Status = 0 , 禁用. // if (item.DisplayType == "MenuItem") { outString.AppendFormat("<li><a href=\"{2}\" title=\"{1}\" target=\"{3}\">{0}", StringHelper.NullOrEmptyTo(I18n.Menu["Top", item.Id], item.Name), item.Description, item.Url, string.IsNullOrEmpty(item.Target) ? "_self" : item.Target); string dropdownMenu = GetTopDropdownMenu(item.Id); if (string.IsNullOrEmpty(dropdownMenu)) { outString.Append("</a></li>\r\n"); } else { outString.Append("<!--[if gte IE 7]><!--></a><!--<![endif]-->\r\n"); outString.Append("<!--[if lte IE 6]><table><tr><td><![endif]-->\r\n"); outString.AppendFormat("<ul>{0}</ul>\r\n", dropdownMenu); outString.Append("<!--[if lte IE 6]></td></tr></table><![endif]-->\r\n"); outString.Append("<!--[if lte IE 6]></a><![endif]-->\r\n"); outString.Append("</li>\r\n"); } } }); outString.Append("<!-- 顶部菜单【结束】-->"); VelocityContext context = new VelocityContext(); context.Put("hostName", HostName); context.Put("account", account); context.Put("startMenu", GetStartMenu(account)); context.Put("topMenu", outString.ToString()); return(VelocityManager.Instance.Merge(context, "themes/" + WebConfigurationView.Instance.ThemeName + "/layouts/navigation-top-menu.vm")); }
private void LoadSelectedUser() { SelectedUserName = Request.QueryString["user"]; SelectedUser = AccountManager.FindUserByName(SelectedUserName); if (SelectedUser == null) throw new N2Exception("User '{0}' not found.", SelectedUserName); /* REMOVE: MembershipUserCollection muc = System.Web.Security.Membership.FindUsersByName(SelectedUserName); if (muc.Count < 1) throw new N2.N2Exception("User '{0}' not found.", SelectedUserName); SelectedUser = muc[SelectedUserName]; */ }
/// <summary> /// Default constructor. /// </summary> /// <param name="accountName">the name of the account</param> public RealmAccount(string accountName, IAccountInfo info) { Name = accountName; Characters = new List<CharacterRecord>(); m_accountId = info.AccountId; ClientId = info.ClientId; IsActive = true; Role = PrivilegeMgr.Instance.GetRoleOrDefault(info.RoleGroupName); m_email = info.EmailAddress; LastIP = info.LastIP; LastLogin = info.LastLogin; Locale = info.Locale; }
public EditTradeViewModel(ITradeRequest initialTradeRequest, ITradingConfigurations tradingConfigurations, IAccountInfo accountInfo) { this.tradingConfigurations = tradingConfigurations; this.accountInfo = accountInfo; TradeRequest = initialTradeRequest; RateTickUp = new RelayCommand((parameters) => { tradeRequest.Rate += TickUpDownInterval; OnPropertyChanged("TradeRequest"); }); RateTickDown = new RelayCommand((parameters) => { tradeRequest.Rate -= TickUpDownInterval; OnPropertyChanged("TradeRequest"); }); tradeRequest.Amount = tradingConfigurations.CalculateAmount(initialTradeRequest.Pair, initialTradeRequest.TradeType, accountInfo.GetAmountFromEnum(initialTradeRequest.Pair)); }
public List<Task> Query(IAccountInfo accountInfo) { ErrorMessage = String.Empty; CalendarService service = new CalendarService("googleCalendar"); service.setUserCredentials(accountInfo.Username, accountInfo.Password); Log.InfoFormat("Fetching google account : [{0}]", accountInfo.ToString()); string queryUri = String.Format(CultureInfo.InvariantCulture, "http://www.google.com/calendar/feeds/{0}/private/full", service.Credentials.Username); Log.DebugFormat("Query='{0}'", queryUri); EventQuery eventQuery = new EventQuery(queryUri); List<Task> tasks = new List<Task>(); try { EventFeed eventFeed = service.Query(eventQuery); foreach (EventEntry eventEntry in eventFeed.Entries.Cast<EventEntry>()) { if (eventEntry.Times.Count > 0) { Task task = new Task { Id = eventEntry.EventId, Head = eventEntry.Title.Text, Description = eventEntry.Content.Content, StartDate = eventEntry.Times.First().StartTime, StopDate = eventEntry.Times.First().EndTime, Notes = accountInfo.Title, AccountInfo = accountInfo, Location = eventEntry.Locations.FirstOrDefault().ValueString, }; tasks.Add(task); } } } catch (Exception exception) { Log.ErrorFormat(exception.Message); Log.ErrorFormat(exception.ToString()); ErrorMessage = exception.Message; } return tasks; }