예제 #1
0
파일: Function.cs 프로젝트: rongcheng/benz
        /// <summary>
        /// 获取所有Function列表
        /// </summary>
        /// <returns></returns>
        public static DataTable GetFunctionTableList()
        {
            //string sql = " select * from functionList order by orderFlag asc";
            //return SqlHelper.ExecuteDataset(SqlHelper.SqlCon_QJVRMS, CommandType.Text, sql).Tables[0];

            FunctionService fs = new FunctionService();
            return fs.GetFunctionTableList();
        }
예제 #2
0
파일: Function.cs 프로젝트: rongcheng/benz
        public static bool  GetUserFunctionRight(Guid userID)
        {
            //SqlParameter[] Parameters = new SqlParameter[1];
            //Parameters[0] = new SqlParameter("@UserId", SqlDbType.VarChar);
            //Parameters[0].Value = userID;

            //string sql = "select count(*) from dbo.AccessControlList where OperatorId in (select RoleId from dbo.Users_InRoles where UserId=@UserId) and ObjectId in (select FunctionId from  FunctionList)";
            //string strCount = SqlHelper.ExecuteScalar(SqlHelper.SqlCon_QJVRMS, CommandType.Text, sql, Parameters).ToString();
            //return strCount == "0" ? false : true;
            FunctionService fs = new FunctionService();
            return fs.GetUserFunctionRight(userID);
        }
예제 #3
0
파일: Function.cs 프로젝트: rongcheng/benz
        /// <summary>
        /// 获取拥有的function
        /// </summary>
        /// <param name="operId"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        public static DataTable GetOwnFunction(IOperator oper, OperatorMethod method)
        {
//            SecurityObjectType objType = SecurityObjectType.Function;

//            string sql = @"select f.functionId,f.FunctionName from accessControlList a,FunctionList f where
//                            a.operatorId=@operId and a.OperatorMethod=@operMethod and a.ObjectType=@objType and a.ObjectId=f.FunctionId";

//            SqlParameter[] Parameters = new SqlParameter[3];


//            Parameters[0] = new SqlParameter("@operId", SqlDbType.UniqueIdentifier);
//            Parameters[1] = new SqlParameter("@operMethod", SqlDbType.TinyInt);
//            Parameters[2] = new SqlParameter("@objType", SqlDbType.TinyInt);


//            Parameters[0].Value = oper.OperatorId;
//            Parameters[1].Value = (int)method;
//            Parameters[2].Value = (int)objType;

//            return SqlHelper.ExecuteDataset(SqlHelper.SqlCon_QJVRMS, CommandType.Text, sql, Parameters).Tables[0];

            FunctionService fs = new FunctionService();
            return fs.GetOwnFunction(oper.OperatorId, (int)method);
        }
예제 #4
0
        /// <summary>
        /// 添加某项用途
        /// </summary>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public static bool AddFunction(Function fl)
        {

            //SqlParameter[] Parameters = new SqlParameter[4];

            //Parameters[0] = new SqlParameter("@FunctionName", SqlDbType.NVarChar);
            //Parameters[1] = new SqlParameter("@UrlPath", SqlDbType.VarChar);
            //Parameters[2] = new SqlParameter("@Description", SqlDbType.NVarChar);
            //Parameters[3] = new SqlParameter("@orderFlag", SqlDbType.TinyInt);



            //Parameters[0].Value = fl.functionName;
            //Parameters[1].Value = fl.urlPath;
            //Parameters[2].Value = fl.description;
            //Parameters[3].Value = fl.orderFlag;


            //int result = SqlHelper.ExecuteNonQuery(SqlHelper.SqlCon_QJVRMS, CommandType.StoredProcedure, "Function_AddFunction", Parameters);
            //return result == 1;
            FunctionService fs = new FunctionService();
          
            return fs.AddFunction(fl.FunctionName, fl.UrlPath, fl.Description, fl.OrderFlag,fl.ParentFunctionId);

        }
예제 #5
0
        /// <summary>
        /// 根据FunctionID删除某项用途
        /// </summary>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public static bool DeleteFunctionByFunctionID(Guid FunctionID)
        {

            //SqlParameter[] Parameters = new SqlParameter[1];

            //Parameters[0] = new SqlParameter("@FunctionId", SqlDbType.UniqueIdentifier);
            //Parameters[0].Value = new Guid(FunctionID);

            //int result = SqlHelper.ExecuteNonQuery(SqlHelper.SqlCon_QJVRMS, CommandType.StoredProcedure, "Function_DeleteFunction", Parameters);
            //return result == 1;
            FunctionService fs = new FunctionService();
            return fs.DeleteFunctionByFunctionID(FunctionID);

        }
예제 #6
0
        public IList<Function> GetTopFunctionList()
        {
            SerializeObjectFactory sof = new SerializeObjectFactory();
            FunctionService fs = new FunctionService();
            string topFunctionList = fs.GetTopFunctionList();
            object o=sof.DesializeFromBase64(topFunctionList);
            IList<Function> list = (IList<Function>)o;

            return list;
        }
예제 #7
0
        /// <summary>
        /// Get All Function
        /// </summary>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public static List<Function> GetFunctionList()
        {
            SerializeObjectFactory sof = new SerializeObjectFactory();
            FunctionService fs = new FunctionService();
            string funListStr = fs.GetFunctionList();

            object o = sof.DesializeFromBase64(funListStr);

            List<Function> list = (List<Function>)o;

            return list;
            //List<Function> FunctionListAll = new List<Function>();

            //using (DataTable table = SqlHelper.ExecuteDataset(SqlHelper.SqlCon_QJVRMS, CommandType.StoredProcedure, "Function_GetFunction").Tables[0])
            //{
            //    foreach (DataRow row in table.Rows)
            //    {
            //        Function f = new Function();
            //        f.description = row["Description"].ToString();                   
            //        f.functionName = row["FunctionName"].ToString();
            //        f.urlPath = row["UrlPath"].ToString();
            //        f.functionID = row["FunctionId"].ToString();
            //        f.orderFlag = int.Parse(row["orderFlag"].ToString());
            //        FunctionListAll.Add(f);
            //    }
            //}

            //return FunctionListAll;
        }