Ejemplo n.º 1
0
        /// <summary>
        /// 验证用户是否拥有删除权限
        /// </summary>
        /// <returns></returns>
        public bool CheckUserDtl(string NoticCode)
        {
            //string stationcode      = "";
            //string RoleCode         = "";
            string OperationCode = "";

            try
            {
                QueryAgent qa = new QueryAgent();

                DAL.QueryStrategy.RoleOperation sb = new RmsPM.DAL.QueryStrategy.RoleOperation();
                sb.AddStrategy(new Strategy(RoleOperationName.UserCode, user.UserCode));
                //sb.AddStrategy(new Strategy( RoleOperationName.UserCode,"080102"));
                string  sql = sb.BuildMainQueryString();
                DataSet Ds  = qa.ExecSqlForDataSet(sql);
                for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
                {
                    if (Ds.Tables[0].Rows[i]["OperationCode"].ToString() == "080103")
                    {
                        OperationCode += Ds.Tables[0].Rows[i]["OperationCode"].ToString();
                        return(true);
                    }
                }
                qa.Dispose();
                return(false);
            }
            catch (System.Exception EC)
            {
                //System.Console.Write(EC.Message);
                string h = EC.Message;
                return(false);
            }
        }
Ejemplo n.º 2
0
    public void InitPage()
    {
        //对通知标题的个性化判断
        if (this.up_sPMNameLower != "tianyangoa")
        {
            this.trNotice.Visible = false;
        }
        else
        {
            this.trNotice.Visible = true;
        }

        strNoticeCode = Request.QueryString["Code"] + "";

        // 载入附件
        this.myAttachMentAdd.AttachMentType = "NoticeAttachMent";
        this.myAttachMentAdd.MasterCode     = strNoticeCode;

        FeedBack1.FeedBackType = "Notice";
        FeedBack1.MasterCode   = this.strNoticeCode;


        try
        {
            User       myUser = new User(user.UserCode);
            QueryAgent qa     = new QueryAgent();
            RmsPM.DAL.QueryStrategy.RoleOperation sb = new RmsPM.DAL.QueryStrategy.RoleOperation();
            sb.AddStrategy(new Strategy(RoleOperationName.UserCode, user.UserCode));
            //sb.AddStrategy(new Strategy( RoleOperationName.UserCode,"080102"));
            string  sql        = sb.BuildMainQueryString();
            DataSet Ds         = qa.ExecSqlForDataSet(sql);
            string  str_Edit   = "";
            string  str_Delete = "";
            for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
            {
                if (Ds.Tables[0].Rows[i][1].ToString() == "080102")
                {
                    str_Edit = Ds.Tables[0].Rows[i][1].ToString();
                }
                if (Ds.Tables[0].Rows[i][1].ToString() == "080103")
                {
                    str_Delete = Ds.Tables[0].Rows[i][1].ToString();
                }
            }

            //判断是否拥有删除权限
            if (!user.HasRight("080103"))
            {
                this.btDelete.Visible = false;
            }
            else
            {
                this.btDelete.Visible = true;
            }
        }
        catch (Exception dd)
        {
            string h = dd.Message.ToString();
            string f = h;
        }
    }
Ejemplo n.º 3
0
        private void InitPage()
        {
            strAction          = Request.QueryString["Action"] + "";
            this.strNoticeCode = Request.QueryString["Code"] + "";

            this.myAttachMentAdd.AttachMentType = "NoticeAttachMent";
            this.myAttachMentAdd.MasterCode     = this.strNoticeCode;
            if (this.strAction == "Modify")
            {
                // 在此检查是否有权限修改// 080102为通知修改权限
                User myUser = new User(user.UserCode);
                //if(!myUser.HasResourceRight(this.strNoticeCode,"080102"))
                //Server.Transfer("../Remind/NoticeInfo.aspx?&Code="+this.strNoticeCode);

                //this.btDelete.Visible = myUser.HasOperationRight("080103");// 080103为通知删除权限
                try
                {
                    QueryAgent qa = new QueryAgent();
                    DAL.QueryStrategy.RoleOperation sb = new RmsPM.DAL.QueryStrategy.RoleOperation();
                    sb.AddStrategy(new Strategy(RoleOperationName.UserCode, user.UserCode));
                    //sb.AddStrategy(new Strategy( RoleOperationName.UserCode,"080102"));
                    string  sql        = sb.BuildMainQueryString();
                    DataSet Ds         = qa.ExecSqlForDataSet(sql);
                    string  str_Edit   = "";
                    string  str_Delete = "";
                    for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
                    {
                        if (Ds.Tables[0].Rows[i][1].ToString() == "080102")
                        {
                            str_Edit = Ds.Tables[0].Rows[i][1].ToString();
                        }
                        if (Ds.Tables[0].Rows[i][1].ToString() == "080103")
                        {
                            str_Delete = Ds.Tables[0].Rows[i][1].ToString();
                        }
                    }
                    // if (str_Edit == "" && !myUser.HasResourceRight(this.strNoticeCode, "080102"))
                    //{
                    Server.Transfer("../Remind/NoticeInfo.aspx?&Code=" + this.strNoticeCode + "&Action=" + strAction);
                    //}
                    //else
                    //{
                    //  Server.Transfer("../Remind/noticeupdateinfo.aspx?&Code=" + this.strNoticeCode);
                    //}
                    //if (str_Delete == "" && !myUser.HasResourceRight(this.strNoticeCode, "080103"))
                    //{
                    //    this.btDelete.Visible = myUser.HasOperationRight("080103");// 080103为通知删除权限
                    //    this.btDelete.Visible = false;
                    //}
                    //else
                    //{
                    //    this.btDelete.Visible = true;
                    //}
                }
                catch (Exception dd)
                {
                    string h = dd.Message.ToString();
                    string f = h;
                }
            }
            else
            {
                this.btDelete.Visible = false;
            }
            string tmp = this.txtUsers.Value;
        }