//=====================================================================
    //  FunctionName : Initalize
    /// <summary>
    /// 重载初始化函数
    /// </summary>
    //=====================================================================
    protected override void Initalize()
    {
        DetailPage = true;
        gvList.Columns[intKCYYBHColumnIndex].Visible = chkShowKCYYBH.Checked;
        gvList.Columns[intKCBBHColumnIndex].Visible  = chkShowKCBBH.Checked;
        gvList.Columns[intHYBHColumnIndex].Visible   = chkShowHYBH.Checked;
        gvList.Columns[intYYSJColumnIndex].Visible   = chkShowYYSJ.Checked;
        gvList.Columns[intYYBZColumnIndex].Visible   = chkShowYYBZ.Checked;
        gvList.Columns[intSKZTColumnIndex].Visible   = chkShowSKZT.Checked;
        gvList.Columns[intXHKSColumnIndex].Visible   = chkShowXHKS.Checked;
        gvList.Columns[intKTZPColumnIndex].Visible   = chkShowKTZP.Checked;
        gvList.Columns[intJSPJColumnIndex].Visible   = chkShowJSPJ.Checked;
        gvList.Columns[intPJRColumnIndex].Visible    = chkShowPJR.Checked;
        gvList.Columns[intPJSJColumnIndex].Visible   = chkShowPJSJ.Checked; YYSJ.Attributes.Add("onclick", "setday(this);");
        YYSJBegin.Attributes.Add("onclick", "setday(this);");
        YYSJEnd.Attributes.Add("onclick", "setday(this);");
        PJSJ.Attributes.Add("onclick", "setday(this);");
        PJSJBegin.Attributes.Add("onclick", "setday(this);");
        PJSJEnd.Attributes.Add("onclick", "setday(this);");

        // 数据查询
        appData = new T_BM_KCYYXXApplicationData();
        QueryRecord();
        gvList.DataSource = appData.ResultSet;
        gvList.DataBind();
        ViewState["RecordCount"] = appData.RecordCount;
        ViewState["CurrentPage"] = appData.CurrentPage;
        ViewState["PageSize"]    = appData.PageSize;
        ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
        InitPageInfo();
    }
Exemplo n.º 2
0
    //=====================================================================
    //  FunctionName : Initalize
    /// <summary>
    /// 重载初始化函数
    /// </summary>
    //=====================================================================
    protected override void Initalize()
    {
        DetailPage = true;
        gvList.Columns[intFBHColumnIndex].Visible     = chkShowFBH.Checked;
        gvList.Columns[intBTColumnIndex].Visible      = chkShowBT.Checked;
        gvList.Columns[intFBLMColumnIndex].Visible    = chkShowFBLM.Checked;
        gvList.Columns[intFBBMColumnIndex].Visible    = chkShowFBBM.Checked;
        gvList.Columns[intXXLXColumnIndex].Visible    = chkShowXXLX.Checked;
        gvList.Columns[intFJXZDZColumnIndex].Visible  = chkShowFJXZDZ.Checked;
        gvList.Columns[intXXZTColumnIndex].Visible    = chkShowXXZT.Checked;
        gvList.Columns[intIsTopColumnIndex].Visible   = chkShowIsTop.Checked;
        gvList.Columns[intTopSortColumnIndex].Visible = chkShowTopSort.Checked;
        gvList.Columns[intIsBestColumnIndex].Visible  = chkShowIsBest.Checked;
        gvList.Columns[intFBRJGHColumnIndex].Visible  = chkShowFBRJGH.Checked;
        gvList.Columns[intFBSJRQColumnIndex].Visible  = chkShowFBSJRQ.Checked;
        gvList.Columns[intFBIPColumnIndex].Visible    = chkShowFBIP.Checked; FBLM.RepeatColumns = 1;

        // 数据查询
        appData = new T_BG_0601ApplicationData();
        QueryRecord();
        gvList.DataSource = appData.ResultSet;
        gvList.DataBind();
        ViewState["RecordCount"] = appData.RecordCount;
        ViewState["CurrentPage"] = appData.CurrentPage;
        ViewState["PageSize"]    = appData.PageSize;
        ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
        InitPageInfo();
    }
        public static void Highlighting(RichTextBox richTextBox, DatabaseType databaseType, bool keepPosition = true, int?startIndex = null, int?stopIndex = null)
        {
            int start = richTextBox.SelectionStart;

            var dataTypes = DataTypeManager.GetDataTypeSpecifications(databaseType).Select(item => item.Name);
            var keywords  = KeywordManager.GetKeywords(databaseType);
            var functions = FunctionManager.GetFunctionSpecifications(databaseType).Select(item => item.Name).Except(keywords);

            string dataTypesRegex = $@"\b({string.Join("|", dataTypes)})\b";
            string keywordsRegex  = $@"\b({string.Join("|", keywords)})\b";
            string functionsRegex = $@"\b({string.Join("|", functions)})\b";
            string stringRegex    = $@"(['][^'^(^)]*['])";

            Highlighting(richTextBox, dataTypesRegex, RegexOptions.IgnoreCase, Color.Blue);
            Highlighting(richTextBox, keywordsRegex, RegexOptions.IgnoreCase, Color.Blue);
            Highlighting(richTextBox, functionsRegex, RegexOptions.IgnoreCase, ColorTranslator.FromHtml("#FF00FF"));
            Highlighting(richTextBox, stringRegex, RegexOptions.IgnoreCase, Color.Red);

            string commentString = databaseType == DatabaseType.MySql ? "#" : "--";
            string commentRegex  = $@"({commentString}).*[\n]?";

            Highlighting(richTextBox, commentRegex, RegexOptions.IgnoreCase, Color.Green);

            richTextBox.SelectionStart  = keepPosition ? start : 0;
            richTextBox.SelectionLength = 0;
            richTextBox.Focus();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 验证该用户是否拥有该模块功能权限
        /// </summary>
        /// <param name="userName">用户账号</param>
        /// <param name="functionId">模块id</param>
        /// <returns>true=是 false=否</returns>
        private bool HasRightIdCore(string userName, string functionId)
        {
            AppUser     user = UserManager.GetByName(userName);
            AppFunction func = FunctionManager.GetById(functionId);

            /*
             * 返回值在原有基础上添加了用户与模块功能的判断 by_zjf
             *       (user.FunctionIds.Count() == 0  || user.FunctionIds.Contains(functionId))
             * 判断规则优先顺序
             *      1.已设置用户与模块功能权限,验证是否存在该模块功能.
             *      2.未设置用户与模块功能权限,根据模块关联角色的关系进行验证.
             */
            return(user != null &&
                   (func == null ||
                    func.AuthType == JAuthType.AllUsers ||
                    func.AuthType == JAuthType.EveryOne ||
                    user.FunctionIds.Contains(functionId) ||
                    user.RoleIds.Any(rId => RoleManager.GetById(rId).FunctionIds.Contains(functionId))
                   ) &&
                   (user.IsDefaultRole ||
                    func.AuthType == JAuthType.AllUsers ||
                    func.AuthType == JAuthType.EveryOne ||
                    user.FunctionIds.Contains(functionId)
                   ));
        }
        public void InitRegister()
        {
            List <Entity.Category.Category> list = new List <Category>();

            FunctionManager.GetFunctionLists().ForEach(item =>
            {
                list.Add(new Category()
                {
                    Name           = item.Name,
                    Action         = item.Action,
                    Controller     = item.Controller,
                    CssClass       = item.CssClass,
                    FatherResource = item.FatherResource,
                    FatherId       = item.FatherId,
                    SysResource    = item.SysResource,
                    ResourceId     = item.ResourceId,
                    RouteName      = item.RouteName,
                    Sort           = item.Sort,
                    IsMenu         = item.IsMenu,
                    IsDisabled     = item.IsDisabled
                });
            });

            _categoryService.InitCategory(list);
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {

            Vivina.Erp.DataClasses.Function originalFunction;

            FunctionManager functionManager;


            if (!IsPostBack)
            {
                if (Context.Items["FunctionId"] != null)
                {

                    Page.ViewState["FunctionId"] = Context.Items["FunctionId"];
                    functionManager = new FunctionManager(this);
                    //originalFunction = functionManager.GetFunction(Convert.ToInt32(Page.ViewState["FunctionId"]));
                    originalFunction = functionManager.GetFunction(Convert.ToInt32(Page.ViewState["FunctionId"]));


                    txtName.Text = originalFunction.Name;
                    txtCode.Text = originalFunction.CodeName;
                    txtDescription.Value = originalFunction.Description ?? "";

                }


            }
        }
Exemplo n.º 7
0
 //=====================================================================
 //  FunctionName : Initalize
 /// <summary>
 /// 重载初始化函数
 /// </summary>
 //=====================================================================
 protected override void Initalize()
 {
     DetailPage = true;
     gvList.Columns[intBMBHColumnIndex].Visible = chkShowBMBH.Checked;
     gvList.Columns[intHYBHColumnIndex].Visible = chkShowHYBH.Checked;
     gvList.Columns[intKCJGColumnIndex].Visible = chkShowKCJG.Checked;
     gvList.Columns[intKSSColumnIndex].Visible  = chkShowKSS.Checked;
     gvList.Columns[intKCZKColumnIndex].Visible = chkShowKCZK.Checked;
     gvList.Columns[intSJJGColumnIndex].Visible = chkShowSJJG.Checked;
     gvList.Columns[intSKRColumnIndex].Visible  = chkShowSKR.Checked;
     gvList.Columns[intBMSJColumnIndex].Visible = chkShowBMSJ.Checked;
     gvList.Columns[intBZColumnIndex].Visible   = chkShowBZ.Checked;
     gvList.Columns[intLRRColumnIndex].Visible  = chkShowLRR.Checked;
     gvList.Columns[intLRSJColumnIndex].Visible = chkShowLRSJ.Checked;
     // 数据查询
     appData = new T_BM_BMXXApplicationData();
     QueryRecord();
     gvList.DataSource = appData.ResultSet;
     gvList.DataBind();
     ViewState["RecordCount"] = appData.RecordCount;
     ViewState["CurrentPage"] = appData.CurrentPage;
     ViewState["PageSize"]    = appData.PageSize;
     ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
     InitPageInfo();
 }
        /// <summary>
        /// Get the soft mask.
        /// The soft mask is a quite tricky think. Basically it describes a surface and any number
        /// of transition functions with relative stop positions 0..1 and a transparency value for each stop.
        /// Illustrator creates exactly the same area as for the gradient object this soft mask
        /// is applied to. That's why we can shorten thinks and ignore the area, path, ... and
        /// just read the stop values from the transition function(s).
        /// That makes sense because the Illustrator user creates only one set of stops per
        /// gradient. Each stop contains the position, the color and the transparency.
        /// </summary>
        private List <FunctionStop> GetSoftMask(PdfDictionary smaskDict)
        {
            var transparencyGroupDict = smaskDict.Elements.GetDictionary(PdfKeys.G);

            var resourcesDict = transparencyGroupDict.Elements.GetDictionary(PdfKeys.Resources);

            if (resourcesDict == null)
            {
                return(null);
            }

            var shadingsDict = resourcesDict.Elements.GetDictionary(PdfKeys.Shading);

            if (shadingsDict == null)
            {
                return(null);
            }

            var key          = shadingsDict.Elements.First().Key;
            var shadingDict  = shadingsDict.Elements.GetDictionary(key);
            var functionDict = shadingDict.Elements.GetDictionary(PdfKeys.Function);

            var function = FunctionManager.ReadFunction(functionDict);
            var stops    = function.GetBoundaryValues();

            return(stops);
        }
Exemplo n.º 9
0
        private void RunDeterminePrimaryScriptFileFunc(string expect, string jObjectStr, string dir)
        {
            JObject functionConfig = JObject.Parse(jObjectStr);

            var traceFactoryMock = new Mock <ITraceFactory>();

            traceFactoryMock.Setup(tf => tf.GetTracer()).Returns(NullTracer.Instance);

            var functionManager = new FunctionManager(new Mock <IEnvironment>().Object, traceFactoryMock.Object);

            string[] functionFiles = FileSystemHelpers.GetFiles(dir, "*.*", SearchOption.TopDirectoryOnly)
                                     .Where(p => !String.Equals(Path.GetFileName(p), Constants.FunctionsConfigFile, StringComparison.OrdinalIgnoreCase))
                                     .ToArray();
            string scriptFile = (string)functionConfig["scriptFile"];
            string scriptPath = string.IsNullOrEmpty(scriptFile) ? null : Path.Combine(dir, scriptFile);

            if ((string.IsNullOrEmpty(scriptFile) && functionFiles.Length == 0) || expect == null)
            {
                Assert.Null(functionManager.DeterminePrimaryScriptFile((string)functionConfig["scriptFile"], dir));
                return;
            }
            if (!string.IsNullOrEmpty(scriptPath) && !FileSystemHelpers.FileExists(scriptPath))
            {
                Assert.Throws <ConfigurationErrorsException>(() => functionManager.DeterminePrimaryScriptFile((string)functionConfig["scriptFile"], dir));
            }
            else
            {
                Assert.Equal(expect, functionManager.DeterminePrimaryScriptFile((string)functionConfig["scriptFile"], dir), StringComparer.OrdinalIgnoreCase);
            }
        }
Exemplo n.º 10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {

            Vivina.Erp.DataClasses.Function originalFunction = new Vivina.Erp.DataClasses.Function();
            FunctionManager functionManager = new FunctionManager(this);
            Vivina.Erp.DataClasses.Function function = new Vivina.Erp.DataClasses.Function();


            if (Page.ViewState["FunctionId"] != null)
            {

                originalFunction = functionManager.GetFunction(Convert.ToInt32(Page.ViewState["FunctionId"]));
                function.CopyPropertiesFrom(originalFunction);
            }

            function.Name = txtName.Text;
            function.CodeName = txtCode.Text;
            function.Description = txtDescription.Value;

            SiteMapNode node = SiteMap.RootNode.GetAllNodes().Cast<SiteMapNode>().Where(n => n.ResourceKey == function.FunctionId.ToString()).FirstOrDefault();
            if (node != null)
                node.Description = function.Description;


            if (Page.ViewState["FunctionId"] != null)
                //functionManager.update(originalFunction, function);
                functionManager.Update(originalFunction, function);
            else
                functionManager.InsertFunction(function);

            Server.Transfer("Functions.aspx");
        }
Exemplo n.º 11
0
        public void InitRegister()
        {
            List <Entities.Category> list = new List <Entities.Category>();

            FunctionManager.getFunctionLists().ForEach(item =>
            {
                list.Add(new Entities.Category()
                {
                    Id             = Guid.NewGuid(),
                    Action         = item.Action,
                    Controller     = item.Controller,
                    CssClass       = item.CssClass,
                    FatherResource = item.FatherResource,
                    IsMenu         = item.IsMenu,
                    Name           = item.Name,
                    RouteName      = item.RouteName,
                    SysResource    = item.SysResource,
                    Sort           = item.Sort,
                    FatherID       = item.FatherID,
                    IsDisabled     = false,
                    ResourceID     = item.ResourceID
                });
            });
            _categoryService.InitCategory(list);
        }
Exemplo n.º 12
0
 public FunctionCU(DBConnection conn)
 {
     InitializeComponent();
     connection  = conn;
     listQueries = new ListConnection(conn);
     tManager    = new FunctionManager();
 }
Exemplo n.º 13
0
 //=====================================================================
 //  FunctionName : Initalize
 /// <summary>
 /// 重载初始化函数
 /// </summary>
 //=====================================================================
 protected override void Initalize()
 {
     DetailPage = true;
     gvList.Columns[intHYBHColumnIndex].Visible  = chkShowHYBH.Checked;
     gvList.Columns[intHYXMColumnIndex].Visible  = chkShowHYXM.Checked;
     gvList.Columns[intHYNCColumnIndex].Visible  = chkShowHYNC.Checked;
     gvList.Columns[intHYSRColumnIndex].Visible  = chkShowHYSR.Checked;
     gvList.Columns[intHYXXColumnIndex].Visible  = chkShowHYXX.Checked;
     gvList.Columns[intHYBJColumnIndex].Visible  = chkShowHYBJ.Checked;
     gvList.Columns[intJZXMColumnIndex].Visible  = chkShowJZXM.Checked;
     gvList.Columns[intJZDHColumnIndex].Visible  = chkShowJZDH.Checked;
     gvList.Columns[intZCSJColumnIndex].Visible  = chkShowZCSJ.Checked;
     gvList.Columns[intZKSSColumnIndex].Visible  = chkShowZKSS.Checked;
     gvList.Columns[intXHKSSColumnIndex].Visible = chkShowXHKSS.Checked;
     gvList.Columns[intSYKSSColumnIndex].Visible = chkShowSYKSS.Checked;
     // 数据查询
     appData = new T_BM_HYXXApplicationData();
     QueryRecord();
     gvList.DataSource = appData.ResultSet;
     gvList.DataBind();
     ViewState["RecordCount"] = appData.RecordCount;
     ViewState["CurrentPage"] = appData.CurrentPage;
     ViewState["PageSize"]    = appData.PageSize;
     ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
     InitPageInfo();
 }
    //=====================================================================
    //  FunctionName : Initalize
    /// <summary>
    /// 重载初始化函数
    /// </summary>
    //=====================================================================
    protected override void Initalize()
    {
        DetailPage = true;
        gvList.Columns[intKCBBHColumnIndex].Visible  = chkShowKCBBH.Checked;
        gvList.Columns[intKCXLBHColumnIndex].Visible = chkShowKCXLBH.Checked;
        gvList.Columns[intKCBHColumnIndex].Visible   = chkShowKCBH.Checked;
        gvList.Columns[intKCSJColumnIndex].Visible   = chkShowKCSJ.Checked;
        gvList.Columns[intKSSColumnIndex].Visible    = chkShowKSS.Checked;
        gvList.Columns[intSKJSColumnIndex].Visible   = chkShowSKJS.Checked;
        gvList.Columns[intSKFJColumnIndex].Visible   = chkShowSKFJ.Checked; KCXLBH.RepeatColumns = 1;
        KCSJ.Attributes.Add("onclick", "setday(this);");
        KCSJBegin.Attributes.Add("onclick", "setday(this);");
        KCSJEnd.Attributes.Add("onclick", "setday(this);");

        // 数据查询
        appData = new T_BM_KCBXXApplicationData();
        QueryRecord();
        gvList.DataSource = appData.ResultSet;
        gvList.DataBind();
        ViewState["RecordCount"] = appData.RecordCount;
        ViewState["CurrentPage"] = appData.CurrentPage;
        ViewState["PageSize"]    = appData.PageSize;
        ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
        InitPageInfo();
    }
Exemplo n.º 15
0
 protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
 {
     ViewState["CurrentPage"] = int.Parse(ddlPageSize.SelectedValue);
     QueryRecordInfo();
     ViewState["RecordCount"] = intRecordCount;
     ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
     InitPageInfo();
 }
Exemplo n.º 16
0
 protected void btnLastPage_Click(object sender, EventArgs e)
 {
     ViewState["CurrentPage"] = ViewState["PageCount"];
     QueryRecordInfo();
     ViewState["RecordCount"] = intRecordCount;
     ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
     InitPageInfo();
 }
 public void Works_with_int()
 {
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { 1 }));
     var e = sut.GetEnumerator();
     IsTrue(e.MoveNext());
     AreEqual(1, e.Current.Function());
     IsFalse(e.MoveNext());
 }
Exemplo n.º 18
0
 internal Task ResumeAsync(string sessionId)
 => _suspensionManager.ResumeAsync(
     sessionId,
     deserializer =>
 {
     FunctionManager.Deserialize(deserializer);
     return(Graph.DeserializeAsync(deserializer));
 });
Exemplo n.º 19
0
        /// <summary>
        /// 获取URL对应的Function
        /// </summary>
        /// <param name="location">地址</param>
        /// <param name="method">提交方法</param>
        /// <returns>Function实体</returns>
        public virtual AppFunction GetFunctionByLocation(string location, WebMethod method = WebMethod.GET)
        {
            AppFunction function = FunctionManager.GetAll()
                                   .FirstOrDefault(f => f.MatchLocation(location) &&
                                                   f.Method == method);

            return(function);
        }
Exemplo n.º 20
0
        public override void Method()
        {
            int lineIndex;

            if (int.TryParse(Parameters[0], out lineIndex) && lineIndex > 0)
            {
                FunctionManager.Run(lineIndex);
            }
        }
Exemplo n.º 21
0
 protected void btnFirstPage_Click(object sender, EventArgs e)
 {
     ViewState["CurrentPage"] = 1;
     ViewState["PageSize"]    = int.Parse(DEFAULT_PAGE_SIZE);
     QueryRecordInfo();
     ViewState["RecordCount"] = intRecordCount;
     ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
     InitPageInfo();
 }
Exemplo n.º 22
0
    public Text Message;                //说明文字
    #endregion

    void Awake()
    {
        //实例化自身
        Instance = this;

        //获取到gamemanager
        gm = FindObjectOfType <GameManager>();
        fm = FindObjectOfType <FunctionManager>();
    }
Exemplo n.º 23
0
        public static void Main(string[] args)
        {
            var mgr = new FunctionManager();

            CreateWebHostBuilder(args)
            .ConfigureServices(services => services.AddSingleton(mgr))
            .Build()
            .Run();
        }
Exemplo n.º 24
0
        /// <summary>
        /// 判断用户是否有某个资源的访问权限
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="location">资源定位标识</param>
        /// <returns>是/否</returns>
        public virtual bool HasRight(string userName, string location, WebMethod method = WebMethod.GET)
        {
            AppFunction function = FunctionManager.GetAll()
                                   .FirstOrDefault(f => f.MatchLocation(location) &&
                                                   f.Method == method);

            //    if (function == null) return false; //在没初始化功能集合时,只要用户登录了就能访问所有功能
            return(function == null || HasRightIdCore(userName, function.Id));
        }
Exemplo n.º 25
0
 /// <summary>
 /// 获取当前用户无权限的功能ID列表
 /// </summary>
 /// <param name="userName">用户名</param>
 /// <returns>功能ID列表</returns>
 internal IEnumerable <string> GetForbiddenIds(string userName)
 {
     return(FunctionManager.GetAll()
            .Where(func => func.AuthType == JAuthType.NeedAuth)
            .Select(func => func.Id)
            .Except(GetRightIds(userName))
            .Union(FunctionManager.GetAll()
                   .Where(func => func.AuthType == JAuthType.Forbidden)
                   .Select(func => func.Id)));
 }
        public override void Initialize(string name, NameValueCollection attributes)
        {
            base.Initialize(name, attributes);
            CreatingSiteMapNodeEventHandler += OnCreatingSiteMapNode;

            using (var manager = new FunctionManager(null))
                functions = manager.GetAllFunctions().ToList();

            RegisterFunctions(RootNode);
        }
Exemplo n.º 27
0
 public void SetupIntellisence()
 {
     this.intellisenseSetuped = true;
     this.enableIntellisense  = true;
     this.keywords            = KeywordManager.GetKeywords(this.DatabaseType);
     this.builtinFunctions    = FunctionManager.GetFunctionSpecifications(this.DatabaseType);
     this.schemaInfo          = DataStore.GetSchemaInfo(this.DatabaseType);
     this.allWords            = SqlWordFinder.FindWords(this.DatabaseType, "");
     this.dbOwners            = this.allWords.Where(item => item.Type == SqlWordTokenType.Owner).Select(item => item.Text).ToList();
 }
Exemplo n.º 28
0
 void RegisterCustomFunctions()
 {
     FunctionManager.RegisterFunction(new Arguments());
     FunctionManager.RegisterFunction(new GeoMean());
     FunctionManager.RegisterFunction(new E());
     FunctionManager.RegisterFunction(new Add());
     FunctionManager.RegisterFunction(new RepeatString());
     FunctionManager.RegisterFunction(new Nand());
     FunctionManager.RegisterFunction(new CustomFunctions.Functions.Upper());
 }
Exemplo n.º 29
0
        //菜单新增
        public ActionResult menuAdd(Function fun)
        {
            Random random = new Random();
            int    n      = random.Next(10000, 100000);

            fun.NodeId       = n;
            fun.ParentNodeId = n;
            fun.CreateTime   = DateTime.Now;
            fun.IsDelete     = 0;
            return(Json(FunctionManager.Add(fun), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 30
0
        private async void DeleteFlyoutItem_ClickAsync(object sender, RoutedEventArgs e)
        {
            if (!(sender is FrameworkElement element))
            {
                return;
            }

            if (element.DataContext is FunctionData function)
            {
                await FunctionManager.DeleteFunctionAsync(function).ConfigureAwait(false);
            }
        }
Exemplo n.º 31
0
        /// <summary>
        /// 验证该用户是否拥有该模块功能权限
        /// </summary>
        /// <param name="userName">用户账号</param>
        /// <param name="functionId">模块id</param>
        /// <returns>true=是 false=否</returns>
        private bool HasRightIdCore(string userName, string functionId)
        {
            AppFunction func = FunctionManager.GetById(functionId);

            if (func == null || func.AuthType == JAuthType.EveryOne)
            {
                return(true);
            }
            var user = AppManager.Instance.UserManager.GetByName(userName);

            if (user == null)
            {
                return(false);
            }

            if (func.AuthType == JAuthType.AllUsers)
            {
                return(true);
            }

            if (!user.IsDefaultRole && user.FunctionIds.Contains(functionId))
            {
                return(true);
            }

            if (user.IsDefaultRole && user.RoleIds.Any(rId => RoleManager.GetById(rId).FunctionIds.Contains(functionId)))
            {
                return(true);
            }

            return(false);

            /*
             * 返回值在原有基础上添加了用户与模块功能的判断 by_zjf
             *       (user.FunctionIds.Count() == 0  || user.FunctionIds.Contains(functionId))
             * 判断规则优先顺序
             *      1.已设置用户与模块功能权限,验证是否存在该模块功能.
             *      2.未设置用户与模块功能权限,根据模块关联角色的关系进行验证.
             */

            //return user != null
            //        && (func == null
            //        || func.AuthType == JAuthType.AllUsers
            //        || func.AuthType == JAuthType.EveryOne
            //        || user.FunctionIds.Contains(functionId)
            //        || user.RoleIds.Any(rId => RoleManager.GetById(rId).FunctionIds.Contains(functionId))
            //    )
            //    && (user.IsDefaultRole
            //    || func.AuthType == JAuthType.AllUsers
            //    || func.AuthType == JAuthType.EveryOne
            //    || user.FunctionIds.Contains(functionId)
            //        );
        }
 public void Works_with_action()
 {
     var x = 0;
     var action = new Action(() => { x = 1; });
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { action }));
     var e = sut.GetEnumerator();
     IsTrue(e.MoveNext());
     AreEqual(0, x);
     e.Current.Function();
     AreEqual(1, x);
     IsFalse(e.MoveNext());
 }
Exemplo n.º 33
0
        public static void Main(string[] args)
        {
            //TassleCoreConfig tassleConfig = new TassleCoreConfig() {
            //    Culture = "en-us"
            //};

            //TassleCore tassle = new TassleCore(tassleConfig);


            //tassle.Start();

            /*
             * DynamicAssembly da = new DynamicAssembly("Deneme");
             *
             * var dc = da.AddClass("Eser");
             *
             * var df = dc.AddField("a", typeof(int), FieldAttributes.Private);
             * var dp = df.ConvertToProperty(dc, "A");
             *
             * dc.Finalize();
             *
             * da.Save();
             *
             * Console.WriteLine("done");
             */

            // initialize bootstrapper
            var bootstrapper    = new Bootstrapper();
            var serviceProvider = bootstrapper.GetServiceProvider();

            // // start telnet
            // var telnetServer = serviceProvider.GetService<ITelnetServer>();
            // telnetServer.Start();

            // // setup console logging
            // var loggerFactory = serviceProvider.GetService<ILoggerFactory>();
            // loggerFactory
            //     .AddConsole(LogLevel.Debug)
            //     .AddDebug()
            //     .AddTelnet(serviceProvider);

            var fm = new FunctionManager(serviceProvider);

            fm.RunAsync(
                new TestFunction(),
                new Request <int>()
            {
                Value = 5
            });

            Console.Read();
        }
Exemplo n.º 34
0
        internal GMExtensionFile(GMExtension extension)
        {
            if (extension == null)
            {
                throw new ArgumentNullException(nameof(extension));
            }

            Functions  = new FunctionManager(this);
            Constants  = new ConstantManager(this);
            ProxyFiles = new ProxyFileManager(this);

            this.extension = extension;
        }
 protected override void Initalize()
 {
     DetailPage = true;
     // 数据查询
     appData = new FilterReportApplicationData();
     QueryRecord();
     rptList.DataSource = appData.ResultSet;
     rptList.DataBind();
     ViewState["RecordCount"] = appData.RecordCount;
     ViewState["CurrentPage"] = appData.CurrentPage;
     ViewState["PageSize"]    = appData.PageSize;
     ViewState["PageCount"]   = FunctionManager.RoundInt(((int)ViewState["RecordCount"] / (float)(int)ViewState["PageSize"]));
     InitPageInfo();
 }
 private IFunctionManager CreateInstance()
 {
     IFunctionManager target = new FunctionManager();
     return target;
 }
 public void Works_with_2_functions()
 {
     var function1 = new Func<int>(() => 1);
     var function2 = new Func<int>(() => 2);
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { function1, function2 }));
     var e = sut.GetEnumerator();
     IsTrue(e.MoveNext());
     AreEqual(1, e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual(2, e.Current.Function());
     IsFalse(e.MoveNext());
 }
 public void Works_with_empty_arguments()
 {
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { }));
     var e = sut.GetEnumerator();
     IsFalse(e.MoveNext());
 }
 public void Works_with_action_taking_1_parameter_and_two_matching_arguments()
 {
     var x = 0;
     var action = new Action<int>(y => { x = y; });
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { action, 1, 2 }));
     var e = sut.GetEnumerator();
     IsTrue(e.MoveNext());
     AreEqual(0, x);
     e.Current.Function();
     AreEqual(1, x);
     IsTrue(e.MoveNext());
     AreEqual(1, x);
     e.Current.Function();
     AreEqual(2, x);
     IsTrue(e.MoveNext());
     AreEqual(1, e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual(2, e.Current.Function());
     IsFalse(e.MoveNext());
 }
 public void Works_with_function_taking_1_parameter_and_two_matching_arguments_where_one_argument_is_another_function_and_stack_size_is_1()
 {
     var function1 = new Func<int, string>(x => x + "b");
     var function2 = new Func<int>(() => 1);
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { function1, function2, 2 }), 1);
     var e = sut.GetEnumerator();
     IsTrue(e.MoveNext());
     AreEqual("1b", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("2b", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual(1, e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual(2, e.Current.Function());
     IsFalse(e.MoveNext());
 }
 public void Works_with_function_taking_1_parameter_and_two_matching_arguments()
 {
     var function = new Func<int, string>(x => x + "b");
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { function, 1, 2 }));
     var e = sut.GetEnumerator();
     IsTrue(e.MoveNext());
     AreEqual("1b", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("2b", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual(1, e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual(2, e.Current.Function());
     IsFalse(e.MoveNext());
 }
 public void Works_with_2_functions_taking_1_parameter_where_stack_size_is_2()
 {
     var function1 = new Func<string, string>(x => "a" + x);
     var function2 = new Func<string, string>(x => "b" + x);
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { function1, function2, "c" }), 2);
     var e = sut.GetEnumerator();
     IsTrue(e.MoveNext());
     AreEqual("aaac", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("aabc", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("aac", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("abac", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("abbc", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("abc", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("ac", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("baac", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("babc", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("bac", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("bbac", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("bbbc", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("bbc", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("bc", e.Current.Function());
     IsTrue(e.MoveNext());
     AreEqual("c", e.Current.Function());
     IsFalse(e.MoveNext());
 }
        /// <summary>
        /// Method to create a permission
        /// </summary>
        /// <param name="planId"></param>
        /// <param name="roleId"></param>
        /// <param name="companyId"></param>
        private void CreatePermissions(int planId, int roleId, int companyId)
        {
            var permissionManager = new PermissionManager(this);
            var functionManager = new FunctionManager(this);
            IList<Function> functions = functionManager.GetFunctionsByPlan(planId);

            foreach (Function function in functions)
            {
                //Below the line was changed to give the new object Permission
                //to method permissionManager.Insert an object each time it is called
                var newPermission = new Permission();
                newPermission.FunctionId = function.FunctionId;
                newPermission.PermissionTypeId = (int)AccessControlActions.Change;
                newPermission.RoleId = roleId;
                newPermission.CompanyId = companyId;
                permissionManager.Insert(newPermission);
            }
        }
 public void Works_with_action_taking_1_parameter_but_without_providing_any_matching_arguments()
 {
     var x = 0;
     var action = new Action<int>(y => { x = y; });
     var sut = new FunctionManager(new ReadOnlyCollection<object>(new object[] { action }));
     var e = sut.GetEnumerator();
     IsFalse(e.MoveNext());
 }
Exemplo n.º 45
0
    public static bool DeleteFunction(int functionId)
    {
        bool result = true;
        using (FunctionManager functionManager = new FunctionManager(null))
        {
            try
            {
                functionManager.DeleteFunction(functionId);
            }
            catch (System.Data.SqlClient.SqlException e)
            {
                result = false;
            }
        }
        return result;

    }
        /// <summary>
        /// Perform the full SiteMapTree and register functions
        /// </summary>
        /// <param name="node">SiteMapNode that will registered</param>
        /// <returns>Id the function</returns>
        protected virtual void RegisterFunctions(SiteMapNode node)
        {
            node.ReadOnly = false;
            isRegisterFunctions = true;

            //
            // Check if the function is registered
            //
            var function = new Function();
            string permissionRequiredKey = Resources.PermissionRequiredKey;
            if (!String.IsNullOrEmpty(node[permissionRequiredKey]))
            {
                //
                // Get the full path name
                //
                String title = node.Title;
                SiteMapNode parentNode = node.ParentNode;
                while (parentNode != null && !String.IsNullOrEmpty(parentNode.Title))
                {
                    title = parentNode.Title + " > " + title;
                    parentNode = parentNode.ParentNode;
                }
                title = title.Trim().Trim('>').Trim();


                function = functions.Where(f => f.Name == title).FirstOrDefault() ?? new Function();
                function.Name = title;
                if (function.FunctionId == 0)
                {
                    function.CodeName = node[permissionRequiredKey].Trim();
                    using (var manager = new FunctionManager(null))
                        manager.Insert(function);
                }
                else
                {
                    node.ResourceKey = function.FunctionId.ToString();
                    if (!String.IsNullOrEmpty(function.Description))
                        node.Description = function.Description;


                    if (!String.IsNullOrEmpty(node.ParentNode.ResourceKey))
                        if (function.ParentId.ToString() != node.ParentNode.ResourceKey)
                            using (var manager = new FunctionManager(null))
                            {
                                // Recupera do banco para criar o link e deixar o objeto ativo
                                function = manager.GetFunction(title);
                                function.ParentId = Convert.ToInt32(node.ParentNode.ResourceKey);
                                manager.DbContext.SubmitChanges();
                            }
                }

            }

            var args = new CreatingSiteMapNodeArgs(node, node[permissionRequiredKey], function.FunctionId);
            CreatingSiteMapNodeEventHandler(new object(), args);

            isRegisterFunctions = false;


            //
            // Perfoms the tree
            //
            foreach (SiteMapNode childNode in node.ChildNodes) RegisterFunctions(childNode);
        }