예제 #1
0
        /// <summary>
        /// 初始化工作信息页面
        /// </summary>
        private void LoadDataGrid()
        {
            try
            {
                TaskExecuteStrategyBuilder sb = new TaskExecuteStrategyBuilder();

                sb.AddStrategy(new Strategy(DAL.QueryStrategy.TaskExecuteStrategyName.ProjectCode, this.txtProjectCode.Value));

                ArrayList arA = new ArrayList();
                arA.Add("070202");
                arA.Add(user.UserCode);
                arA.Add(user.BuildStationCodes());
                sb.AddStrategy(new Strategy(DAL.QueryStrategy.TaskExecuteStrategyName.AccessRange, arA));

                if (this.dtStartDate.Value.Length > 0 || this.dtEndDate.Value.Length > 0)
                {
                    ArrayList arB = new ArrayList();
                    arB.Add(this.dtStartDate.Value);
                    arB.Add(this.dtEndDate.Value);
                    sb.AddStrategy(new Strategy(DAL.QueryStrategy.TaskExecuteStrategyName.ExecuteDate, arB));
                }

                if (this.txtTitle.Value.Length > 0)
                {
                    sb.AddStrategy(new Strategy(DAL.QueryStrategy.TaskExecuteStrategyName.Detail, this.txtTitle.Value));
                }

                sb.AddOrder("ExecuteDate", false);

                string     sql = sb.BuildQueryViewString();
                QueryAgent qa  = new QueryAgent();

                EntityData entity = qa.FillEntityData("TaskExecute", sql);
                qa.Dispose();

                this.trNoExecute.Visible = !entity.HasRecord();

                this.dgList.DataSource = entity.CurrentTable;
                this.dgList.DataBind();
                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "初始化页面出错:" + ex.Message));
            }
        }
예제 #2
0
        /// <summary>
        /// 获取工作报告列表,分发范围之内的人都可以看到
        /// </summary>
        private void LoadExecute()
        {
            TaskExecuteStrategyBuilder asb = new TaskExecuteStrategyBuilder();
            ArrayList arA = new ArrayList();

            arA.Add("070202");
            arA.Add(user.UserCode);
            arA.Add(user.BuildStationCodes());
            asb.AddStrategy(new Strategy(DAL.QueryStrategy.TaskExecuteStrategyName.AccessRange, arA));
            asb.AddOrder("ExecuteDate", false);
            string     sql = asb.BuildMainQueryString();
            QueryAgent qa  = new QueryAgent();

            qa.SetTopNumber(this.intListExecuteNum);
            EntityData entityExecute = qa.FillEntityData("TaskExecute", sql);

            qa.Dispose();
            //EntityData entityExecute = WBSDAO.GetTaskExecuteDeskTop(((User)Session["User"]).UserCode);
            //EntityData entityWBS = null;
            if (entityExecute.HasRecord())
            {
                //点更多时,查看第1条所在项目
                this.imgOpenMoreTaskExecute.Attributes["ProjectCode"] = entityExecute.CurrentTable.Rows[0]["ProjectCode"].ToString();

                DataTable dtExecuteNew = entityExecute.CurrentTable;
                dtExecuteNew.Columns.Add("Img", System.Type.GetType("System.String"));
                dtExecuteNew.Columns.Add("TaskName", System.Type.GetType("System.String"));
                foreach (DataRow dr in dtExecuteNew.Rows)
                {
                    try
                    {
                        string     tmp       = dr["WBSCode"].ToString();
                        EntityData entityWBS = WBSDAO.GetV_TaskByCode(tmp);
                        if (entityWBS.HasRecord())
                        {
                            dr["WBSCode"]  = entityWBS.CurrentTable.Rows[0]["WBSCode"].ToString();
                            dr["TaskName"] = entityWBS.CurrentTable.Rows[0]["TaskName"].ToString();
                            string strName = entityWBS.CurrentTable.Rows[0]["TaskName"].ToString();
                            if (strName.Length > 8)
                            {
                                dr["TaskName"] = strName.Substring(0, 8) + "...";
                            }
                            if (entityWBS.CurrentTable.Rows[0]["ImportantLevel"].ToString() == "1")
                            {
                                dr["Img"] = "<img src=\"images/icon_important.gif\" width=\"17\" height=\"18\">";
                            }
                            string strTmp = dr["Detail"].ToString();
                            if (strTmp.Length > 8)
                            {
                                dr["Detail"] = Server.HtmlEncode(dr["Detail"].ToString().Substring(0, 8) + "...");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message + ":获取工作报告列表失败", ex);
                    }
                }
                DataView dv = dtExecuteNew.DefaultView;
                dv.Sort = "ExecuteDate desc";
                this.rpExecute.DataSource = dv;
                this.rpExecute.DataBind();
            }
            entityExecute.Dispose();
        }