private static TheFOR SetTSO(TheFOR tso, TheFOR Ttso, bool SetID = false) { if (Ttso != null) { if (tso == null) { tso = Ttso; } else { if (SetID) { tso.ID = Ttso.ID; } if (Ttso.TileWidth > 0) { tso.TileWidth = Ttso.TileWidth; } if (tso.Flds == null) { tso.Flds = Ttso.Flds; } else { tso.Flds.AddRange(Ttso.Flds); } } } return(tso); }
internal static TheFOR GetScreenOptions(Guid FormId, TheClientInfo pClientInfo, TheFormInfo pInfo) { TheFOR tso = null; if (pInfo != null && !string.IsNullOrEmpty(pInfo.ModelID)) { var tMods = pInfo.ModelID.Split(';'); foreach (string tM in tMods) { string tPlS1 = TheCommonUtils.LoadStringFromDisk($"FormORs\\{tM}.cdeFOR", null); if (!string.IsNullOrEmpty(tPlS1)) { TheFOR Ttso = TheCommonUtils.DeserializeJSONStringToObject <TheFOR>(tPlS1); tso = SetTSO(tso, Ttso); if (!string.IsNullOrEmpty(Ttso?.StartGroup)) { pInfo.PropertyBag = new ThePropertyBag { $"StartGroup={Ttso.StartGroup}" } } ; } } } string tPlS = TheCommonUtils.LoadStringFromDisk($"{pClientInfo.UserID}\\{FormId}.cdeFOR", null); if (!string.IsNullOrEmpty(tPlS)) { TheFOR Ttso = TheCommonUtils.DeserializeJSONStringToObject <TheFOR>(tPlS); tso = SetTSO(tso, Ttso, true); if (pInfo != null && !string.IsNullOrEmpty(Ttso?.StartGroup)) { pInfo.PropertyBag = new ThePropertyBag { $"StartGroup={Ttso.StartGroup}" } } ; } return(tso); }
internal static List <TheFieldInfo> GetPermittedFields(Guid FormId, TheClientInfo pClientInfo, TheFOR tso, bool UpdateSubs) { List <TheFieldInfo> tReturnLst = new List <TheFieldInfo>(); try { Func <TheFieldInfo, bool> pSelector = (s => TheUserManager.HasUserAccess(pClientInfo.UserID, s.cdeA) && ((s.Flags & 4) == 0 || !pClientInfo.IsMobile) && ((s.Flags & 128) == 0 || pClientInfo.IsFirstNode || pClientInfo.IsUserTrusted)); //NEW3.105: Only Show from First node is set IEnumerable <TheFieldInfo> FormFields = TheNMIEngine.GetFieldsByFunc(s => s.FormID == FormId).Where(pSelector).OrderBy(s => s.FldOrder); //NMI-REDO: this is the main bottleneck Function if (FormFields != null) { foreach (var tField in FormFields) { if (CheckHidePersmission(tField.PlatBag, pClientInfo)) { TheFieldInfo tFld = tField.Clone(); if (tFld.PlatBag.ContainsKey(eWebPlatform.Any)) { tFld.PropertyBag.MergeBag(tFld.PlatBag[eWebPlatform.Any], true, false); } if (tFld.PlatBag.ContainsKey(pClientInfo.WebPlatform)) { tFld.PropertyBag.MergeBag(tFld.PlatBag[pClientInfo.WebPlatform], true, false); } bool DeleteFld = false; if (tso != null) { var tfo = tso.Flds.Where(s => s.FldOrder == tFld.FldOrder); if (tfo != null && tfo.Count() > 0) { foreach (TheFLDOR tF in tfo) { if (tF.PO != null) { tFld.PropertyBag = tF.PO; } if (tF.NewFldOrder > 0) { tFld.FldOrder = tF.NewFldOrder; } else if (tF.NewFldOrder < 0) { DeleteFld = true; } } } } if (!DeleteFld) { tReturnLst.Add(tFld); //NEW in 4.1: All subscriptiosn here if (UpdateSubs) { var tThing = RegisterNMISubscription(pClientInfo, tFld.DataItem, tFld); if (tThing != null && (tFld.Type == eFieldType.FacePlate || tFld.Type == eFieldType.TileButton)) { var tsuc = TheNMIEngine.ParseFacePlateUrlInternal(tThing, ThePropertyBag.PropBagGetValue(tFld.PropertyBag, "HTMLUrl", "="), false, pClientInfo.NodeID); if (!tsuc) { TheNMIEngine.ParseFacePlateInternal(tThing, ThePropertyBag.PropBagGetValue(tFld.PropertyBag, "HTML", "="), pClientInfo.NodeID); } } } } } } } } catch (Exception e) { TheBaseAssets.MySYSLOG.WriteToLog(777, new TSM(eEngineName.NMIService, "Get Permitted fields failed", eMsgLevel.l1_Error, e.ToString())); } return(tReturnLst); }