private bool SendRequestUpdate(Authentication value, string content, BaseRoot baseRoot, Func <string, object, bool> getResponse) { string url = value.UrlService; string urlFormat = string.Format("{0}xml/{1}/{2}?authtoken={3}&scope={4}&newFormat=1&id={5}&xmlData={6}", url, GetEntityName(), "updateRecords", value.Token, value.User, baseRoot.GetId(), content); return(HttpMessageSender.SendRequestPost(urlFormat, content, baseRoot, getResponse)); }
protected override void SetId(string id, BaseRoot value) { if (!value.MappingFields.Exists(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("CONTACTID"))) { value.MappingFields.Add(new MappingFields { Entity = "Event", Field = "CONTACTID", Value = id }); } if (!value.MappingFields.Exists(e => ZohoAccount.Filter(e.Entity) && e.Field.Equals("CONTACTID"))) { value.MappingFields.Add(new MappingFields { Entity = "Account", Field = "CONTACTID", Value = id }); } if (!value.MappingFields.Exists(e => ZohoPotential.Filter(e.Entity) && e.Field.Equals("CONTACTID"))) { value.MappingFields.Add(new MappingFields { Entity = "Potential", Field = "CONTACTID", Value = id }); } if (!value.MappingFields.Exists(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("Participants"))) { value.MappingFields.Add(new MappingFields { Entity = "Event", Field = "Participants", Value = "<Participant><FL val=\"CONTACTID\">{0}</FL></Participant>" }); } SetParticipants(id, value); }
void ISeaTruckArmHandler.SetRotation(SeaTruckArm arm, bool isDocked) { if (isDocked) { BaseRoot baseRoot = TruckHelper.MainCab.GetComponentInParent <BaseRoot>(); if (baseRoot.isBase) { if (arm == SeaTruckArm.Right) { transform.localRotation = Quaternion.Euler(20, 6, 0); } else { transform.localRotation = Quaternion.Euler(20, 354, 0); } } } else { if (arm == SeaTruckArm.Right) { transform.localRotation = Quaternion.Euler(0, 0, 0); } else { transform.localRotation = Quaternion.Euler(0, 0, 0); } } }
protected bool SendRequestGetRecord(BaseRoot value, string entityName, string id, Func <string, object, bool> loadResponse) { string url = value.Authentication.UrlService; string urlFormat = string.Format("{0}json/{1}/{2}?authtoken={3}&scope={4}&id={5}", url, entityName, "getRecordById", value.Authentication.Token, value.Authentication.User, id); return(HttpMessageSender.SendRequestGet(urlFormat, value, loadResponse)); }
private bool Execute(BaseRoot value, Func <IHubIntegration, BaseRoot, bool> function) { string msg = string.Format("Execute CRM:{0} ", value.Authentication.Crm); _logger.LogDebug(msg); AddUrl(value.Authentication); return(function(_crmIntegration, value)); }
protected bool SendRequestSearch(BaseRoot value, string entityName, string selectColumn, string searchColumn, string searchValue, Func <string, object, bool> getResponse) { string url = value.Authentication.UrlService; string urlFormat = string.Format("{0}json/{1}/{2}?authtoken={3}&scope={4}&selectColumns={5}({6})&searchColumn={7}&searchValue={8}", url, entityName, "getSearchRecordsByPDC", value.Authentication.Token, value.Authentication.User, entityName, selectColumn, searchColumn.ToLower(), searchValue); return(HttpMessageSender.SendRequestGet(urlFormat, value, getResponse)); }
private void SetParticipants(string id, BaseRoot value) { if (value.MappingFields.Where(w => w.Entity.Equals("Event") && w.Field.Equals("Participants")).First().Value.IndexOf(id) <= 0) { value.MappingFields.Where(w => w.Entity.Equals("Event") && w.Field.Equals("Participants")).First().Value = value.MappingFields.Where(w => w.Entity.Equals("Event") && w.Field.Equals("Participants")).First().Value.Replace("{0}", id + ",{0}"); } }
protected bool SendRequestGetUser(BaseRoot value, Func <string, object, bool> loadResponse) { string url = value.Authentication.UrlService; string urlFormat = string.Format("{0}json/{1}/{2}?authtoken={3}&scope={4}&type={5}", url, "Users", "getUsers", value.Authentication.Token, value.Authentication.User, "ActiveUsers"); return(HttpMessageSender.SendRequestGet(urlFormat, value, loadResponse)); }
public bool LeadGetFields(Autenticacao value) { var _value = new BaseRoot() { Authentication = Mapper.Map <Authentication>(value) }; return(Execute(_value, (c, v) => c.LeadGetFields(_value))); }
protected bool SendRequestSave(BaseRoot value, List <MappingFields> mapping, Func <string, object, bool> getReponse) { string content = LoadXml(GetEntityName(), mapping); if (string.IsNullOrEmpty(value.GetId())) { return(SendRequestInsert(value.Authentication, content, value, getReponse)); } return(SendRequestUpdate(value.Authentication, content, value, getReponse)); }
private string LoadId(string value, BaseRoot baseRoot, Action <string, BaseRoot> setId) { if (value.IndexOf("<FL val=\"Id\">") > 0) { string id = value.Substring(value.IndexOf("<FL val=\"Id\">") + 13, 19); setId(id, baseRoot); return(id); } return(string.Empty); }
protected string GetFieldValue(BaseRoot value, string field, Func <string, bool> filter) { var mapping = value.MappingFields.Where(v => filter(v.Entity)).ToList(); if (mapping.Exists(x => x.Field == field)) { var fieldValue = mapping.Where(x => x.Field == field).FirstOrDefault(); return(fieldValue.Value); } return(string.Empty); }
protected override void SetId(string id, BaseRoot value) { if (!value.MappingFields.Exists(e => e.Entity.Equals("Event") && e.Field.Equals("SEMODULE"))) { value.MappingFields.Add(new MappingFields { Entity = "Event", Field = "SEID", Value = id }); value.MappingFields.Add(new MappingFields { Entity = "Event", Field = "SEMODULE", Value = "Potentials" }); } }
private bool IsSwimming(Vector3 playerPosition, Optional <NitroxId> subId) { if (subId.HasValue) { Optional <GameObject> sub = NitroxEntity.GetObjectFrom(subId.Value); SubRoot subroot = null; sub.Value.TryGetComponent <SubRoot>(out subroot); // Set the animation for the remote player to standing instead of swimming if player is not in a flooded subroot // or in a waterpark if (subroot) { if (subroot.IsUnderwater(playerPosition)) { return(true); } if (subroot.isCyclops) { return(false); } // We know that we are in a subroot. But we can also be in a waterpark in a subroot, where we would swim BaseRoot baseRoot = subroot.GetComponentInParent <BaseRoot>(); if (baseRoot) { WaterPark[] waterParks = baseRoot.GetComponentsInChildren <WaterPark>(); foreach (WaterPark waterPark in waterParks) { if (waterPark.IsPointInside(playerPosition)) { return(true); } } return(false); } } Log.Debug($"Trying to find escape pod for {subId}."); EscapePod escapePod = null; sub.Value.TryGetComponent <EscapePod>(out escapePod); if (escapePod) { Log.Debug("Found escape pod for player. Will add him and update animation."); return(false); } } // Player can be above ocean level. float oceanLevel = Ocean.main.GetOceanLevel(); return(playerPosition.y < oceanLevel); }
public virtual bool Execute(BaseRoot value) { if (!value.MappingFields.Exists(e => e.Entity.Equals(GetEntityName()) && e.Field.Equals("SMOWNERID"))) { if (SendRequestGetUser(value, LoadResponseUser)) { return(true); } } else { return(true); } return(false); }
protected override void SetId(string id, BaseRoot value) { if (!value.MappingFields.Exists(e => ZohoEvent.Filter(e.Entity) && e.Field.Equals("ACCOUNTID"))) { value.MappingFields.Add(new MappingFields { Entity = ZohoEvent.ENTITY, Field = "ACCOUNTID", Value = id }); } if (!value.MappingFields.Exists(e => ZohoPotential.Filter(e.Entity) && e.Field.Equals("ACCOUNTID"))) { value.MappingFields.Add(new MappingFields { Entity = ZohoPotential.ENTITY, Field = "ACCOUNTID", Value = id }); } }
protected virtual bool OnLoadReponseUser(User user, object value) { BaseRoot baseRoot = (BaseRoot)value; try { Predicate <MappingFields> filter = v => v.Entity.Equals(GetEntity()) && v.Field.Equals("SMOWNERID"); if (!baseRoot.MappingFields.Exists(e => filter(e))) { baseRoot.MappingFields.Add(new MappingFields { Entity = GetEntity(), Field = "SMOWNERID", Value = user.id }); } return(true); } catch { return(false); } }
public static float GetDistanceToPlayer(this BaseRoot baseRoot) { Int3 u = baseRoot.baseComp.WorldToGrid(Player.main.transform.position); int num = int.MaxValue; Int3 @int = new Int3(int.MaxValue); foreach (Int3 int2 in baseRoot.baseComp.AllCells) { int num2 = (u - int2).SquareMagnitude(); if (num2 < num) { @int = int2; num = num2; } } baseRoot.baseComp.GridToWorld(@int, UWE.Utils.half3, out var vector); return((Player.main.transform.position - vector).magnitude); }
protected override bool OnLoadReponseUser(User user, object value) { BaseRoot baseRoot = (BaseRoot)value; if (base.OnLoadReponseUser(user, value)) { Func <string, int, MappingFields> mapping = (e, id) => new MappingFields { Entity = e, Field = "SMOWNERID", Value = user.id, Id = id }; baseRoot.MappingFields.Add(mapping(ZohoPotential.ENTITY, 0)); baseRoot.MappingFields.Add(mapping(ZohoEvent.ENTITY, 0)); int index = 0; if (value.GetType() == typeof(ScheduleRoot)) { ((ScheduleRoot)baseRoot).Contacts.ForEach(f => { baseRoot.MappingFields.Add(mapping(ZohoContact.ENTITY, index++)); }); } return(true); } return(false); }
private bool LoadResponseUser(string response, object value) { if (response.Contains("{\"error\"")) { return(ErrorResponse(response, "Error Load Response Fields")); } BaseRoot valueRoot = (BaseRoot)value; try { RootUser rootUser = JsonConvert.DeserializeObject <RootUser>(response); if (rootUser.users != null) { Predicate <User> filter = s => s.email.Equals(valueRoot.Authentication.Email); if (rootUser.users.user.Exists(e => filter(e))) { User user = rootUser.users.user.Where(w => filter(w)).First(); return(OnLoadReponseUser(user, value)); } } } catch (JsonSerializationException) { } try { RootUserSimple userSimple = JsonConvert.DeserializeObject <RootUserSimple>(response); if (userSimple.users != null) { User user = userSimple.users.user; if (user.email.Equals(valueRoot.Authentication.Email)) { return(OnLoadReponseUser(userSimple.users.user, value)); } } } catch (JsonSerializationException) { } return(false); }
protected bool SendRequestGetRecord(BaseRoot value, string id, Func <string, object, bool> loadResponse) { return(SendRequestGetRecord(value, GetEntityName(), id, loadResponse)); }
private bool Execute(BaseRoot value, Func <BaseIntegration, BaseRoot, bool> function) { return(Exec(value.Authentication.Crm, (c) => function(c, value))); }
public bool AccountGetFields(BaseRoot value) => Execute(value, (c, v) => c.AccountGetFields(v));
public bool EventGetFields(BaseRoot value) => Execute(value, (c, v) => c.EventGetFields(v));
public bool ContactGetFields(BaseRoot value) => Execute(value, (c, v) => c.ContactGetFields(v));
public bool LeadGetFields(BaseRoot value) => Execute(value, (c, v) => c.LeadGetFields(v));
protected override void SetId(string id, BaseRoot value) { }
protected bool SendRequestSearch(BaseRoot value, string selectColumn, string searchColumn, string searchValue, Func <string, object, bool> getResponse) { return(SendRequestSearch(value, GetEntityName(), selectColumn, searchColumn, searchValue, getResponse)); }
protected abstract void SetId(string id, BaseRoot value);
public bool AccountGetFields(BaseRoot value) => OnGetFieldsAccount(value.Authentication);