Пример #1
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;
            }
        }
Пример #2
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;
            }
        }
Пример #3
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);
                }
            }
        }