public async void SetExhibitors(RegisteredDomainViewModel _domain) { currentItem = _domain; currentDomain = currentItem.domain; companyName.Text = currentItem.domain.domainName; if (!string.IsNullOrEmpty(currentDomain.domainLogo)) { companyLogo.IsVisible = true; companyLogo.Source = currentDomain.domainLogo; //logoGrid.BackgroundColor = Color.Transparent; Regex initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?"); string init = initials.Replace(currentDomain.domainName, "$1"); if (init.Length > 3) { init = init.Substring(0, 3); } logoText.Text = init.ToUpper(); } else { companyLogo.IsVisible = false; //logoGrid.BackgroundColor = Color.FromHex("#31c3ee"); Regex initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?"); string init = initials.Replace(currentDomain.domainName, "$1"); if (init.Length > 3) { init = init.Substring(0, 3); } logoText.Text = init.ToUpper(); } _domain.HaveUnread = await App.serverData.CheckForNewNotifications(currentDomain.firmID); unReadNotification.IsVisible = _domain.HaveUnread; }
/// <summary> /// Returns a port if given in ServerDomain-string or the standard port number depending on context. /// </summary> public int GetPort(bool secure = false) { int p = 0; Int32.TryParse(ServerDomain.Split(':').Last(), out p); return(p == 0 ? (secure ? 443 : 80) : p); }
public void SetExhibitors(ServerDomain _domain) { currentDomain = _domain; companyName.Text = _domain.domainName; if (!string.IsNullOrEmpty(currentDomain.domainLogo)) { companyLogo.IsVisible = true; companyLogo.Source = currentDomain.domainLogo; //logoGrid.BackgroundColor = Color.Transparent; Regex initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?"); string init = initials.Replace(currentDomain.domainName, "$1"); if (init.Length > 3) { init = init.Substring(0, 3); } logoText.Text = init.ToUpper(); } else { companyLogo.IsVisible = false; //logoGrid.BackgroundColor = Color.FromHex("#31c3ee"); Regex initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?"); string init = initials.Replace(currentDomain.domainName, "$1"); if (init.Length > 3) { init = init.Substring(0, 3); } logoText.Text = init.ToUpper(); } }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中 IModHoldSeatServerBLLFactory factory = new ModHoldSeatServerBLLFactory(); IModHoldSeatServerBLL <TraModHoldSeatCallBackLogModel> holdSeatServer = factory.CreateBllObj(); ITraModOrderBLLFactory traModOrderBllFactory = new TraModOrderBLLFactory(); ITraModOrderBLL <TraModOrderModel> traModOrderBll = traModOrderBllFactory.CreateBllObj(); ITraInterFaceOrderServerBLLFactory traInterFaceOrderServerBllFactory = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrderServerBll = traInterFaceOrderServerBllFactory.CreateBllObj(); ITraOrderOperateServerBLLFactory traOrderOperateServerBllFactory = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperateServerBll = traOrderOperateServerBllFactory.CreateBllObj(); IRequestCancelServerBLLFactory requestCancelServerBllFactory = new RequestCancelServerBLLFactory(); IRequestCancelServerBLL <TraRequestCancelResponseModel> requestCancelServer = requestCancelServerBllFactory.CreateSampleBllObj(); IServerDomain domain = new ServerDomain(holdSeatServer, traModOrderBll, interFaceOrderServerBll, orderOperateServerBll, requestCancelServer); return(domain); }
public override async Task RunAsync() { var assemblyFilename = Path.Combine(BinDirectory, AssemblyFilename); if (!File.Exists(assemblyFilename)) { throw new FileNotFoundException($"The assembly file '{assemblyFilename}' could not be found!"); } Domain = new ServerDomain(); Domain.Initialize(assemblyFilename); var context = new ServerDeployContext { DeploymentNumber = DeploymentNumber, Project = Project, Agents = PhotonServer.Instance.Agents.All.ToArray(), ProjectPackageId = ProjectPackageId, ProjectPackageVersion = ProjectPackageVersion, EnvironmentName = EnvironmentName, ScriptName = ScriptName, WorkDirectory = WorkDirectory, BinDirectory = BinDirectory, ContentDirectory = ContentDirectory, Packages = PackageClient, ConnectionFactory = ConnectionFactory, Output = Output, ServerVariables = Variables, }; await Domain.RunDeployScript(context, TokenSource.Token); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中OrderSubmitServerBLLFactoty IOrderCancelServerBLLFactory factory = new OrderCancelServerBLLFactory(); IOrderCancelServerBLL <TraOrderCancelResponseModel> OrderSubmitServer = factory.CreateSampleBllObj(); ITraInterFaceOrderServerBLLFactory factory2 = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrder = factory2.CreateBllObj(); ITraOrderOperateServerBLLFactory factory3 = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperate = factory3.CreateBllObj(); ITraOrderBLLFactory orderFac = new TraOrderBLLFactory(); ITraOrderBLL <TraOrderModel> orderBll = orderFac.CreateBllObj(); ITraOrderStatusBLLFactory traOrderStatusBllFactory = new TraOrderStatusBLLFactory(); ITraOrderStatusBLL <TraOrderStatusModel> orderStatusBll = traOrderStatusBllFactory.CreateBllObj(); IServerDomain domain = new ServerDomain(OrderSubmitServer, interFaceOrder, orderOperate, orderBll, orderStatusBll); return(domain); }
public override async Task RunAsync() { var assemblyFilename = Path.Combine(BinDirectory, AssemblyFilename); if (!File.Exists(assemblyFilename)) { throw new FileNotFoundException($"The assembly file '{assemblyFilename}' could not be found!"); } Domain = new ServerDomain(); Domain.Initialize(assemblyFilename); using (var contextOutput = new DomainOutput()) { contextOutput.OnWrite += (text, color) => Output.Write(text, color); contextOutput.OnWriteLine += (text, color) => Output.WriteLine(text, color); contextOutput.OnWriteRaw += (text) => Output.WriteRaw(text); var context = new ServerDeployContext { DeploymentNumber = Deployment.Number, Project = Project, Agents = PhotonServer.Instance.Agents.All.ToArray(), ProjectPackageId = ProjectPackageId, ProjectPackageVersion = ProjectPackageVersion, EnvironmentName = EnvironmentName, ScriptName = ScriptName, WorkDirectory = WorkDirectory, BinDirectory = BinDirectory, ContentDirectory = ContentDirectory, Packages = PackageClient, ConnectionFactory = ConnectionFactory, Output = contextOutput, ServerVariables = Variables, }; try { await Domain.RunDeployScript(context, TokenSource.Token); Deployment.IsSuccess = true; } catch (OperationCanceledException) { Deployment.IsCancelled = true; throw; } catch (Exception error) { Deployment.Exception = error.UnfoldMessages(); throw; } finally { Deployment.IsComplete = true; Deployment.Duration = DateTime.UtcNow - Deployment.Created; //Deployment.ApplicationPackages = ?; Deployment.Save(); await Deployment.SetOutput(Output.GetString()); // TODO: Save alternate version with ansi characters removed } } }
public IServerDomain CreateQueryTraInterFaceOrderStatusObj() { ITraInterFaceOrderServerBLLFactory traInterFaceOrderServerBllFactory = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrder = traInterFaceOrderServerBllFactory.CreateBllObj(); IServerDomain domain = new ServerDomain(interFaceOrder); return(domain); }
public string GetSort(ServerDomain s) { if (s != null) { return(s.domainName); } return(string.Empty); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中 IQueryTrainServerBLLFactory factory = new QueryTrainServerBLLFactory(); IQueryTrainServerBLL <List <TraTravelInfoModel> > queryTrainServer = factory.CreateSampleBllObj(); IServerDomain domain = new ServerDomain(queryTrainServer); return(domain); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中 ITrainInfoServerBLLFactory factory = new TrainInfoServerBLLFactory(); ITrainInfoServerBLL <List <TraTrainInfoResponseDateDetailModel> > trainInfoServer = factory.CreateSampleBllObj(); IServerDomain domain = new ServerDomain(trainInfoServer); return(domain); }
protected ServerDomainData ToServerDomainData(ServerDomain domain, ServerDomainDnsData dns) { var serverDomain = new ServerDomainData { Id = domain.Id, Name = domain.Name, Dns = dns, IsSharedDomain = domain.Tenant == Defines.SHARED_TENANT_ID }; return(serverDomain); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中 IPrintTicketServerBLLFactory factory = new PrintTicketServerBLLFactory(); IPrintTicketServerBLL <TraPrintTicketCallBackLogModel> printTicketServer = factory.CreateBllObj(); ITraInterFaceOrderServerBLLFactory factory2 = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrder = factory2.CreateBllObj(); ITraOrderOperateServerBLLFactory factory3 = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperate = factory3.CreateBllObj(); IServerDomain domain = new ServerDomain(printTicketServer, interFaceOrder, orderOperate); return(domain); }
protected ServerDomain ToServerDomain(object[] r) { var d = new ServerDomain { Id = Convert.ToInt32(r[0]), Tenant = Convert.ToInt32(r[1]), Name = Convert.ToString(r[2]), IsVerified = Convert.ToBoolean(r[3]), DateAdded = Convert.ToDateTime(r[4]), DateChecked = Convert.ToDateTime(r[5]) }; return(d); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中OrderSubmitServerBLLFactoty IOrderSubmitServerBLLFactoty orderSubmitServerBllFactoty = new OrderSubmitServerBLLFactoty(); IOrderSubmitServerBLL <TraOrderSubmitResponseModel> orderSubmitServer = orderSubmitServerBllFactoty.CreateSampleBllObj(); ITraInterFaceOrderServerBLLFactory traInterFaceOrderServerBllFactory = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrder = traInterFaceOrderServerBllFactory.CreateBllObj(); ITraOrderOperateServerBLLFactory traOrderOperateServerBllFactory = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperate = traOrderOperateServerBllFactory.CreateBllObj(); IServerDomain domain = new ServerDomain(orderSubmitServer, interFaceOrder, orderOperate); return(domain); }
public int Save(ServerDomain domain) { var query = new SqlInsert(ServerDomainTable.TABLE_NAME) .InColumnValue(ServerDomainTable.Columns.Id, domain.Id) .InColumnValue(ServerDomainTable.Columns.DomainName, domain.Name) .InColumnValue(ServerDomainTable.Columns.Tenant, Tenant) .InColumnValue(ServerDomainTable.Columns.IsVerified, domain.IsVerified) .Identity(0, 0, true); if (domain.Id <= 0) { query.InColumnValue(ServerDomainTable.Columns.DateAdded, DateTime.UtcNow); } var id = Db.ExecuteScalar <int>(query); return(id); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中 IRequestChangeServerBLLFactory holdSeatServerBllFactory = new RequestChangeServerBLLFactory(); IRequestChangeServerBLL <TraRequestChangeResponseModel> holdSeatServer = holdSeatServerBllFactory.CreateSampleBllObj(); ITraInterFaceOrderServerBLLFactory traInterFaceOrderServerBllFactory = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrder = traInterFaceOrderServerBllFactory.CreateBllObj(); ITraOrderOperateServerBLLFactory traOrderOperateServerBllFactory = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperate = traOrderOperateServerBllFactory.CreateBllObj(); IServerDomain domain = new ServerDomain(holdSeatServer, interFaceOrder, orderOperate); return(domain); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中OrderSubmitServerBLLFactoty IOrderConfirmServerBLLFactoty factory = new OrderConfirmServerBLLFactoty(); IOrderConfirmServerBLL <TraOrderConfirmResponseModel> OrderSubmitServer = factory.CreateSampleBllObj(); ITraInterFaceOrderServerBLLFactory factory2 = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrder = factory2.CreateBllObj(); ITraOrderOperateServerBLLFactory factory3 = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperate = factory3.CreateBllObj(); IServerDomain domain = new ServerDomain(OrderSubmitServer, interFaceOrder, orderOperate); return(domain); }
public EntityListResult<Server> FindAll() { ServerDomain serverDomain = new ServerDomain(1, ATSCommon.Enums.LanguagesEnum.Arabic); EntityListResult<Server> entityListResult = new EntityListResult<Server>(); try { entityListResult.ReturnedEntities = serverDomain.FindAll(); if (serverDomain.ActionState.Status != ATSCommon.Enums.ActionStatusEnum.NoError) { entityListResult.Message = serverDomain.ActionState.Result; } } catch (Exception ex) { entityListResult.Message = ex.Message; } return entityListResult; }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中 IHoldSeatServerBLLFactory holdSeatServerBllFactory = new HoldSeatServerBLLFactory(); IHoldSeatServerBLL <TraHoldSeatCallBackLogModel> holdSeatServer = holdSeatServerBllFactory.CreateBllObj(); ITraInterFaceOrderServerBLLFactory traInterFaceOrderServerBllFactory = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrder = traInterFaceOrderServerBllFactory.CreateBllObj(); ITraOrderOperateServerBLLFactory traOrderOperateServerBllFactory = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperate = traOrderOperateServerBllFactory.CreateBllObj(); IServerDomain domain = new ServerDomain(holdSeatServer, interFaceOrder, orderOperate); return(domain); }
private ServerDomainDnsData UpdateDnsStatus(ServerDomain domain, IServerDnsDao serverDnsDao, IServerDomainDao serverDomainDao, bool force = false) { var serverDns = serverDnsDao.Get(domain.Id); if (serverDns.UpdateRecords(domain.Name, force)) { serverDnsDao.Save(serverDns); } var dnsData = ToServerDomainDnsData(serverDns); if (dnsData != null && domain.IsVerified != dnsData.IsVerified) { serverDomainDao.SetVerified(domain.Id, dnsData.IsVerified); } return(dnsData); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中 IRefundTicketServerBLLFactory factory = new RefundTicketServerBLLFactory(); IRefundTicketServerBLL <TraRefundTicketCallBackLogModel> holdSeatServer = factory.CreateBllObj(); ITraInterFaceOrderServerBLLFactory factory2 = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrderServerBll = factory2.CreateBllObj(); ITraOrderOperateServerBLLFactory factory3 = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperateServerBll = factory3.CreateBllObj(); ITraOrderBLLFactory traOrderBllFactory = new TraOrderBLLFactory(); ITraOrderBLL <TraOrderModel> orderBll = traOrderBllFactory.CreateBllObj(); IServerDomain domain = new ServerDomain(holdSeatServer, interFaceOrderServerBll, orderOperateServerBll, orderBll); return(domain); }
public IServerDomain CreateDomainObj() { //业务(占位)单元工厂,创建业务单元,通过构造注入到Domain中 IModPrintTicketServerBLLFactory factory = new ModPrintTicketServerBLLFactory(); IModPrintTicketServerBLL <TraModPrintTicketCallBackLogModel> modPrintTicketServer = factory.CreateBllObj(); ITraInterFaceOrderServerBLLFactory traInterFaceOrderServerBllFactory = new TraInterFaceOrderServerBLLFactory(); ITraInterFaceOrderServerBLL <TraInterFaceOrderModel> interFaceOrderServerBll = traInterFaceOrderServerBllFactory.CreateBllObj(); ITraOrderOperateServerBLLFactory traOrderOperateServerBllFactory = new TraOrderOperateServerBLLFactory(); ITraOrderOperateServerBLL <TraOrderOperateModel> orderOperateServerBll = traOrderOperateServerBllFactory.CreateBllObj(); ITraOrderBLLFactory orderBllFactory = new TraOrderBLLFactory(); ITraOrderBLL <TraOrderModel> orderBll = orderBllFactory.CreateBllObj(); IServerDomain domain = new ServerDomain(modPrintTicketServer, interFaceOrderServerBll, orderOperateServerBll, orderBll); return(domain); }
public EntityResult<Server> Delete(Server entity) { EntityResult<Server> entityResult = new EntityResult<Server>(); ServerDomain serverDomain = new ServerDomain(1, ATSCommon.Enums.LanguagesEnum.Arabic); try { serverDomain.Delete(entity); entityResult.ReturnedEntity = entity; if (serverDomain.ActionState.Status != ATSCommon.Enums.ActionStatusEnum.NoError) { entityResult.Message = serverDomain.ActionState.Result; } } catch (Exception ex) { entityResult.Message = ex.Message; } return entityResult; }
public ServerDomainData AddDomain(string domain, int dnsId) { if (!IsAdmin) { throw new SecurityException("Need admin privileges."); } if (string.IsNullOrEmpty(domain)) { throw new ArgumentException(@"Invalid domain name.", "domain"); } if (domain.Length > 255) { throw new ArgumentException(@"Domain name exceed limitation of 255 characters.", "domain"); } if (!Parser.IsDomainValid(domain)) { throw new ArgumentException(@"Incorrect domain name.", "domain"); } var domainName = domain.ToLowerInvariant(); var engine = new EngineFactory(Tenant, User); var dnsLookup = new DnsLookup(); using (var daoFactory = new DaoFactory()) { var serverDao = daoFactory.CreateServerDao(); var server = serverDao.Get(Tenant); var freeDns = engine.ServerEngine.GetOrCreateUnusedDnsData(daoFactory, server); if (freeDns.Id != dnsId) { throw new InvalidDataException("This dkim public key is already in use. Please reopen wizard again."); } if (!CoreContext.Configuration.Standalone && !dnsLookup.IsDomainTxtRecordExists(domainName, freeDns.DomainCheckRecord.Value)) { throw new InvalidOperationException("txt record is not correct."); } var isVerified = freeDns.CheckDnsStatus(domainName); using (var tx = daoFactory.DbManager.BeginTransaction(IsolationLevel.ReadUncommitted)) { var serverDomainDao = daoFactory.CreateServerDomainDao(Tenant); var utcNow = DateTime.UtcNow; var mailServerEngine = new Server.Core.ServerEngine(server.Id, server.ConnectionString); var mailServerDomain = new Server.Core.Entities.Domain { Name = domainName, Active = true, Description = string.Format("Domain created in UtcTime: {0}, for tenant: {1}", utcNow, Tenant), Created = utcNow, Modified = utcNow }; mailServerEngine.SaveDomain(mailServerDomain); var serverDomain = new ServerDomain { Id = 0, Tenant = Tenant, Name = domainName, IsVerified = isVerified, DateAdded = utcNow, DateChecked = utcNow }; serverDomain.Id = serverDomainDao.Save(serverDomain); var serverDnsDao = daoFactory.CreateServerDnsDao(Tenant, User); var serverDns = serverDnsDao.GetById(freeDns.Id); var mailServerDkim = new Server.Core.Entities.Dkim { DomainName = domainName, Selector = serverDns.DkimSelector, PrivateKey = serverDns.DkimPrivateKey, PublicKey = serverDns.DkimPublicKey }; mailServerEngine.SaveDkim(mailServerDkim); serverDns.DomainId = serverDomain.Id; serverDns.TimeModified = utcNow; serverDnsDao.Save(serverDns); tx.Commit(); return(ToServerDomainData(serverDomain, freeDns)); } } }
public static ServerDomainAddressData ToServerDomainAddressData(ServerAddress address, ServerDomain domain) { var result = new ServerDomainAddressData { Id = address.Id, DomainId = address.DomainId, Email = string.Format("{0}@{1}", address.AddressName, domain.Name) }; return(result); }
/// <summary> /// Returns a uri from the used server domain and protocol without trailing slash. /// </summary> /// <returns></returns> public Uri GetUri() { return(new Uri(Protocol + "://" + ServerDomain.Trim('/'), UriKind.Absolute)); }
/// <summary> /// Returns a uri from the used server /// </summary> /// <returns></returns> public Uri GetUri(string path) { return(new Uri(Protocol + "://" + ServerDomain.Trim('/') + "/" + path.Trim('/'), UriKind.Absolute)); }
public async void SetDomainDetails(ServerDomain domain) { following = false; subscribed = false; followButton.IsVisible = false; followButton.BackgroundColor = Color.FromHex("#31c3ee"); currentDomain = domain; if (currentDomain.domainDonation != null) { if (currentDomain.domainDonation == "Yes") { donateDomainButton.IsVisible = true; } } if (!string.IsNullOrEmpty(currentDomain.domainLogo)) { domainLogo.IsVisible = true; domainLogo.Source = currentDomain.domainLogo; //logoGrid.BackgroundColor = Color.Transparent; Regex initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?"); string init = initials.Replace(domain.domainName, "$1"); if (init.Length > 3) { init = init.Substring(0, 3); } logoText.Text = init.ToUpper(); } else { domainLogo.IsVisible = false; //logoGrid.BackgroundColor = Color.FromHex("#31c3ee"); Regex initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?"); string init = initials.Replace(domain.domainName, "$1"); if (init.Length > 3) { init = init.Substring(0, 3); } logoText.Text = init.ToUpper(); } if (!string.IsNullOrEmpty(currentDomain.domainAddress)) { domainAddress.Text = currentDomain.domainAddress; } else { domainAddress.IsVisible = false; } domainName.Text = currentDomain.domainName; domainDescription.Text = currentDomain.domainDescription; if (currentDomain.domainType == "Public") { domainType.Text = "Open Domain"; } else if (currentDomain.domainType == "Private") { domainType.Text = "Private Domain"; } else { domainType.Text = "Subscription ( " + currentDomain.domainSubscriptionType + " Payment )"; } if (currentDomain.domainType != "Subscription") { if (App.serverData.mei_user.registeredDomainList.Where(x => x.firmID == currentDomain.firmID).ToList().Count > 0) { following = true; followButton.Text = "UnFollow"; followButton.BackgroundColor = Color.FromHex("#ff3232"); followButton.IsVisible = true; } if (!following) { if (currentDomain.domainType == "Private") { followButton.Text = "Request for Access"; followButton.IsVisible = true; } else { followButton.Text = "Follow Domain"; followButton.IsVisible = true; } } if (App.serverData.mei_user.userRequestedDomainList.Contains(currentDomain.firmID)) { followButton.Text = "Cancel Request"; followButton.BackgroundColor = Color.FromHex("#ff3232"); followButton.IsVisible = true; } } else { subscription = App.serverData.mei_user.userSubscriptionList.Find(x => x.planID == currentDomain.subscriptionPlanID); if (subscription != null) { following = true; subscribed = true; string subStatus = await App.serverData.GetSubscriptionStatus(subscription.subscriptionID, "sub_status"); if (subStatus == "Canceled") { followButton.IsEnabled = false; followButton.Text = "Subscription canceled"; followButton.BackgroundColor = Color.FromHex("#ff3232"); followButton.IsVisible = true; } else { followButton.IsEnabled = true; followButton.BackgroundColor = Color.FromHex("#ff3232"); followButton.Text = "Cancel Subscription"; followButton.IsVisible = true; } } else { following = false; followButton.Text = "Subscribe"; followButton.IsVisible = true; } if (App.serverData.mei_user.userRequestedDomainList.Where(x => x == currentDomain.firmID).ToList().Count > 0) { following = true; followButton.Text = "UnFollow"; followButton.BackgroundColor = Color.FromHex("#ff3232"); followButton.IsVisible = true; } } }
public void SetEventUpdate(ServerEventPost post, EventUpdateTemplate parentViewCell) { double height = 150; postList.IsVisible = false; postList.Children.Clear(); postHeader.Text = ""; postInfo.Text = ""; eventPost.Text = ""; postImage.Source = ""; postTime.Text = ""; domainLogo.Source = ""; clickURL = ""; votedOption = -1; currentPost = post; loading.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading"); loading.BindingContext = postImage; if (post != null) { postImage.IsVisible = true; ServerDomain currentDomain = ((HomeLayout)App.Current.MainPage).notificationDomain; postHeader.Text = currentDomain.domainName; if (!string.IsNullOrEmpty(currentDomain.domainLogo)) { domainLogo.IsVisible = true; domainLogo.Source = currentDomain.domainLogo; //logoGrid.BackgroundColor = Color.Transparent; Regex initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?"); string init = initials.Replace(currentDomain.domainName, "$1"); if (init.Length > 3) { init = init.Substring(0, 3); } logoText.Text = init.ToUpper(); } else { domainLogo.IsVisible = false; //logoGrid.BackgroundColor = Color.FromHex("#31c3ee"); Regex initials = new Regex(@"(\b[a-zA-Z])[a-zA-Z]* ?"); string init = initials.Replace(currentDomain.domainName, "$1"); if (init.Length > 3) { init = init.Substring(0, 3); } logoText.Text = init.ToUpper(); } postInfo.Text = "Admin"; eventPost.Text = post.postMessage.Trim(); if (Device.RuntimePlatform == Device.iOS) { height += (double)(eventPost.Text.ToString().Split("<br>"[0]).Count() * 20); } postTime.Text = post.time.Trim(); if (!string.IsNullOrEmpty(post.postPicture)) { if (post.postPicture.ToString().Contains("png") || post.postPicture.ToString().Contains("jpg") || post.postPicture.ToString().Contains("jpeg")) { postImageLayout.IsVisible = true; height = height + 200; postImage.Source = new UriImageSource { Uri = new Uri(post.postPicture), CachingEnabled = false }; clickURL = post.postPicture; } else { clickURL = ""; postImageLayout.IsVisible = false; eventPost.Text = eventPost.Text + "<br><a href='" + post.postPicture + "'>Attachment<a>"; height = height + 50; } } else { clickURL = ""; postImageLayout.IsVisible = false; } CheckLike(); if (post.postType == "Voting" && post.voteOptions.Count > 1) { postList.IsVisible = true; for (int i = 0; i < post.voteOptions.Count; i++) { if (post.voteOptions[i].votedUsers.Contains(App.userID)) { votedOption = i; postList.Children.Add(CreateButton(post.voteOptions[i].voteOption, true)); } else { postList.Children.Add(CreateButton(post.voteOptions[i].voteOption, false)); } height = height + 60; } } else { postList.IsVisible = false; } } if (Device.RuntimePlatform == Device.iOS) { //this.HeightRequest = height + 30; //parentViewCell.SetViewHeight(this, null); } }