Пример #1
0
        protected void LoadData()
        {
            string dptList = GetChildrenBySelft();


            Maticsoft.BLL.tTask BLL = new Maticsoft.BLL.tTask();
            string sortField        = GridDpt.SortField;
            string sortDirection    = GridDpt.SortDirection;

            string where = "";
            where       += " SaveDpt in (" + dptList + ")";
            if (drpSearch.SelectedValue != "")
            {
                where += " and IsCheck='" + drpSearch.SelectedValue + "' ";
            }
            if (txtValue.Text.Trim() != "")
            {
                where += " and Title like '%" + txtValue.Text.Trim() + "%' ";
            }


            GridDpt.RecordCount = BLL.GetRecordCount(where);
            DataView view = BLL.GetListByPage(where, " SaveTime desc ", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView;

            view.Sort          = String.Format("{0} {1}", sortField, sortDirection);
            GridDpt.DataSource = view.ToTable();

            GridDpt.DataBind();
        }
        protected void LoadData()
        {
            int dptId = GetIdentityUser().dptId;


            Maticsoft.BLL.tTask BLL = new Maticsoft.BLL.tTask();
            string sortField        = GridDpt.SortField;
            string sortDirection    = GridDpt.SortDirection;

            string where = " IsCheck='已审核' ";


            if (drpSearch.SelectedValue == "")
            {
                where += string.Format(" and Id in (select TaskId from v_task_save where DptId={0}) ", dptId);
            }
            else if (drpSearch.SelectedValue == "已上报")
            {
                where += string.Format(" and Id in (select TaskId from v_task_save where DptId={0} and SavaDpt={1}) ", dptId, dptId);
            }
            else
            {
                where += string.Format(" and Id in (select TaskId from v_task_save where DptId={0} and SavaDpt is null) ", dptId);
            }


            if (txtValue.Text.Trim() != "")
            {
                where += " and (Title like '%" + txtValue.Text.Trim() + "%') or (TaskLevel like '%" + txtValue.Text.Trim() + "%') ";
            }


            GridDpt.RecordCount = BLL.GetRecordCount(where);
            DataView view = BLL.GetListByPage(where, " SaveTime desc ", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView;

            view.Sort          = String.Format("{0} {1}", sortField, sortDirection);
            GridDpt.DataSource = view.ToTable();

            GridDpt.DataBind();
        }
Пример #3
0
        protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e)
        {
            int roleID = GetSelectedDataKeyID(GridDpt);


            if (e.CommandName == "Delete")
            {
                BLL.tTask BLL = new Maticsoft.BLL.tTask();

                if (BLL.GetModel(roleID).IsCheck == "已审核")
                {
                    Alert.ShowInTop("已经审核,无法删除!");
                    return;
                }
                bool isTrue = BLL.Delete(roleID);
                if (!isTrue)
                {
                    Alert.ShowInTop("删除失败!");
                    return;
                }
                else
                {
                    LoadData();
                }
            }
            else if (e.CommandName == "Check")
            {
                Model.tUsers user = GetIdentityUser();
                BLL.tTask    BLL  = new Maticsoft.BLL.tTask();

                if (!haveRight(user.userId, "及时任务审批"))
                {
                    Alert.ShowInTop("当前用户没有权限审批!");
                    return;
                }
                Model.tTask top = BLL.GetModel(roleID);

                if (top.IsCheck == "已审核")
                {
                    //if (top.IsCheckPeo != user.usersName)
                    //{
                    //    Alert.ShowInTop("当前用户没有权限审批!");
                    //    return;
                    //}
                    top.IsCheck     = "待审核";
                    top.IsCheckPeo  = null;
                    top.IsCheckTime = null;
                }
                else
                {
                    top.IsCheck     = "已审核";
                    top.IsCheckPeo  = user.usersName;
                    top.IsCheckTime = DateTime.Now;
                }


                bool isTrue = BLL.Update(top);
                if (!isTrue)
                {
                    Alert.ShowInTop("操作失败!");
                    return;
                }
                else
                {
                    LoadData();
                }
            }
            else if (e.CommandName == "Edit")
            {
                string openUrl = String.Format("./TaskEdit.aspx?Id={0}", HttpUtility.UrlEncode(roleID.ToString()));
                PageContext.RegisterStartupScript(Window1.GetSaveStateReference(roleID.ToString()) + Window1.GetShowReference(openUrl, "编辑任务"));
            }
            else
            {
            }
        }