Esempio n. 1
0
        private void SetCtrlType()
        {
            if (CountBar == null)
            {
                return;
            }
            string     tControl  = ThePropertyBag.PropBagGetValue(CountBar.PropertyBag, "ControlType", "=");
            eFieldType tCtrlType = eFieldType.SingleEnded;

            if (!string.IsNullOrEmpty(tControl) && TheCommonUtils.CInt(tControl) == 0 && tControl.Length > 0)
            {
                TheControlType tType = TheNMIEngine.GetControlTypeByType(tControl);
                if (tType != null)
                {
                    ThePropertyBag.PropBagUpdateValue(CountBar.PropertyBag, "EngineName", "=", tType.BaseEngineName);
                }
                tCtrlType = eFieldType.UserControl;
            }
            else
            {
                tCtrlType = (eFieldType)TheCommonUtils.CInt(tControl);
            }
            CountBar.Type        = tCtrlType;
            CountBar.Flags       = TheCommonUtils.CInt(ThePropertyBag.PropBagGetValue(CountBar.PropertyBag, "Flags", "="));
            CountBar.PropertyBag = new TheNMIBaseControl {
                ParentFld = 1
            };
            CountBar.UpdateUXProperties(Guid.Empty);
            CountBar.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "click", (sener, para) => {
                TheThing.SetSafePropertyBool(MyBaseThing, "ClickState", !TheThing.GetSafePropertyBool(MyBaseThing, "ClickState"));
            });
        }
Esempio n. 2
0
        private void SetCtrlType()
        {
            if (MySampleControl == null)
            {
                return;
            }
            string     tControl  = ThePropertyBag.PropBagGetValue(MySampleControl.PropertyBag, "ControlType", "=");
            eFieldType tCtrlType = eFieldType.SingleEnded;

            if (!string.IsNullOrEmpty(tControl) && TheCommonUtils.CInt(tControl) == 0 && tControl.Length > 0)
            {
                TheControlType tType = TheNMIEngine.GetControlTypeByType(tControl);
                if (tType != null)
                {
                    ThePropertyBag.PropBagUpdateValue(MySampleControl.PropertyBag, "EngineName", "=", tType.BaseEngineName);
                }
                tCtrlType = eFieldType.UserControl;
            }
            else
            {
                tCtrlType = (eFieldType)TheCommonUtils.CInt(tControl);
            }
            MySampleControl.Type  = tCtrlType;
            MySampleControl.Flags = TheCommonUtils.CInt(ThePropertyBag.PropBagGetValue(MySampleControl.PropertyBag, "Flags", "="));
            MySampleControl.UpdateUXProperties(Guid.Empty);
        }
Esempio n. 3
0
        private void UpdateUx()
        {
            CountBar.PropertyBag = ThePropertyBag.CreateUXBagFromProperties(MyBaseThing);
            CountBar.Type        = (eFieldType)TheCommonUtils.CInt(ThePropertyBag.PropBagGetValue(CountBar.PropertyBag, "ControlType", "="));
            string t = TheCommonUtils.CListToString(CountBar.PropertyBag, ":;:");

            CountBar.SetUXProperty(Guid.Empty, t);
        }
Esempio n. 4
0
        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);
        }