135 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			135 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						||
using FineUIPro.Web.DataShow;
 | 
						||
using System;
 | 
						||
using System.Collections.Generic;
 | 
						||
using System.Data;
 | 
						||
using System.Data.SqlClient;
 | 
						||
using System.Linq;
 | 
						||
 | 
						||
namespace FineUIPro.Web.SysManage
 | 
						||
{
 | 
						||
    public partial class ProjectToDo : PageBase
 | 
						||
    {
 | 
						||
        protected void Page_Load(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            if (!IsPostBack && this.CurrUser != null)
 | 
						||
            {
 | 
						||
                Funs.DropDownPageSize(this.ddlPageSize);
 | 
						||
                // 绑定表格
 | 
						||
                this.BindGrid();
 | 
						||
            }
 | 
						||
            else
 | 
						||
            {
 | 
						||
                string requestArg = GetRequestEventArgument(); // 此函数所在文件:PageBase.cs
 | 
						||
                if (requestArg.StartsWith("ReloadGrid$"))
 | 
						||
                {
 | 
						||
                    BindGrid();
 | 
						||
                    //PageContext.RegisterStartupScript("parent.__doPostBack('','Test3WindowClose');"
 | 
						||
                    //    + ActiveWindow.GetHidePostBackReference());
 | 
						||
                }
 | 
						||
            }
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 绑定数据
 | 
						||
        /// </summary>
 | 
						||
        private void BindGrid()
 | 
						||
        {
 | 
						||
            var getDataList = Funs.DB.Sp_Project_GetToDoItems(this.CurrUser.LoginProjectId, this.CurrUser.UserId).ToList();
 | 
						||
            Grid1.RecordCount = getDataList.Count();
 | 
						||
            Grid1.DataSource = getDataList;
 | 
						||
            Grid1.DataBind();
 | 
						||
        }
 | 
						||
 | 
						||
        #region 查询
 | 
						||
        /// <summary>
 | 
						||
        /// 查询
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void TextBox_TextChanged(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            this.BindGrid();
 | 
						||
        }
 | 
						||
        #endregion 
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 分页
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						||
        {
 | 
						||
            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)
 | 
						||
        {
 | 
						||
            BindGrid();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// Grid行双击事件
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
 | 
						||
        {
 | 
						||
            this.EditData();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 右键编辑事件
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void btnMenuEdit_Click(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            this.EditData();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 编辑数据方法
 | 
						||
        /// </summary>
 | 
						||
        private void EditData()
 | 
						||
        {
 | 
						||
            if (Grid1.SelectedRowIndexArray.Length == 0)
 | 
						||
            {
 | 
						||
                Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
 | 
						||
                return;
 | 
						||
            }
 | 
						||
            var getData = Funs.DB.Sp_Project_GetToDoItems(this.CurrUser.LoginProjectId, this.CurrUser.UserId).FirstOrDefault(x => x.DataId == Grid1.SelectedRowID);
 | 
						||
 | 
						||
            if (getData != null)   ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
 | 
						||
            {
 | 
						||
                PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("{0}", getData.PCUrl, "编辑 - ")));
 | 
						||
            }
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 关闭弹出窗
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | 
						||
        {
 | 
						||
            BindGrid();
 | 
						||
        }
 | 
						||
    }
 | 
						||
} |