Model.userPower mUserPower = new Dianda.Model.userPower();//用户的权限实体类
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             mUserPower = (Model.userPower)Session["Session_Power"];
             JudgeMenu(mUserPower.menuRole.ToString());
         }
     }
     catch
     { }
 }
Example #2
0
        /// <summary>
        /// 根据当前的用户SESSION判断功能
        /// </summary>
        private void sessionJudge()
        {
            try
            {
                mUserPower = (Model.userPower)Session["Session_Power"];
                //判断菜单的权限
                JudgeMenu(mUserPower.menuRole.ToString());
                //判断按钮的权限

                //判断页面的权限
                JudgePage(mUserPower.pageurl.ToString());
            }
            catch
            {
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                mUserPower = (Model.userPower)Session["Session_Power"];
                JudgeMenu(mUserPower.menuRole.ToString()); //判断列表显示
            }
            catch
            {
            }

            if (!IsPostBack)
            {
                string pageindex = null;//这里是为分页服务的

                pageindex = Request["pageindex"];


                string count = dtrowsHidden.Value.ToString();
                if (count.Length == 0)
                {
                    setRowCout("", "", "", "", "");//获取当前状态下有多少条数据记录,为分页提供页数和全部条数服务
                    count = dtrowsHidden.Value.ToString();
                }
                else
                {
                    count = "0";
                }
                int countint = int.Parse(count);

                if (pageindex == null || pageindex == "")
                {
                    pageindex = "1";
                }

                int pageindex_int = int.Parse(pageindex);

                ShowListInfo(pageindex_int, "", "", "", "", "");
            }

            //设置模板页中的管理值
            (Master.FindControl("Label_navigation") as Label).Text = "管理 > 项目管理 ";
            //设置模板页中的管理值
        }
        /// <summary>
        /// 获取条件
        /// </summary>
        /// <returns></returns>
        private string getCondition()
        {
            //付全文    2013-4-16   新增消息权限
            Model.userPower userPower = Session["Session_Power"] as Model.userPower;
            List <string>   strList   = new List <string>();

            foreach (string str in userPower.menuRole.Split(';'))
            {
                strList.Add(str);
            }
            string role      = Session["Session_Role"].ToString();
            string condition = "";

            if (bIsExistString(role, strList))
            {
                condition = "通知公告";
            }
            return(condition);
        }
Example #5
0
        /// <summary>
        /// 判断按钮的权限
        /// </summary>
        /// <param name="buttonsession"></param>
        public void JudgeButton()
        {
            try
            {
                mUserPower = (Model.userPower)Session["Session_Power"];
                string buttonsession = mUserPower.buttomID.ToString();
                if (buttonsession.Length > 0)
                {
                    string[] buarray = buttonsession.Split(';');
                    string   urls    = Request.FilePath.ToString();// //获取到当前的页面的URL
                    for (int i = 0; i < buarray.Length; i++)
                    {
                        if (buarray[i].ToString().Contains(urls))
                        {
                            string[] arrays   = buarray[i].ToString().Split(',');
                            string   pageurl  = arrays[0].ToString();
                            string   buttonid = arrays[1].ToString();

                            LinkButton lb = (LinkButton)Page.FindControl(buttonid);
                            if (lb != null)
                            {
                                lb.Enabled = true;
                            }
                            else
                            {
                                Button bb = (Button)Page.FindControl(buttonid);
                                if (bb != null)
                                {
                                    bb.Enabled = true;
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }
        /// <summary>
        /// 构造查询条件
        /// </summary>
        /// <returns></returns>
        protected string SQLCondition_tag2(string types, string isread, string condition)
        {
            //1-全部、2-审批提醒、3-项目任务、4-共享文档、5-申请反馈、
            //6-通知公告、7-个人消息、8-项目消息、9-部门消息、10-历史消息

            StringBuilder sbSql = new StringBuilder();

            sbSql.Append(" 1=1 ");
            string strNewsType = types;

            if (strNewsType == "1")
            {
                //1-全部
                sbSql.Append(" ");
                mUserPower = (Model.userPower)Session["Session_Power"];
                if (mUserPower.specialRole.Contains("or"))
                {
                    sbSql.Append(" and  (" + mUserPower.specialRole.ToString() + " or Receive='" + ((Model.USER_Users)Session["USER_Users"]).ID + "') ");
                }
                else
                {
                    sbSql.Append(" AND Receive ='" + ((Model.USER_Users)Session["USER_Users"]).ID + "'");
                }
                // searchrtable.Visible = false;//搜索的功能不显示
            }
            if (strNewsType == "2")
            {
                //2-审批提醒
                mUserPower = (Model.userPower)Session["Session_Power"];
                if (mUserPower.specialRole.Contains("or"))
                {
                    sbSql.Append(" and " + mUserPower.specialRole.ToString() + "");
                }
                else
                {
                    sbSql.Append(" and IsRead='3'");
                }
                //searchrtable.Visible = false;//搜索的功能不显示
            }
            if (strNewsType == "3")
            {
                //3-项目任务
                sbSql.Append("and NewsType='项目任务' AND Receive ='" + ((Model.USER_Users)Session["USER_Users"]).ID + "'");
                // searchrtable.Visible = false;//搜索的功能不显示
            }
            if (strNewsType == "4")
            {
                //4-共享文档
                sbSql.Append(" and  NewsType='共享文档'  AND Receive ='" + ((Model.USER_Users)Session["USER_Users"]).ID + "'");
                // searchrtable.Visible = false;//搜索的功能不显示
            }
            if (strNewsType == "5")
            {
                //5-申请反馈、
                sbSql.Append(" and (NewsType='申请情况' or NewsType='项目审核' or NewsType='经费预约反馈') AND Receive ='" + ((Model.USER_Users)Session["USER_Users"]).ID + "'");
                //  searchrtable.Visible = false;//搜索的功能不显示
            }
            if (strNewsType == "6")
            {
                //6-通知公告、
                sbSql.Append("and NewsType='通知公告' AND Receive ='" + ((Model.USER_Users)Session["USER_Users"]).ID + "'");
                // searchrtable.Visible = false;//搜索的功能不显示
            }
            if (strNewsType == "789")
            {
                //7-个人消息、
                sbSql.Append(" and (NewsType='个人消息' or  NewsType='项目消息' or  NewsType='部门消息') AND Receive ='" + ((Model.USER_Users)Session["USER_Users"]).ID + "'");
                //  searchrtable.Visible = false;//搜索的功能不显示
            }
            if (strNewsType == "10")
            {
                //10-历史消息、
                sbSql.Append(" ");
                mUserPower = (Model.userPower)Session["Session_Power"];
                if (Session["starttime_session"] == null)//没有搜索条件时
                {
                    if (mUserPower.specialRole.Contains("or"))
                    {
                        sbSql.Append(" and  (" + mUserPower.specialRole.ToString() + " or Receive='" + ((Model.USER_Users)Session["USER_Users"]).ID + "') ");
                    }
                    else
                    {
                        sbSql.Append(" AND Receive ='" + ((Model.USER_Users)Session["USER_Users"]).ID + "'");
                    }
                }
                //else//有搜索条件时
                //{
                //    DateTime starttimes = DateTime.Parse(Session["starttime_session"].ToString());
                //    DateTime endtimes = DateTime.Parse(Session["endtime_session"].ToString()).AddDays(1);
                //    if (mUserPower.specialRole.Contains("or"))
                //    {
                //        sbSql.Append(" and  (" + mUserPower.specialRole.ToString() + " or Receive='" + ((Model.USER_Users)Session["USER_Users"]).ID + "')  and DATETIME>='" + starttimes + "' and DATETIME<='" + endtimes + "'");
                //    }
                //    else
                //    {
                //        sbSql.Append(" AND Receive ='" + ((Model.USER_Users)Session["USER_Users"]).ID + "'  and DATETIME>='" + starttimes + "' and DATETIME<='" + endtimes + "'");
                //    }
                //}
            }

            if (isread == "0")
            {
                sbSql.Append("and isread='0'");
            }

            if (Session["starttime_session"] != null && DropDownList1.SelectedValue != "time")//有搜索条件时
            {
                DateTime starttimes = DateTime.Parse(Session["starttime_session"].ToString());
                DateTime endtimes   = DateTime.Parse(Session["endtime_session"].ToString()).AddDays(1);
                sbSql.Append("and DATETIME>='" + starttimes + "' and DATETIME<='" + endtimes + "'" + "and URLS like '%" + Keyword.Text + "%'");
                sbSql.Append("and DELFLAG=1");
            }
            else
            {
                sbSql.Append("and DELFLAG=0");
            }
            if (!string.IsNullOrEmpty(condition))
            {
                sbSql.Append(" and NewsType <> '" + condition + "'");
            }
            return(sbSql.ToString());
        }