Esempio n. 1
0
        private void LoadData()
        {
            if (this.strStatus == "Retart" && !this.IsPostBack)
            {
                WBSStrategyBuilder asb = new WBSStrategyBuilder();
                ArrayList          arA = new ArrayList();
                arA.Add("070107");
                arA.Add(base.user.UserCode);
                asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.AccessRange, arA));
                asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.ProjectCode, (string)ViewState["ProjectCode"]));
                asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.ParentCode, this.strWBSCode));
                asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.PreStatusNot, "5"));                 // 取得的是暂停前未开始和开始项
                asb.AddOrder(" PlannedStartDate ", false);
                string     sql    = asb.BuildMainQueryString();
                QueryAgent qa     = new QueryAgent();
                EntityData dsTask = qa.FillEntityData("Task", sql);
                qa.Dispose();
                this.dgTaskList.DataSource = (dsTask.Tables[0].Rows.Count > 0)?DisposeTask(dsTask.CurrentTable):null;
                this.dgTaskList.DataBind();

                if (dsTask.CurrentTable.Rows.Count > 0)
                {
                    this.lblTask.Text      = "工作项";
                    this.lblNoTask.Visible = false;
                }
                else
                {
                    this.divTask.Visible = false;
                    this.lblNoTask.Text  = "没有需要继续的子项工作,可以继续本项工作";
                }
            }
        }
Esempio n. 2
0
        private void LoadUnderWay()
        {
            WBSStrategyBuilder asb = new WBSStrategyBuilder();
            ArrayList          arA = new ArrayList();

            arA.Add("070107");
            arA.Add(user.UserCode);
            asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.AccessRange, arA));
            asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.Status, "1"));
            asb.AddOrder(" PlannedStartDate ", false);
            string     sql = asb.BuildQueryDeskTopString();
            QueryAgent QA  = new QueryAgent();

            QA.SetTopNumber(this.intListUnderwayNum);
            DataSet dsUnderWay = QA.ExecSqlForDataSet(sql);

            QA.Dispose();
            DataTable dt = dsUnderWay.Tables[0];

            dt.Columns.Add("Img", System.Type.GetType("System.String"));
            dt.Columns.Add("StatusName", System.Type.GetType("System.String"));
            dt.Columns.Add("Master", System.Type.GetType("System.String"));
            EntityData entityUser = new EntityData("TaskPerson");

            if (dt.Rows.Count > 0)
            {
                //点更多时,查看第1条所在项目
                this.imgOpenMoreUnderWayTask.Attributes["ProjectCode"] = dt.Rows[0]["ProjectCode"].ToString();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["ImportantLevel"].ToString() == "1")
                    {
                        dt.Rows[i]["Img"] = "<img src=\"images/icon_important.gif\" width=\"17\" height=\"18\">";
                    }
                    dt.Rows[i]["StatusName"] = BLL.ComSource.GetTaskStatusName(dt.Rows[i]["Status"].ToString());
                    entityUser = WBSDAO.GetTaskPersonByWBSCode(dt.Rows[i]["WBSCode"].ToString());
                    string strTUser = "";// 取得当前任务负责人
                    for (int j = 0; j < entityUser.CurrentTable.Rows.Count; j++)
                    {
                        if (entityUser.CurrentTable.Rows[j]["Type"].ToString() == "2") // 负责
                        {
                            strTUser += (strTUser == "") ? "" : ",";
                            strTUser += BLL.SystemRule.GetUserName(entityUser.CurrentTable.Rows[j]["UserCode"].ToString());
                        }
                    }                   //strTUser.Substring(0,strTUser.Length-1)
                    dt.Rows[i]["Master"] = (strTUser.Length > 0) ? strTUser.Substring(0, strTUser.Length - 1) : "";
                }
            }

            this.rpUnderWay.DataSource = dsUnderWay;
            this.rpUnderWay.DataBind();
            dsUnderWay.Dispose();
        }
Esempio n. 3
0
        private void LoadData()
        {
            if (!this.IsPostBack)
            {
                //初始化“合同类型”下拉框
                int StatusIndex = this.SelectStatus.SelectedIndex;
                this.SelectStatus.Items.Add(new ListItem("未开始", "0"));
                this.SelectStatus.Items.Add(new ListItem("进行中", "1"));
                this.SelectStatus.Items.Add(new ListItem("暂停", "2"));
                this.SelectStatus.Items.Add(new ListItem("中断", "3"));
                this.SelectStatus.Items.Add(new ListItem("继续", "4"));
                this.SelectStatus.SelectedIndex = StatusIndex;
            }
            //初始化符合条件的数据列表
            string TaskName              = "";
            string Master                = "";
            string PlannedStartFromDate  = "";
            string PlannedStartToDate    = "";
            string PlannedFinishFromDate = "";
            string PlannedFinishToDate   = "";
            string Status;

            if (this.txtTaskName.Value.Trim() != "")
            {
                TaskName = this.txtTaskName.Value.Trim();
            }
            if (this.txtMaster.Value.Trim() != "")
            {
                Master = this.txtMaster.Value.Trim();
            }
            Status = this.SelectStatus.Value;
            PlannedStartFromDate  = this.dtbPlannedStartFromDate.Value;
            PlannedStartToDate    = this.dtbPlannedStartToDate.Value;
            PlannedFinishFromDate = this.dtbPlannedFinishFromDate.Value;
            PlannedFinishToDate   = this.dtbPlannedFinishToDate.Value;

            try
            {
                WBSStrategyBuilder WSB = new WBSStrategyBuilder();
                ArrayList          arA = new ArrayList();
                arA.Add("070107");
                arA.Add(user.UserCode);
                WSB.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.AccessRange, arA));
                WSB.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.ProjectCode, (string)ViewState["ProjectCode"]));
                if (TaskName.Length > 0)
                {
                    WSB.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.WBSStrategyName.TaskName, TaskName));
                }
                if (Master.Length > 0)
                {
                    WSB.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.WBSStrategyName.Master, Master));
                }
                if (Status.Length > 0)
                {
                    WSB.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.WBSStrategyName.Status, Status));
                }
                if (PlannedStartFromDate.Length > 0 || PlannedStartToDate.Length > 0)
                {
                    ArrayList arParam = new ArrayList();
                    arParam.Add(PlannedStartFromDate);
                    arParam.Add(PlannedStartToDate);

                    WSB.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.WBSStrategyName.PlannedStartDate, arParam));
                }
                if (PlannedFinishFromDate.Length > 0 || PlannedFinishToDate.Length > 0)
                {
                    ArrayList arParam = new ArrayList();
                    arParam.Add(PlannedFinishFromDate);
                    arParam.Add(PlannedFinishToDate);

                    WSB.AddStrategy(new Strategy(RmsPM.DAL.QueryStrategy.WBSStrategyName.PlannedFinishDate, arParam));
                }
                WSB.AddOrder("PlannedStartDate", false);
                string     Sql = WSB.BuildMainQueryString();
                QueryAgent QA  = new QueryAgent();
                DataSet    ds  = QA.ExecSqlForDataSet(Sql);
                QA.Dispose();

//				string WBSCode = Request["WBSCode"] + "";// 新权限不需过虑了   1.25
//				string strRowFilter = (WBSCode == "")?" Flag = 0 ":" FullCode NOT LIKE '*" + WBSCode + "*' ";
//				DataView dv = new DataView(ds.Tables[0],strRowFilter,"Deep",DataViewRowState.CurrentRows);
                DataView dv = new DataView(ds.Tables[0], "", "Deep", DataViewRowState.CurrentRows);

                dv.Table.Columns.Add("myTaskName", System.Type.GetType("System.String"));
                dv.Table.Columns.Add("StatusName", System.Type.GetType("System.String"));
                dv.Table.Columns.Add("Master", System.Type.GetType("System.String"));
                EntityData entityUser = new EntityData("TaskPerson");
                foreach (DataRowView drv in dv)
                {
                    drv["StatusName"] = BLL.ComSource.GetTaskStatusName(drv["Status"].ToString());
                    drv["myTaskName"] = this.GetStatusImg(drv["Status"].ToString()) + "&nbsp;" + drv["SortID"].ToString() + "&nbsp;" + drv["TaskName"].ToString();
                    entityUser        = WBSDAO.GetTaskPersonByWBSCode(drv["WBSCode"].ToString());
                    string strTUser = "";                    // 取得当前任务负责人
                    for (int j = 0; j < entityUser.CurrentTable.Rows.Count; j++)
                    {
                        if (entityUser.CurrentTable.Rows[j]["Type"].ToString() == "2")                         // 负责
                        {
                            strTUser += (strTUser == "")?"":",";
                            strTUser  = BLL.SystemRule.GetUserName(entityUser.CurrentTable.Rows[j]["UserCode"].ToString());
                        }
                    }
                    drv["Master"] = strTUser;
                }
                this.dgTaskList.DataSource = dv;
                this.dgTaskList.DataBind();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "载入工作项列表失败");
            }
        }
Esempio n. 4
0
        private string[] m_arrHasRightFullCode;         //有权限的工作项

//		private DataTable m_tbHasRightFullCode = null;

        protected void Page_Load(object sender, System.EventArgs e)
        {
            string m_strGetType = Request.QueryString["GetType"] + "";                          //数据分类
            string m_strLayer   = Request.QueryString["Layer"] + "";                            //需要取的层数

            m_strNodeId = Request.QueryString["NodeId"] + "";                                   //父节点编号
            string[] m_Layers           = (Request.QueryString["Layers"] + "").Split('.');      //定点展开的序列
            string   m_strSelectedLayer = Request.QueryString["SelectedLayer"] + "";            //定层展开的深度

            ViewState["ProjectCode"] = Request["ProjectCode"].ToString();

            try
            {
                DataTable m_Table = new DataTable("Task");
                m_Table.Columns.Add("WBSCode");
                m_Table.Columns.Add("ParentCode");
                m_Table.Columns.Add("TaskName");
                m_Table.Columns.Add("SortID");
                m_Table.Columns.Add("Layer");
                m_Table.Columns.Add("ChildNodesCount");
                m_Table.Columns.Add("ShowChildNodes");
                m_Table.Columns.Add("WorkStartDate");
                m_Table.Columns.Add("WorkActualStartDate");
                m_Table.Columns.Add("WorkActualFinishDate");
                m_Table.Columns.Add("WorkDays");
                m_Table.Columns.Add("OverDays");
                m_Table.Columns.Add("NodeType");
                m_Table.Columns.Add("Status");
                m_Table.Columns.Add("Remark");
                m_Table.Columns.Add("TaskStatus");
                m_Table.Columns.Add("Exceed");
                m_Table.Columns.Add("ImportantLevel");
                m_Table.Columns.Add("Flag");
                m_Table.Columns.Add("WorkEndDate");
                m_Table.Columns.Add("CompletePercent");
                m_Table.Columns.Add("PauseReason");
                m_Table.Columns.Add("CancelReason");
                m_Table.Columns.Add("FullCode");
                m_Table.Columns.Add("IsRight");
                m_Table.Columns.Add("LastModifyDate");

                WBSStrategyBuilder asb = new WBSStrategyBuilder();
                asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.ProjectCode, (string)ViewState["ProjectCode"]));

                switch (m_strGetType)
                {
                case "SingleNode":                          //单个结点
                    asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.WBSCode, m_strNodeId));
                    break;

                default:                          //子结点
                    asb.AddStrategy(new Strategy(DAL.QueryStrategy.WBSStrategyName.ParentCode, m_strNodeId));
                    break;
                }

//				asb.AddOrder(" Deep ",true);
                asb.AddOrder(" PlannedStartDate ", false);
                asb.AddOrder(" SortID ", true);

                string     sql     = asb.BuildMainQueryString();
                QueryAgent qa      = new QueryAgent();
                EntityData m_Task1 = qa.FillEntityData("Task", sql);

                DataTable m_DataTable = m_Task1.CurrentTable;

                m_arrHasRightFullCode = BLL.WBSRule.GetAllHasRightTask(Session, user.UserCode);

                if (m_strGetType == "")
                {
                    #region 取第一层
                    DataView m_DV = new DataView(m_DataTable, "ParentCode='' ", "", DataViewRowState.CurrentRows);
                    foreach (DataRowView m_Row in m_DV)
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, m_Row);

                        m_Table.Rows.Add(m_NewRow);
                    }
                    #endregion
                }
                else if (m_strGetType == "ChildNodes")
                {
                    #region 取某节点子目录
                    DataView m_DV = new DataView(m_DataTable, "ParentCode='" + m_strNodeId + "'", "", DataViewRowState.CurrentRows);
                    foreach (DataRowView m_Row in m_DV)
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, m_Row);

                        m_Table.Rows.Add(m_NewRow);
                    }
                    #endregion
                }
                else if (m_strGetType == "SelectLayer")
                {
                    #region 取制定层数结果
                    DataView m_DV = new DataView(m_DataTable, "Deep='1'", "", DataViewRowState.CurrentRows);
                    foreach (DataRowView m_Row in m_DV)
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, m_Row);

                        m_Table.Rows.Add(m_NewRow);
                        if (int.Parse(m_strSelectedLayer) > 1)
                        {
                            m_NewRow["ShowChildNodes"] = "1";
                            //this.FillSelectedLayerData(ref m_Table,m_Row["SortID"].ToString(),2,int.Parse(m_strSelectedLayer),m_DataTable); 原来传递是SortID
                            this.FillSelectedLayerData(ref m_Table, m_Row["WBSCode"].ToString(), 2, int.Parse(m_strSelectedLayer), m_DataTable);
                        }
                    }
                    #endregion
                }
                else if (m_strGetType == "All")
                {
                    #region 取所有结果
                    DataView m_DV = new DataView(m_DataTable, "ParentCode='1'", "", DataViewRowState.CurrentRows);
                    foreach (DataRowView m_Row in m_DV)
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, m_Row);

                        m_Table.Rows.Add(m_NewRow);

                        if (int.Parse(m_NewRow["ChildNodesCount"].ToString()) > 0)
                        {
                            m_NewRow["ShowChildNodes"] = "1";
                            //this.FillAllData(ref m_Table,m_Row["SortID"].ToString(),2,m_DataTable);原来传递是SortID
                            this.FillAllData(ref m_Table, m_Row["WBSCode"].ToString(), 2, m_DataTable);
                        }
                    }
                    #endregion
                }
                else if (m_strGetType == "SingleNode")
                {
                    #region 单个节点
                    DataView m_DV = new DataView(m_DataTable, "WBSCode='" + m_strNodeId + "'", "", DataViewRowState.CurrentRows);
                    foreach (DataRowView m_Row in m_DV)
                    {
                        DataRow m_NewRow = m_Table.NewRow();

                        this.FillRow(ref m_NewRow, m_Row);

                        m_Table.Rows.Add(m_NewRow);
                    }
                    #endregion
                }

                string m_strCondition = "";
                if (Request.QueryString["TaskName"] + "" != "")
                {
                    m_strCondition += (m_strCondition == ""?"":" and ");
                    m_strCondition += " ((TaskName LIKE '*" + Server.UrlDecode(Request.QueryString["TaskName"]).ToString().Trim() + "*') OR ";
                    m_strCondition += "(WBSCode like '%" + Request.QueryString["TaskName"].Trim() + "%')) ";
                }
                if (Request.QueryString["Master"] + "" != "")
                {
                    m_strCondition += (m_strCondition == ""?"":" and ");
                    m_strCondition += " Master LIKE '*" + Server.UrlDecode(Request.QueryString["Master"]).ToString().Trim() + "*'";
                }
                if (Request.QueryString["Status"] + "" != "")
                {
                    m_strCondition += (m_strCondition == ""?"":" and ");
                    m_strCondition += "TaskStatus='" + Request.QueryString["Status"].Trim() + "'";
                }
                if (Request.QueryString["ImportantLevel"] + "" != "")
                {
                    m_strCondition += (m_strCondition == ""?"":" and ");
                    m_strCondition += "ImportantLevel='" + Request.QueryString["ImportantLevel"].Trim() + "'";
                }
                if (Request.QueryString["Exceed"] + "" != "")
                {
                    m_strCondition += (m_strCondition == ""?"":" and ");
                    m_strCondition += "Exceed='" + Request.QueryString["Exceed"].Trim() + "'";
                }
                if (Request.QueryString["StartDate"] + "" != "")
                {
                    m_strCondition += (m_strCondition == ""?"":" and ");
                    m_strCondition += "CONVERT(WorkStartDate,'System.DateTime')>='" + Request.QueryString["StartDate"] + "'";
                }
                if (Request.QueryString["EndDate"] + "" != "")
                {
                    m_strCondition += (m_strCondition == ""?"":" and ");
                    m_strCondition += "CONVERT(WorkStartDate,'System.DateTime')<'" + Request.QueryString["EndDate"] + "'";
                }

                if (m_strCondition != "")
                {
                    m_strCondition = "((" + m_strCondition + ") or ParentCode = '')";
                }


                //按其他条件过滤
                DataView  m_DataView = new DataView(m_Table, m_strCondition, "Layer,SortID", DataViewRowState.CurrentRows);
                DataTable tbNew      = m_Table.Clone();
                foreach (DataRowView drv in m_DataView)
                {
                    DataRow drNew = tbNew.NewRow();

                    foreach (DataColumn col in tbNew.Columns)
                    {
                        drNew[col.ColumnName] = drv[col.ColumnName];
                    }

                    tbNew.Rows.Add(drNew);
                }

                m_Task1.Dispose();

                TaskProc(tbNew);

                //删除没有权限的节点
                BLL.WBSRule.DeleteNoRightTask(tbNew, m_arrHasRightFullCode);

                Response.Write(RmsPM.WebControls.TreeView.XmlTree.GetDataToXmlString(tbNew));
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "WBSData文件");
            }

            Response.End();
        }