233 lines
		
	
	
		
			7.0 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			233 lines
		
	
	
		
			7.0 KiB
		
	
	
	
		
			C#
		
	
	
	
| namespace FineUIPro.Web.InterFace
 | |
| {
 | |
|     using System;
 | |
|     using System.Collections.Generic;
 | |
|     using System.Data;
 | |
|     using System.Data.SqlClient;
 | |
|     using System.Linq;
 | |
|     using BLL;
 | |
| 
 | |
|     public partial class InterFaceTask : PageBase
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 加载页面
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 btnNew.OnClientClick = Window1.GetShowReference("InterFaceTaskEdit.aspx", "接口任务新增") + "return false;";
 | |
| 
 | |
|                 ////权限按钮方法
 | |
|                 this.GetButtonPower();
 | |
|                 ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
 | |
|                 // 绑定表格
 | |
|                 BindGrid();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 绑定数据
 | |
|         /// </summary>
 | |
|         private void BindGrid()
 | |
|         {
 | |
|             Model.InterFaceTask interFaceTask=new Model.InterFaceTask();
 | |
|             interFaceTask.InterFaceName = txtInterFaceName.Text;
 | |
|             var q= BLL.InterFaceTaskService.GetInterFaceTaskByModle(interFaceTask);
 | |
|             Grid1.DataSource = q;
 | |
|             Grid1.DataBind();
 | |
|         }
 | |
| 
 | |
|         #region 获取按钮权限
 | |
|         /// <summary>
 | |
|         /// 获取按钮权限
 | |
|         /// </summary>
 | |
|         /// <param name="button"></param>
 | |
|         /// <returns></returns>
 | |
|         private void GetButtonPower()
 | |
|         {
 | |
|             if (this.CurrUser != null)
 | |
|             {
 | |
|                 var buttonList = BLL.CommonService.GetAllButtonList(string.Empty, this.CurrUser.UserId, BLL.Const.UserMenuId);
 | |
|                 if (buttonList.Count() > 0)
 | |
|                 {
 | |
|                     if (buttonList.Contains(BLL.Const.BtnModify))
 | |
|                     {
 | |
|                         //this.btnEdit.Hidden = false;
 | |
|                         //this.btnMenuEdit.Hidden = false;
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #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();
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         /// <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();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 关闭窗口
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Window1_Close(object sender, EventArgs e)
 | |
|         {
 | |
|             BindGrid();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 选择行事件
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSelectRows_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 编辑
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnEdit_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             this.EditData();
 | |
|         }
 | |
| 
 | |
|         /// <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.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
 | |
|                 return;
 | |
|             }
 | |
|             string Id = Grid1.SelectedRowID;
 | |
|             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InterFaceTaskEdit.aspx?InterFaceTaskId={0}", Id, "编辑 - ")));
 | |
|         }
 | |
| 
 | |
|         #region 判断是否可删除
 | |
|         /// <summary>
 | |
|         /// 判断是否可以删除
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         private bool judgementDelete(string id, bool isShow)
 | |
|         {
 | |
|             return false;
 | |
|         }
 | |
|         //private bool judgementDelete(string id, bool isShow)
 | |
|         //{
 | |
|         //    string content = string.Empty;
 | |
|         //    if (Funs.DB.Law_LawRegulationList.FirstOrDefault(x => x.CompileMan == id) != null)
 | |
|         //    {
 | |
|         //        content = "该用户已在【法律法规】中使用,不能删除!";
 | |
|         //    }
 | |
|         //    if (Funs.DB.Law_HSSEStandardsList.FirstOrDefault(x => x.CompileMan == id) != null)
 | |
|         //    {
 | |
|         //        content = "该用户已在【标准规范】中使用,不能删除!";
 | |
|         //    }
 | |
|         //    if (Funs.DB.Edu_Online_Examinee.FirstOrDefault(x => x.UserId == id) != null)
 | |
|         //    {
 | |
|         //        content = "该用户已在【考生信息】中使用,不能删除!";
 | |
|         //    }
 | |
|         //    if (string.IsNullOrEmpty(content))
 | |
|         //    {
 | |
|         //        return true;
 | |
|         //    }
 | |
|         //    else
 | |
|         //    {
 | |
|         //        if (isShow)
 | |
|         //        {
 | |
|         //            Alert.ShowInTop(content);
 | |
|         //        }
 | |
|         //        return false;
 | |
|         //    }
 | |
|         //}
 | |
|         #endregion
 | |
|         protected void btnStart_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             var Id = Grid1.SelectedRowID;
 | |
|             BLL.InterFaceTaskService.ExecuteTasks(Id);
 | |
|         }
 | |
|         #region 查询
 | |
|         /// <summary>
 | |
|         /// 用户类别选择
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void cbRoleCategory_SelectedIndexChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             this.BindGrid();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 查询
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void TextBox_TextChanged(object sender, EventArgs e)
 | |
|         {
 | |
|             this.BindGrid();
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |