예제 #1
0
        void bindDataToGrid(String subject,  String agentNo,String userId)
        {
            logger.Info("bindDataToGrid=");
            logger.Info("subject=" + subject);
           
           
            logger.Info("agentNo=" + agentNo);
            logger.Info("userId=" + userId);
            PolicyDao policyDao = new ChinaUnion_DataAccess.PolicyDao();

            IList<Policy> policyList = null;



            policyList = policyDao.GetAllList(subject,"案例分享");
             
          
            this.lblAgentNo.Text = agentNo;
            this.lblUserId.Text = userId;
            // int index = 1;
            DataTable dt = new DataTable();
            dt.Columns.Add("seq");
            dt.Columns.Add("userId");
            dt.Columns.Add("subject");
            dt.Columns.Add("content");
           // dt.Columns.Add("attachment");
          //  dt.Columns.Add("validateStartTime");
          //  dt.Columns.Add("validateEndTime");

            DataRow row = null;
            if (policyList != null && policyList.Count>0)
            {
                foreach (Policy policy in policyList)
                {
                    if (!policy.toAll.Equals("Y"))
                    {
                        IList<String> UserIdList = policyDao.GetAllAgentNoListBySeq(policy.sequence);
                        if (!UserIdList.Contains(userId))
                        {
                            logger.Info("userId=" + userId + " 没有权限范围" + policy.sequence);
                            continue;
                        }
                    }
                    row = dt.NewRow();
                    row["seq"] = policy.sequence;
                    row["userId"] = userId;
                    row["subject"] = policy.subject;
                    if (policy.content.Length > 20)
                    {
                        row["content"] =policy.subject+":"+ policy.content.Substring(0, 20) + "......";
                    }
                    else
                    {
                        row["content"] = policy.subject + ":" + policy.content;
                    }
                  
                    dt.Rows.Add(row);
                }
            }
            else
            {
                this.lblMessag.Text = "未找到"  + "记录!";
            }
            GridView1.DataSource = dt.DefaultView;
            GridView1.DataBind();
        }
예제 #2
0
        void bindDataToGrid(String subject, String type, String search_scope, String agentNo,String userId)
        {
            logger.Info("bindDataToGrid=");
            logger.Info("subject=" + subject);
            logger.Info("type=" + type);
            logger.Info("search_scope=" + search_scope);
            logger.Info("agentNo=" + agentNo);
            logger.Info("userId=" + userId);
            PolicyDao policyDao = new ChinaUnion_DataAccess.PolicyDao();

            IList<Policy> policyList = null;

            if (!String.IsNullOrEmpty(search_scope) && search_scope.Equals("validate"))
            {
                policyList = policyDao.GetAllValidatedList(subject, type);
                logger.Info("validate=");
            }


            if (!String.IsNullOrEmpty(search_scope) && search_scope.Equals("all"))
            {
                policyList = policyDao.GetList(subject, type);
                logger.Info("all=");
            }
            this.lblType.Text = type;
            this.lblScope.Text = search_scope;
            this.lblAgentNo.Text = agentNo;
            this.lblUserId.Text = userId;
            // int index = 1;
            DataTable dt = new DataTable();
            dt.Columns.Add("seq");
            dt.Columns.Add("userId");
            dt.Columns.Add("subject");
            dt.Columns.Add("content");
            dt.Columns.Add("attachment");
            dt.Columns.Add("validateStartTime");
            dt.Columns.Add("validateEndTime");

            DataRow row = null;
            if (policyList != null && policyList.Count>0)
            {
                foreach (Policy policy in policyList)
                {
                    if (!policy.toAll.Equals("Y"))
                    {
                        AgentWechatAccountDao agentWechatAccountDao = new AgentWechatAccountDao();
                        AgentWechatAccount agentWechatAccount = agentWechatAccountDao.Get(userId);

                        if (!String.IsNullOrEmpty(policy.agentType) )
                        {
                              IList<String> list = policy.agentType.Split(';').ToList<String>();
                              if (!list.Contains(agentWechatAccount.type))
                              {
                                  continue;
                              }
                        }
                        if (String.IsNullOrEmpty(policy.agentType))
                        {
                            IList<String> agentNoList = policyDao.GetAllAgentNoListBySeq(policy.sequence);
                            if (!agentNoList.Contains(agentNo))
                            {
                                logger.Info("userId=" + userId + " 没有权限范围" + policy.sequence);
                                continue;
                            }
                        }
                    }
                    row = dt.NewRow();
                    row["seq"] = policy.sequence;
                    row["userId"] = userId;
                    row["subject"] = policy.subject;
                    if (policy.content.Length > 10)
                    {
                        row["content"] = policy.content.Substring(0, 10) + "......";
                    }
                    else
                    {
                        row["content"] = policy.content;
                    }
                    if (!String.IsNullOrEmpty(policy.attachmentName))
                    {
                        row["attachment"] = "附件";
                    }
                    row["validateStartTime"] = policy.validateStartTime;
                    row["validateEndTime"] = policy.validateEndTime;
                    dt.Rows.Add(row);
                }
            }
            else
            {
                this.lblMessag.Text = "未找到" + type + "记录!";
            }
            GridView1.DataSource = dt.DefaultView;
            GridView1.DataBind();
        }