Example #1
0
        /// <summary>
        /// 初始化 数据库 用户表
        /// </summary>
        /// <returns></returns>
        public static bool InitilizeKPI_User()
        {
            //clear
            string sql = @"delete From KPI_User ";

            DBAccess.GetRelation().ExecuteNonQuery(sql);

            //add sisadmin
            KPI_UserEntity usEntity = new KPI_UserEntity();

            usEntity.UserID       = Guid.NewGuid().ToString();
            usEntity.UserCode     = "sisadmin";
            usEntity.UserName     = "******";
            usEntity.UserPassword = KPI_UserDal.GetDESString("123456");
            usEntity.UserEMail    = "*****@*****.**";
            usEntity.UserPhone    = "13800138000";
            usEntity.UserTitle    = "SIS系统管理员";

            usEntity.UserGroups = "AA,";

            usEntity.UserIsValid = 1;

            usEntity.UserCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            usEntity.UserModifyTime = usEntity.UserCreateTime;

            KPI_UserDal.Insert(usEntity);



            //add sisdemo
            usEntity = new KPI_UserEntity();

            usEntity.UserID       = Guid.NewGuid().ToString();
            usEntity.UserCode     = "sisdemo";
            usEntity.UserName     = "******";
            usEntity.UserPassword = KPI_UserDal.GetDESString("123456");
            usEntity.UserEMail    = "*****@*****.**";
            usEntity.UserPhone    = "13800138000";
            usEntity.UserTitle    = "SIS系统游客帐户";

            usEntity.UserGroups = "AB,";

            usEntity.UserIsValid = 1;

            usEntity.UserCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
            usEntity.UserModifyTime = usEntity.UserCreateTime;

            KPI_UserDal.Insert(usEntity);

            return(true);
        }
Example #2
0
        /// <summary>
        /// 得到菜单列表
        /// </summary>
        /// <returns></returns>
        public static DataSet GetLeafMenus(string strUserCode)
        {
            //得到当前用户的权限
            string strUserGroup = KPI_UserDal.GetUserGroups(strUserCode);

            string[] estr = strUserGroup.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);

            string strcondition = "";

            for (int i = 0; i < estr.Length; i++)
            {
                strcondition += " MenuGroups like '%" + estr[i] + "%'";

                if (i < (estr.Length - 1))
                {
                    strcondition += " or ";
                }
            }

            if (strcondition == "")
            {
                strcondition = " ( MenuGroups like '')";
            }
            else
            {
                strcondition = " ( " + strcondition + " ) ";
            }

            string sql = @"select MenuID, MenuParentID, MenuName, MenuGIF, MenuURL, MenuTarget
                            from KPI_Menu 
                            where (MenuParentID <> '') and MenuIsDisplay=1 and MenuIsValid=1 and {0} 
                            order by MenuIndex";

            sql = string.Format(sql, strcondition);

            return(DBAccess.GetRelation().ExecuteDataset(sql));
        }