Esempio n. 1
0
        public static void GetAvailableModes(ICswResources CswResources, KioskModeDataReturn Return, KioskModeData KioskModeData)
        {
            CswNbtResources    NbtResources        = (CswNbtResources)CswResources;
            CswNbtObjClassRole currentUserRoleNode = NbtResources.Nodes.makeRoleNodeFromRoleName(NbtResources.CurrentNbtUser.Rolename);

            KioskModeData kioskModeData   = new KioskModeData();
            string        applies_to_all  = "";
            string        applies_to_cont = "Containers";
            string        applies_to_imcs = "Equipment & Assemblies";

            if (NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.Containers))
            {
                if (NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.IMCS))
                {
                    applies_to_all = "Containers, Equipment & Assemblies";
                }
                else
                {
                    applies_to_all = applies_to_cont;
                }
            }
            else if (NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.IMCS))
            {
                applies_to_all  = "Equipment & Assemblies";
                applies_to_cont = "";
            }


            kioskModeData.AvailableModes.Add(new Mode
            {
                name             = CswTools.UppercaseFirst(CswEnumNbtKioskModeRuleName.Move._Name),
                imgUrl           = "Images/newicons/KioskMode/Move_code39.png",
                applies_to_types = applies_to_all
            });

            if (NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.Containers))
            {
                kioskModeData.AvailableModes.Add(new Mode
                {
                    name             = CswTools.UppercaseFirst(CswEnumNbtKioskModeRuleName.Owner._Name),
                    imgUrl           = "Images/newicons/KioskMode/Owner_code39.png",
                    applies_to_types = applies_to_all
                });
                kioskModeData.AvailableModes.Add(new Mode
                {
                    name             = CswTools.UppercaseFirst(CswEnumNbtKioskModeRuleName.Transfer._Name),
                    imgUrl           = "Images/newicons/KioskMode/Transfer_code39.png",
                    applies_to_types = applies_to_all
                });
                kioskModeData.AvailableModes.Add(new Mode
                {
                    name             = CswTools.UppercaseFirst(CswEnumNbtKioskModeRuleName.Open._Name),
                    imgUrl           = "Images/newicons/KioskMode/Open_code39.png",
                    applies_to_types = applies_to_cont
                });

                CswNbtPermit permissions = new CswNbtPermit(NbtResources);
                if (permissions.can(CswEnumNbtActionName.DispenseContainer))
                {
                    kioskModeData.AvailableModes.Add(new Mode
                    {
                        name             = CswTools.UppercaseFirst(CswEnumNbtKioskModeRuleName.Dispense._Name),
                        imgUrl           = "Images/newicons/KioskMode/Dispense_code39.png",
                        applies_to_types = applies_to_cont
                    });
                }
                if (permissions.can(CswEnumNbtActionName.DisposeContainer))
                {
                    kioskModeData.AvailableModes.Add(new Mode
                    {
                        name             = CswTools.UppercaseFirst(CswEnumNbtKioskModeRuleName.Dispose._Name),
                        imgUrl           = "Images/newicons/KioskMode/Dispose_code39.png",
                        applies_to_types = applies_to_cont
                    });
                }
            }

            if (NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.IMCS))
            {
                kioskModeData.AvailableModes.Add(new Mode
                {
                    name             = CswTools.UppercaseFirst(CswEnumNbtKioskModeRuleName.Status._Name),
                    imgUrl           = "Images/newicons/KioskMode/Status_code39.png",
                    applies_to_types = applies_to_imcs
                });
            }

            kioskModeData.AvailableModes.Add(new Mode
            {
                name   = "Reset",
                imgUrl = "Images/newicons/KioskMode/Reset_code39.png"
            });

            Return.Data = kioskModeData;
        }