125 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			125 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| 
 | |
| namespace FineUIPro.Web.Personal
 | |
| {
 | |
|     public partial class PersonMeeting : PageBase
 | |
|     {
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 Funs.DropDownPageSize(ddlPageSize);
 | |
|                 ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
 | |
|                 // 绑定表格
 | |
|                 BindGrid();
 | |
|                 btnNew.OnClientClick = Window1.GetShowReference("PersonMeetingEdit.aspx") + "return false;";
 | |
|             }
 | |
|         }
 | |
|         /// <summary>
 | |
|         /// 绑定数据
 | |
|         /// </summary>
 | |
|         public void BindGrid()
 | |
|         {
 | |
|             DataTable tb = BindData();
 | |
|             Grid1.RecordCount = tb.Rows.Count;
 | |
|             var table = this.GetPagedDataTable(Grid1, tb);
 | |
|             Grid1.DataSource = table;
 | |
|             Grid1.DataBind();
 | |
|         }
 | |
| 
 | |
|         protected DataTable BindData()
 | |
|         {
 | |
|             string strSql = @"SELECT MeetingId,CompileManId,MeetingDate,MeetingTitle,AttendeeManIds,ConferenceLink,Remark
 | |
|                                         FROM dbo.Person_Meeting 
 | |
|                                         where 1=1 ";
 | |
|             List<SqlParameter> listStr = new List<SqlParameter>();
 | |
|             strSql += " AND ( AttendeeManIds like @UserId or CompileManId like @UserId or  CompileManId= '"+Const.sysglyId+ "' or  CompileManId= '" + Const.hfnbdId + "' or CompileManId is null)";
 | |
|             listStr.Add(new SqlParameter("@UserId", "%" + this.CurrUser.UserId + "%"));
 | |
|             if (!string.IsNullOrEmpty(this.txtMeetingTitle.Text.Trim()))
 | |
|             {
 | |
|                 strSql += " AND MeetingTitle like @MeetingTitle";
 | |
|                 listStr.Add(new SqlParameter("@MeetingTitle", "%" + this.txtMeetingTitle.Text.Trim() + "%"));
 | |
|             }
 | |
|             SqlParameter[] parameter = listStr.ToArray();
 | |
|             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | |
|             return tb;
 | |
|         }
 | |
| 
 | |
|         protected void btnMenuModify_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             EditData();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 删除
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnMenuDel_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             if (Grid1.SelectedRowIndexArray.Length > 0)
 | |
|             {
 | |
|                 foreach (int rowIndex in Grid1.SelectedRowIndexArray)
 | |
|                 {
 | |
|                     string rowID = Grid1.DataKeys[rowIndex][0].ToString();
 | |
|                     Person_MeetingService.DeletePerson_MeetingById(rowID);
 | |
|                 }
 | |
|                 BindGrid();
 | |
|                 ShowNotify("删除数据成功!", MessageBoxIcon.Success);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 编辑数据方法
 | |
|         /// </summary>
 | |
|         private void EditData()
 | |
|         {
 | |
|             if (Grid1.SelectedRowIndexArray.Length == 0)
 | |
|             {
 | |
|                 Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
 | |
|                 return;
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonMeetingEdit.aspx?MeetingId={0}", Grid1.SelectedRowID, "查看 - ")));
 | |
|         }
 | |
| 
 | |
|         
 | |
|         /// <summary>
 | |
|         /// 
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSearch_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             BindGrid();
 | |
|         }
 | |
| 
 | |
|         protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
 | |
|         {
 | |
|             EditData();
 | |
|         }
 | |
|         
 | |
|         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | |
|         {
 | |
|             BindGrid();
 | |
|         }
 | |
| 
 | |
|         protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             BindGrid();
 | |
|         }
 | |
|         
 | |
|         /// <summary>
 | |
|         /// 
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | |
|         {
 | |
|             BindGrid();
 | |
|         }
 | |
|     }
 | |
| } |