Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            A_ChargeProgres ent = null;

            switch (RequestActionString)
            {
            case "delete":
                ent = this.GetTargetData <A_ChargeProgres>();
                ent.DoDelete();
                break;

            case "batchdelete":
                DoBatchDelete();
                break;

            case "charge":
                A_TaskWBS[] charges = A_TaskWBS.FindAll(Expression.Eq(A_TaskWBS.Prop_ParentID, this.RequestData.Get <string>("TaskId")), Expression.Not(Expression.Eq(A_TaskWBS.Prop_State, "2")));
                if (charges.Length > 0)
                {
                    PageState.Add("Finish", "false");
                }
                else
                {
                    PageState.Add("Finish", "true");
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Пример #2
0
        private void DoBatchDelete()
        {
            IList <object> idList = RequestData.GetList <object>("IdList");

            if (idList != null && idList.Count > 0)
            {
                A_TaskWBS.DoBatchDelete(idList.ToArray());
            }
        }
        private void CalculateRates(A_TaskWBS task)
        {
            string path = task.Path;

            string[] paths = path.Split('.').Reverse().ToArray();
            foreach (string ph in paths)
            {
                string sql = @"update a_taskwbs set taskProgress=(select round(sum(taskProgress*balance)/100,0) from 
a_taskwbs where ParentId='{0}' ) where Id='{0}'";
                DataHelper.ExecSql(string.Format(sql, ph), DataHelper.GetCurrentDbConnection(typeof(A_TaskAttachment)));
            }
        }
 /// <summary>
 /// 查询
 /// </summary>
 private void DoSelect()
 {
     if (!string.IsNullOrEmpty(this.RequestData.Get <string>("TaskId")))
     {
         this.PageState.Add("TaskModel", A_TaskWBS.Find(this.RequestData.Get <string>("TaskId")));
         ents = A_TaskAttachment.FindAll(SearchCriterion, Expression.Eq(A_TaskAttachment.Prop_TaskId, this.RequestData.Get <string>("TaskId")));
     }
     else
     {
         ents = A_TaskAttachment.FindAll(SearchCriterion);
     }
     this.PageState.Add("A_TaskAttachmentList", ents);
 }
Пример #5
0
 /// <summary>
 /// 查询
 /// </summary>
 private void DoSelect()
 {
     if (!string.IsNullOrEmpty(this.RequestData.Get <string>("ParentId")))
     {
         ents = A_TaskWBS.FindAll(SearchCriterion, Expression.Eq(A_TaskWBS.Prop_ParentID, this.RequestData.Get <string>("ParentId")));
         this.PageState.Add("TaskParent", A_TaskWBS.Find(this.RequestData.Get <string>("ParentId")));
     }
     else
     {
         ents = A_TaskWBS.FindAll(SearchCriterion);
     }
     this.PageState.Add("A_TaskWBSList", ents);
 }
        public void StartFlow()
        {
            ArrayList array   = new ArrayList();
            string    formUrl = "/Task/A_TaskWBSEdit.aspx?op=r&InFlow=T&id=" + id;
            Guid      guid    = WorkFlow.StartWorkFlow(id, formUrl, "任务审批", "AimFinishAudit", UserInfo.UserID, UserInfo.Name);
            A_TaskWBS ptEnt   = A_TaskWBS.TryFind(twEnt.ParentID); //获取到上级任务责任人

            if (ptEnt != null)
            {
                array.Add(guid + "#" + ptEnt.DutyId + "$" + ptEnt.DutyName);
                PageState.Add("WorkFlowInfo", array);
                twEnt.State = "1.5";
                twEnt.Update();
            }
        }
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            WorkTimeFact ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <WorkTimeFact>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <WorkTimeFact>();

                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <WorkTimeFact>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = WorkTimeFact.Find(id);
                }

                this.SetFormData(ent);
            }
            else
            {
                if (this.RequestData.Get <string>("TaskId") != null)
                {
                    this.PageState.Add("TaskModel", A_TaskWBS.Find(this.RequestData.Get <string>("TaskId")));
                }
            }
        }
Пример #8
0
 private void DoSelect()
 {
     if (!SearchCriterion.Orders.Exists(ent => ent.PropertyName == A_ChargeProgres.Prop_CreateTime))
     {
         SearchCriterion.Orders.Add(new OrderCriterionItem(A_ChargeProgres.Prop_CreateTime, false));
     }
     if (!string.IsNullOrEmpty(this.RequestData.Get <string>("TaskId")))
     {
         this.PageState.Add("TaskModel", A_TaskWBS.Find(this.RequestData.Get <string>("TaskId")));
         ents = A_ChargeProgres.FindAll(SearchCriterion, Expression.Eq(A_ChargeProgres.Prop_TaskId, this.RequestData.Get <string>("TaskId")));
     }
     else
     {
         ents = A_ChargeProgres.FindAll(SearchCriterion);
     }
     PageState.Add("A_ChargeProgresList", ents);
 }
Пример #9
0
        private void DoPaste()
        {
            IList <string> idList  = RequestData.GetList <string>("IdList");
            string         type    = RequestData.Get <string>("type", String.Empty);
            string         tid     = RequestData.Get <string>("tid", String.Empty);     // 目标节点id
            string         pdstype = RequestData.Get <string>("pdstype", String.Empty); // 粘贴数据来源类型

            if (!String.IsNullOrEmpty(tid))
            {
                A_TaskWBS target = A_TaskWBS.Find(tid);

                PasteDataSourceEnum pdsenum = PasteDataSourceEnum.Unknown;
                PasteAsEnum         paenum  = PasteAsEnum.Other;

                if (pdstype == "cut")
                {
                    pdsenum = PasteDataSourceEnum.Cut;
                }
                else if (pdstype == "copy")
                {
                    pdsenum = PasteDataSourceEnum.Copy;
                }

                if (type == "sib")
                {
                    paenum = PasteAsEnum.Sibling;
                }
                else if (type == "sub")
                {
                    paenum = PasteAsEnum.Child;
                }

                if (pdsenum != PasteDataSourceEnum.Unknown && paenum != PasteAsEnum.Other)
                {
                    // 粘贴操作
                    A_TaskWBS.DoPaste(pdsenum, paenum, tid, idList.ToArray());
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            V_TaskWBS ent = null;

            id = RequestData.Get <string>("id");
            if (!string.IsNullOrEmpty(id))
            {
                twEnt = A_TaskWBS.Find(id);
            }
            switch (RequestActionString)
            {
            case "delete":
                ent = this.GetTargetData <V_TaskWBS>();
                ent.Delete();
                break;

            case "batchdelete":
                idList = RequestData.GetList <object>("IdList");
                break;

            case "submit":
                StartFlow();
                break;

            case "AutoExecuteFlow":
                AutoExecuteFlow();
                break;

            case "SignFinish":
                twEnt.State = "2";
                twEnt.Update();
                break;

            default:
                DoSelect();
                break;
            }
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            A_TaskWBS ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <A_TaskWBS>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    DoBatchDelete();
                }
                else
                {
                    DoSelect();
                }
                break;
            }
        }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            A_TaskWBS ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <A_TaskWBS>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");

                    if (idList != null && idList.Count > 0)
                    {
                        A_TaskWBS.DoBatchDelete(idList.ToArray());
                    }
                }
                else
                {
                    SearchCriterion.SetSearch("DutyId", this.UserInfo.UserID);
                    SearchCriterion.SetOrder("SubmitDate", false);
                    string dateFlag = this.RequestData["Date"] == null ? "180" : this.RequestData["Date"].ToString();
                    switch (dateFlag)
                    {
                    case "3":
                        SearchCriterion.SetSearch("SubmitDate", DateTime.Now.AddDays(-3), SearchModeEnum.GreaterThanEqual);
                        break;

                    case "7":
                        SearchCriterion.SetSearch("SubmitDate", DateTime.Now.AddDays(-7), SearchModeEnum.GreaterThanEqual);
                        break;

                    case "14":
                        SearchCriterion.SetSearch("SubmitDate", DateTime.Now.AddDays(-14), SearchModeEnum.GreaterThanEqual);
                        break;

                    case "30":
                        SearchCriterion.SetSearch("SubmitDate", DateTime.Now.AddMonths(-1), SearchModeEnum.GreaterThanEqual);
                        break;

                    case "31":
                        SearchCriterion.SetSearch("SubmitDate", DateTime.Now.AddMonths(-1), SearchModeEnum.LessThanEqual);
                        break;

                    case "180":
                        SearchCriterion.SetSearch("SubmitDate", DateTime.Now.AddMonths(3), SearchModeEnum.LessThanEqual);
                        break;
                    }
                    if (this.RequestData.Get <string>("Status") == "0")
                    {
                        ents = A_TaskWBS.FindAll(SearchCriterion, Expression.IsNull("Tag"));
                    }
                    else
                    {
                        ents = A_TaskWBS.FindAll(SearchCriterion, Expression.IsNotNull("Tag"));
                    }
                    this.PageState.Add("SysWorkFlowTaskList", ents);
                }
                break;
            }
        }
Пример #13
0
        private void DoSelect()
        {
            SearchCriterion sc = new HqlSearchCriterion(); // 构建查询表达式

            sc.SetOrder("SortIndex");
            sc.SetOrder("Code");
            ICriterion crit = null;

            if (RequestActionString == "querychildren")
            {
                if (ids != null && ids.Count > 0 || pids != null && pids.Count > 0)
                {
                    if (ids != null && ids.Count > 0)
                    {
                        IEnumerable <string> distids = ids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));
                        crit = Expression.In(A_TaskWBS.Prop_Id, distids.ToArray());
                    }
                    if (pids != null && pids.Count > 0)
                    {
                        IEnumerable <string> dispids = pids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));

                        if (crit != null)
                        {
                            crit = SearchHelper.UnionCriterions(crit, Expression.In(A_TaskWBS.Prop_ParentID, dispids.ToArray()));
                        }
                        else
                        {
                            crit = Expression.In(A_TaskWBS.Prop_ParentID, dispids.ToArray());
                            string pid = dispids.ToArray()[0];
                            if (pid == "1437f360-6937-409b-9548-964661e6c27c")
                            {
                                string test = pid;
                            }
                            //不是自己责任人的只能看到属于自己的(暂时屏蔽掉,有权限看到自己的子节点)

                            /*if (A_TaskWBS.Find(pid).DutyId.IndexOf(this.UserInfo.UserID) < 0)
                             * {
                             *  //判断是否父节点有权限,有全部输出
                             *  //A_TaskWBS tp = A_TaskWBS.Find(pid);
                             *  string sqlall = " select Id,Path from " + db + "..A_TaskWBS where DutyId like '%" + this.UserInfo.UserID + "%'";
                             *  DataTable dtall = DataHelper.QueryDataTable(sqlall);
                             *  string checksql = "select Id from " + db + "..A_TaskWBS where ParentId='" + pid + "' and ";
                             *  string rules = "";
                             *  foreach (DataRow row in dtall.Rows)
                             *  {
                             *      if (row["Path"] != null && row["Path"].ToString() != "")
                             *          rules += "  Path like '%" + row["Path"] + "%' or";
                             *  }
                             *  if (rules != "") rules = rules.Substring(0, rules.Length - 2);
                             *  if (DataHelper.QueryDataTable(checksql + "(" + rules + ")").Rows.Count == 0)
                             *  {
                             *      //判断有权限的子节点梯队
                             *      string sqlIds = " select Id,Path from " + db + "..A_TaskWBS where DutyId like '%" + this.UserInfo.UserID + "%' and Path like '%" + pid + "%'";
                             *      DataTable dt = DataHelper.QueryDataTable(sqlIds);
                             *      string cids = "";
                             *      string cpids = "";
                             *      foreach (DataRow row in dt.Rows)
                             *      {
                             *          cids += row["Path"].ToString() + '.';
                             *          cpids += " or Path like '%" + row["Path"].ToString() + "%'";
                             *      }
                             *      cids = cids.TrimEnd('.').Replace(".", "','");
                             *      crit = Expression.Sql(" ParentID = '" + pid + "' and  ( Id in ('" + cids + "') " + cpids + " )");//SearchHelper.IntersectCriterions(crit);
                             *
                             *  }
                             * }*/
                        }
                    }
                }
            }
            else
            {
                crit = Expression.Eq(A_TaskWBS.Prop_Year, year);
                if (this.Request.QueryString["Type"] != null && this.Request.QueryString["Type"].ToString() != "")
                {
                    crit = SearchHelper.UnionCriterions(Expression.IsNull(A_TaskWBS.Prop_ParentID), Expression.Eq(A_TaskWBS.Prop_ParentID, String.Empty));
                }
                else
                {
                    string sqlC = " Id in (select distinct SUBSTRING(isnull(Path,Id),0,37) from BJKY_IntegratedManage..A_TaskWBS where ((DutyId like '%{0}%' or UserIds like '%{0}%') and State='1') or CreateId='{0}')";
                    sqlC = string.Format(sqlC, UserInfo.UserID);
                    crit = SearchHelper.IntersectCriterions(crit, Expression.Sql(sqlC));
                }
            }
            if (crit != null)
            {
                ents = A_TaskWBS.FindAll(sc, SearchHelper.IntersectCriterions(crit, Expression.Eq(A_TaskWBS.Prop_Year, year)));
            }
            else
            {
                ents = A_TaskWBS.FindAll(sc);
            }
            if (ents != null && ents.Length != 0)
            {
                this.PageState.Add("DtList", ents);
            }
        }
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            A_ChargeProgres ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <A_ChargeProgres>();
                ent.DoUpdate();
                A_TaskWBS tb = A_TaskWBS.Find(ent.TaskId);
                tb.TaskProgress = float.Parse(ent.Progress);

                /*if (int.Parse(tb.TaskProgress.ToString()).Equals(100))
                 * {
                 *  tb.State = "2";
                 *  tb.FactEndDate = ent.CreateTime;
                 * }
                 * else
                 *  tb.State = "1";*/
                tb.Save();
                CalculateRates(tb);
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent            = this.GetPostedData <A_ChargeProgres>();
                ent.CreateId   = this.UserInfo.UserID;
                ent.CreateName = this.UserInfo.Name;
                ent.CreateTime = DateTime.Now;
                ent.DoCreate();
                A_TaskWBS tb1 = A_TaskWBS.Find(ent.TaskId);
                tb1.TaskProgress = float.Parse(ent.Progress);

                /*if (int.Parse(tb1.TaskProgress.ToString()).Equals(100))
                 * {
                 *  tb1.State = "2";
                 *  tb1.FactEndDate = ent.CreateTime;
                 * }
                 * else
                 *  tb1.State = "1";*/
                tb1.Save();
                CalculateRates(tb1);
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <A_ChargeProgres>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "charge")
                {
                    A_TaskWBS[] charges = A_TaskWBS.FindAll(Expression.Eq(A_TaskWBS.Prop_ParentID, this.RequestData.Get <string>("TaskId")), Expression.Not(Expression.Eq(A_TaskWBS.Prop_State, "2")));
                    if (charges.Length > 0)
                    {
                        this.PageState.Add("Finish", "false");
                    }
                    else
                    {
                        this.PageState.Add("Finish", "true");
                    }
                }
                break;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = A_ChargeProgres.Find(id);
                }

                this.SetFormData(ent);
            }
            else
            {
                this.PageState.Add("TaskModel", A_TaskWBS.Find(this.RequestData.Get <string>("TaskId")));
            }
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            A_TaskWBS ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <A_TaskWBS>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");

                    if (idList != null && idList.Count > 0)
                    {
                        A_TaskWBS.DoBatchDelete(idList.ToArray());
                    }
                }
                else if (RequestActionString == "batchsubmit")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");

                    if (idList != null && idList.Count > 0)
                    {
                        A_TaskWBS[] tents = A_TaskWBS.FindAll(Expression.In("Id", idList.ToArray()));
                        foreach (A_TaskWBS tent in tents)
                        {
                            tent.State = "2";
                            tent.Save();
                        }
                    }
                }
                else if (RequestActionString == "batchback")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");

                    if (idList != null && idList.Count > 0)
                    {
                        A_TaskWBS[] tents = A_TaskWBS.FindAll(Expression.In("Id", idList.ToArray()));
                        foreach (A_TaskWBS tent in tents)
                        {
                            tent.State = "1";
                            tent.Save();
                        }
                    }
                }
                else
                {
                    if (SearchCriterion.Orders.Count == 0)
                    {
                        SearchCriterion.Orders.Add(new OrderCriterionItem("PlanEndDate", true));
                    }
                    string dateFlag = this.RequestData["Date"] == null ? "365" : this.RequestData["Date"].ToString();
                    switch (dateFlag)
                    {
                    case "3":
                        SearchCriterion.SetSearch("PlanEndDate", DateTime.Now.AddDays(3), SearchModeEnum.LessThanEqual);
                        break;

                    case "7":
                        SearchCriterion.SetSearch("PlanEndDate", DateTime.Now.AddDays(7), SearchModeEnum.LessThanEqual);
                        break;

                    case "14":
                        SearchCriterion.SetSearch("PlanEndDate", DateTime.Now.AddDays(14), SearchModeEnum.LessThanEqual);
                        break;

                    case "30":
                        SearchCriterion.SetSearch("PlanEndDate", DateTime.Now.AddMonths(1), SearchModeEnum.LessThanEqual);
                        break;

                    case "31":
                        SearchCriterion.SetSearch("PlanEndDate", DateTime.Now.AddMonths(1), SearchModeEnum.LessThanEqual);
                        break;

                    case "180":
                        SearchCriterion.SetSearch("PlanEndDate", DateTime.Now.AddMonths(3), SearchModeEnum.LessThanEqual);
                        break;

                    case "365":
                        SearchCriterion.SetSearch("PlanEndDate", DateTime.Now.AddYears(1), SearchModeEnum.LessThanEqual);
                        break;
                    }
                    if (this.RequestData.Get <string>("Status") == "2")
                    {
                        ents = A_TaskWBS.FindAll(SearchCriterion, Expression.Sql(" ParentId in (select Id from " + db + "..A_TaskWBS where DutyId like '%" + this.UserInfo.UserID + "%' )  and State='2'"));
                    }
                    else
                    {
                        ents = A_TaskWBS.FindAll(SearchCriterion, Expression.Sql(" ParentId in (select Id from " + db + "..A_TaskWBS where DutyId like '%" + this.UserInfo.UserID + "%' ) and State='1.5'"), Expression.IsNotNull("ParentID"));
                    }
                    this.PageState.Add("SysWorkFlowTaskList", ents);
                }
                break;
            }
        }
        string type = String.Empty; // 对象类型
        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            A_TaskWBS ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <A_TaskWBS>();
                if (this.RequestData.Get <string>("issubmit", "") != "")
                {
                    ent.State          = "1";
                    ent.SubmitDate     = DateTime.Now;
                    ent.SubmitUserId   = this.UserInfo.UserID;
                    ent.SubmitUserName = this.UserInfo.Name;
                }
                ent.Update();
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent            = this.GetPostedData <A_TaskWBS>();
                ent.CreateId   = this.UserInfo.UserID;
                ent.CreateName = this.UserInfo.Name;
                ent.CreateTime = DateTime.Now;
                if (this.RequestData.Get <string>("issubmit", "") != "")
                {
                    ent.State = "1";
                }
                if (ent.TaskType == null)
                {
                    ent.TaskType = "任务";
                }
                if (String.IsNullOrEmpty(id))
                {
                    ent.CreateAsRoot();
                }
                else
                {
                    ent.State = "0";
                    if (this.RequestData.Get <string>("issubmit", "") != "")
                    {
                        ent.State = "1";
                    }
                    ent.CreateAsSibling(id);
                }
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <A_TaskWBS>();
                ent.Delete();
                return;

            default:
                if (RequestActionString == "createsub")
                {
                    ent       = this.GetPostedData <A_TaskWBS>();
                    ent.State = "0";
                    if (this.RequestData.Get <string>("issubmit", "") != "")
                    {
                        ent.State          = "1";
                        ent.SubmitDate     = DateTime.Now;
                        ent.SubmitUserId   = this.UserInfo.UserID;
                        ent.SubmitUserName = this.UserInfo.Name;
                    }
                    ent.TaskType   = this.RequestData.Get <string>("TaskType");
                    ent.CreateId   = this.UserInfo.UserID;
                    ent.CreateName = this.UserInfo.Name;
                    ent.CreateTime = DateTime.Now;
                    ent.Year       = DateTime.Now.Year.ToString();
                    ent.CreateAsChild(id);
                    this.SetMessage("新建成功!");
                }
                else if (RequestActionString == "submitfinish")
                {
                    if (this.RequestData.Get <string>("id") != null)
                    {
                        ent             = A_TaskWBS.Find(id);
                        ent.State       = "2";
                        ent.FactEndDate = DateTime.Now;
                        ent.Save();
                    }
                }
                else if (RequestActionString == "GetNextUsers")
                {
                    ent = A_TaskWBS.Find(id);
                    A_TaskWBS ptEnt = A_TaskWBS.TryFind(ent.ParentID);
                    PageState.Add("NextUsers", new string[] { ptEnt.DutyId, ptEnt.DutyName });
                }
                break;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = A_TaskWBS.Find(id);
                    if (ent.Parent != null)
                    {
                        this.PageState.Add("ParentNode", ent.Parent);
                    }
                    string sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' and Ext1 is null order by FinishTime asc";
                    sql = string.Format(sql, ent.Id);
                    IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql);
                    PageState.Add("Opinion", taskDics);
                    try
                    {
                        string    sqlUsers = "select UserID,UserName from dbo.View_SysUserGroup where ParentId='" + ent.DeptId + "' and ChildDeptName='所(处、部)长'";
                        DataTable dt       = DataHelper.QueryDataTable(sqlUsers);
                        if (dt.Rows.Count > 0)
                        {
                            this.PageState.Add("DeptLeaderUserId", dt.Rows[0]["UserID"].ToString());
                            this.PageState.Add("DeptLeaderUserName", dt.Rows[0]["UserName"].ToString());
                        }
                    }
                    catch { }
                }

                this.SetFormData(ent);
            }
            else if (op == "cs")
            {
                if (this.RequestData.Get <string>("id") != null)
                {
                    ent = A_TaskWBS.Find(id);
                    A_TaskWBS nt = new A_TaskWBS();
                    //加上默认的序号等数据
                    nt.Code            = ent.Code + "-" + (A_TaskWBS.FindAllByProperties(A_TaskWBS.Prop_ParentID, id).Length + 1).ToString();
                    nt.LeaderName      = ent.LeaderName;
                    nt.LeaderId        = ent.LeaderId;
                    nt.DeptId          = ent.DeptId;
                    nt.DeptName        = ent.DeptName;
                    nt.PlanEndDate     = ent.PlanEndDate;
                    nt.SecondDeptIds   = ent.SecondDeptIds;
                    nt.SecondDeptNames = ent.SecondDeptNames;
                    this.SetFormData(nt);
                }
            }
            string taskId = RequestData.Get <string>("TaskId");

            if (!string.IsNullOrEmpty(taskId))
            {
                Task tEnt = Task.Find(taskId);
                if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                {
                    PageState.Add("UnSubmitOpinion", tEnt.Description);
                }
            }
        }
Пример #17
0
        /// <summary>
        /// 选择数据
        /// </summary>
        private void DoSelect()
        {
            // 构建查询表达式
            SearchCriterion sc = new HqlSearchCriterion();

            sc.SetOrder("SortIndex");

            ICriterion crit = null;

            if (RequestActionString == "querychildren")
            {
                if (ids != null && ids.Count > 0 || pids != null && pids.Count > 0)
                {
                    if (ids != null && ids.Count > 0)
                    {
                        IEnumerable <string> distids = ids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));
                        crit = Expression.In(A_TaskWBS.Prop_Id, distids.ToArray());
                    }

                    if (pids != null && pids.Count > 0)
                    {
                        IEnumerable <string> dispids = pids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));

                        if (crit != null)
                        {
                            crit = SearchHelper.UnionCriterions(crit, Expression.In(A_TaskWBS.Prop_ParentID, dispids.ToArray()));
                        }
                        else
                        {
                            crit = Expression.In(A_TaskWBS.Prop_ParentID, dispids.ToArray());
                            string pid = dispids.ToArray()[0];
                            if (pid == "1437f360-6937-409b-9548-964661e6c27c")
                            {
                                string test = pid;
                            }
                            //不是自己责任人的只能看到属于自己的(暂时屏蔽掉,有权限看到自己的子节点)

                            /*if (A_TaskWBS.Find(pid).DutyId.IndexOf(this.UserInfo.UserID) < 0)
                             * {
                             *  //判断是否父节点有权限,有全部输出
                             *  //A_TaskWBS tp = A_TaskWBS.Find(pid);
                             *  string sqlall = " select Id,Path from " + db + "..A_TaskWBS where DutyId like '%" + this.UserInfo.UserID + "%'";
                             *  DataTable dtall = DataHelper.QueryDataTable(sqlall);
                             *  string checksql = "select Id from " + db + "..A_TaskWBS where ParentId='" + pid + "' and ";
                             *  string rules = "";
                             *  foreach (DataRow row in dtall.Rows)
                             *  {
                             *      if (row["Path"] != null && row["Path"].ToString() != "")
                             *          rules += "  Path like '%" + row["Path"] + "%' or";
                             *  }
                             *  if (rules != "") rules = rules.Substring(0, rules.Length - 2);
                             *  if (DataHelper.QueryDataTable(checksql + "(" + rules + ")").Rows.Count == 0)
                             *  {
                             *      //判断有权限的子节点梯队
                             *      string sqlIds = " select Id,Path from " + db + "..A_TaskWBS where DutyId like '%" + this.UserInfo.UserID + "%' and Path like '%" + pid + "%'";
                             *      DataTable dt = DataHelper.QueryDataTable(sqlIds);
                             *      string cids = "";
                             *      string cpids = "";
                             *      foreach (DataRow row in dt.Rows)
                             *      {
                             *          cids += row["Path"].ToString() + '.';
                             *          cpids += " or Path like '%" + row["Path"].ToString() + "%'";
                             *      }
                             *      cids = cids.TrimEnd('.').Replace(".", "','");
                             *      crit = Expression.Sql(" ParentID = '" + pid + "' and  ( Id in ('" + cids + "') " + cpids + " )");//SearchHelper.IntersectCriterions(crit);
                             *
                             *  }
                             * }*/
                        }
                    }
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(year))
                {
                    crit = Expression.Eq(A_TaskWBS.Prop_Year, year);

                    /*EasyDictionary es = SysEnumeration.GetEnumDict("AimType");
                     * foreach (var at in es)
                     * {
                     *  if (!this.RequestData.Get<bool>(at.Value.ToString()))
                     *  {
                     *      crit = SearchHelper.IntersectCriterions(crit, Expression.Not(Expression.Eq(A_TaskWBS.Prop_TaskType, at.Value)));
                     *  }
                     * }*/
                }
                if (this.Request.QueryString["Type"] != null && this.Request.QueryString["Type"].ToString() != "")
                {
                    crit = SearchHelper.UnionCriterions(Expression.IsNull(A_TaskWBS.Prop_ParentID),
                                                        Expression.Eq(A_TaskWBS.Prop_ParentID, String.Empty));
                    //crit = SearchHelper.IntersectCriterions(crit,Expression.Eq(A_TaskWBS.Prop_Type, this.Request.QueryString["Type"].ToString()));
                }
                else
                {
                    /*crit = SearchHelper.UnionCriterions(Expression.IsNull(A_TaskWBS.Prop_ParentID),
                     *  Expression.Eq(A_TaskWBS.Prop_ParentID, String.Empty));
                     * //crit = Expression.Like(A_TaskWBS.Prop_DutyId, this.UserInfo.UserID);*/
                    //先屏蔽掉一进来自己只能看到自己的限制,根据权限过滤查询.
                    //crit = SearchHelper.IntersectCriterions(crit, Expression.Sql(" Id in (select distinct SUBSTRING(isnull(Path,Id),0,37) from A_TaskWBS where DutyId like '%" + this.UserInfo.UserID + "%')"));
                }
                crit = CheckProperty(crit);
            }

            if (crit != null)
            {
                ents = A_TaskWBS.FindAll(sc, crit);
            }
            else
            {
                ents = A_TaskWBS.FindAll(sc);
            }

            if (ents != null && ents.Length != 0)
            {
                this.PageState.Add("DtList", ents.OrderBy(en => en.Code));
            }
        }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id   = RequestData.Get <string>("id", String.Empty);
            ids  = RequestData.GetList <string>("ids");
            pids = RequestData.GetList <string>("pids");
            year = RequestData.Get <string>("Year", String.Empty);

            A_TaskWBS ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent          = this.GetMergedData <A_TaskWBS>();
                ent.ParentID = String.IsNullOrEmpty(ent.ParentID) ? null : ent.ParentID;
                ent.Update();
                this.SetMessage("更新成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");
                    if (idList != null && idList.Count > 0)
                    {
                        A_TaskWBS.DoBatchDelete(idList.ToArray());
                    }
                }
                else if (RequestActionString == "paste")
                {
                    DoPaste();
                }
                else if (RequestActionString == "submittask")
                {
                    ent                = A_TaskWBS.Find(this.RequestData.Get <string>("Id"));
                    ent.State          = "1";
                    ent.SubmitDate     = DateTime.Now;
                    ent.SubmitUserId   = this.UserInfo.UserID;
                    ent.SubmitUserName = this.UserInfo.Name;
                    ent.Save();
                }
                else if (RequestActionString == "backtask")
                {
                    ent       = A_TaskWBS.Find(this.RequestData.Get <string>("Id"));
                    ent.State = "0";
                    ent.Save();
                }
                else
                {
                    DoSelect();
                    this.PageState.Add("BudgetType", SysEnumeration.GetEnumDict("BudgetType"));
                    this.PageState.Add("Years", SysEnumeration.GetEnumDict("Year"));
                    this.PageState.Add("AimType", SysEnumeration.GetEnumDict("AimType"));
                }
                if (this.RequestData.Get <string>("ChartSearch") == "T")
                {
                    string    sql      = "select Name TaskType,0 CountFinish,0 CountNormal from dbo.SysEnumeration where ParentId='5cf5990a-a68d-40b7-8ae5-558b1732cc92'";
                    DataTable dt       = DataHelper.QueryDataTable(sql);
                    string    sqlAll   = "";
                    string    deptName = this.RequestData.Get <string>("DeptName");
                    string    Year     = this.RequestData.Get <string>("Year");
                    DataTable newDt    = new DataTable();
                    foreach (DataColumn col in dt.Columns)
                    {
                        newDt.Columns.Add(col.ColumnName, col.DataType);
                    }
                    foreach (DataRow row in dt.Rows)
                    {
                        DataRow newrow = newDt.NewRow();
                        newrow.ItemArray = row.ItemArray;
                        newDt.Rows.Add(newrow);
                        string rootId = DataHelper.QueryValue <string>("select isnull(Id,'') from " + db + "..A_TaskWBS where (DeptName='" + deptName + "' or DutyName='" + deptName + "') and Year='" + year + "' and TaskType='" + row["TaskType"].ToString() + "'");
                        newrow["CountFinish"] = DataHelper.QueryValue("select isnull(count(*),0) from " + db + "..A_TaskWBS where (DeptName='" + deptName + "' or DutyName='" + deptName + "') and Year='" + year + "' and Path like '%" + rootId + "%' and State='2'");
                        newrow["CountNormal"] = DataHelper.QueryValue("select isnull(count(*),0) from " + db + "..A_TaskWBS where (DeptName='" + deptName + "' or DutyName='" + deptName + "') and Year='" + year + "' and Path like '%" + rootId + "%' and State<>'2'");
                    }
                    this.PageState.Add("ChartData", DataHelper.DataTableToDictList(newDt));
                }

                break;
            }
        }