195 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			195 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			C#
		
	
	
	
using Aspose.Words;
 | 
						|
using BLL;
 | 
						|
using Model;
 | 
						|
using Org.BouncyCastle.Asn1.Cms;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Data;
 | 
						|
using System.Data.SqlClient;
 | 
						|
using System.Linq;
 | 
						|
using System.Text;
 | 
						|
using AspNet = System.Web.UI.WebControls;
 | 
						|
 | 
						|
namespace FineUIPro.Web.Work
 | 
						|
{
 | 
						|
    public partial class ToDoList : PageBase
 | 
						|
    {
 | 
						|
        private static List<WorkToDo> toDoList = new List<WorkToDo>();
 | 
						|
 | 
						|
 | 
						|
        #region 加载
 | 
						|
        /// <summary>
 | 
						|
        /// 加载页面
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (!IsPostBack)
 | 
						|
            {
 | 
						|
                //Funs.DropDownPageSize(this.ddlPageSize);
 | 
						|
                //if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
 | 
						|
                //{
 | 
						|
                //    Grid1.PageSize = this.CurrUser.PageSize.Value;
 | 
						|
                //}
 | 
						|
                //this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
 | 
						|
 | 
						|
 | 
						|
                // 绑定表格
 | 
						|
                this.BindGrid();
 | 
						|
                //////权限按钮方法
 | 
						|
                //this.GetButtonPower();
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 绑定数据
 | 
						|
        /// </summary>
 | 
						|
        private void BindGrid()
 | 
						|
        {
 | 
						|
            toDoList.Clear();
 | 
						|
            if (this.CurrUser.UserId != null && this.CurrUser.LoginProjectId != null)
 | 
						|
            {
 | 
						|
                #region 预试车管理-检查表条件确认
 | 
						|
 | 
						|
                var list1 = Funs.DB.PreRun_SubInspectTermItem.Where(x => x.InspectedUser == this.CurrUser.UserId && x.ProjectId == this.CurrUser.LoginProjectId && x.InspectionResults == null).Select(p => p.SubInspectId).ToList();
 | 
						|
                var num1 = list1.Distinct().Count();
 | 
						|
                if (num1 > 0)
 | 
						|
                {
 | 
						|
                    toDoList.Add(new WorkToDo { Id = Guid.NewGuid().ToString(), Num = num1, Title = "预试车管理-检查表条件确认", Detail = $"有{num1}个检查表条件待确认", PageUrl = "/TestRun/BeforeTestRun/SubWorkInspect.aspx", Memo = "" });
 | 
						|
                }
 | 
						|
 | 
						|
                #endregion
 | 
						|
 | 
						|
                #region 预试车管理-检查表会签
 | 
						|
 | 
						|
                var list2 = Funs.DB.PreRun_SubInspectTerm.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.InspectionIsAllPass == 1 && ((x.Subcontractor == this.CurrUser.UserId && x.SubcontractorIsAllPass == null) || (x.Contractor == this.CurrUser.UserId && x.ContractorIsAllPass == null) || (x.Supervision == this.CurrUser.UserId && x.SupervisionIsAllPass == null) || (x.Owner == this.CurrUser.UserId && x.OwnerIsAllPass == null))).Select(p => p.SubInspectId).ToList();
 | 
						|
                var num2 = list2.Distinct().Count();
 | 
						|
                if (num2 > 0)
 | 
						|
                {
 | 
						|
                    toDoList.Add(new WorkToDo { Id = Guid.NewGuid().ToString(), Num = num2, Title = "预试车管理-检查表会签", Detail = $"有{num2}个检查表会签待确认", PageUrl = "/TestRun/BeforeTestRun/InspectWanderAboutList.aspx", Memo = "" });
 | 
						|
                }
 | 
						|
 | 
						|
                #endregion
 | 
						|
 | 
						|
                Grid1.RecordCount = toDoList.Count;
 | 
						|
                var table = this.LINQToDataTable(toDoList);
 | 
						|
                Grid1.DataSource = table;
 | 
						|
                Grid1.DataBind();
 | 
						|
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
        protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
 | 
						|
        {
 | 
						|
            if (e.CommandName == "ToDo")
 | 
						|
            {
 | 
						|
                object[] keys = Grid1.DataKeys[e.RowIndex];
 | 
						|
                string id = keys[0].ToString();
 | 
						|
                var work = toDoList.Where(a => a.Id == id).FirstOrDefault();
 | 
						|
                if (work != null)
 | 
						|
                {
 | 
						|
                    PageContext.RegisterStartupScript(Window1.GetShowReference(work.PageUrl, work.Title));
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #region 关闭弹出窗
 | 
						|
        /// <summary>
 | 
						|
        /// 关闭弹出窗
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 排序 分页
 | 
						|
        /// <summary>
 | 
						|
        /// 
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						|
        {
 | 
						|
            Grid1.PageIndex = e.NewPageIndex;
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
 | 
						|
        {
 | 
						|
            Grid1.SortDirection = e.SortDirection;
 | 
						|
            Grid1.SortField = e.SortField;
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
 | 
						|
 | 
						|
        #region 获取按钮权限
 | 
						|
        /// <summary>
 | 
						|
        /// 获取按钮权限
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="button"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        private void GetButtonPower()
 | 
						|
        {
 | 
						|
            if (Request.Params["value"] == "0")
 | 
						|
            {
 | 
						|
                return;
 | 
						|
            }
 | 
						|
 | 
						|
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 查询
 | 
						|
        /// <summary>
 | 
						|
        /// 查询
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void TextBox_TextChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
 | 
						|
            this.BindGrid();
 | 
						|
            //this.GetButtonPower();
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        protected string ConvertTelephone(object WorkAreaId)
 | 
						|
        {
 | 
						|
            if (WorkAreaId != null)
 | 
						|
                return WorkAreaId.ToString();
 | 
						|
            else
 | 
						|
                return "";
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    }
 | 
						|
} |