using BLL; using System; using System.Linq; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; namespace FineUIPro.Web.SYHSE { public partial class SYHSEData_Promise : PageBase { /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Funs.DropDownPageSize(this.ddlPageSize); // 绑定表格 this.BindGrid(); } } #region 绑定数据 /// /// 绑定数据 /// private void BindGrid() { var getData = SYHSEData_PromiseService.getListData(this.CurrUser.LoginProjectId, this.txtStartTime.Text.Trim(), this.txtEndTime.Text.Trim(), Grid1); Grid1.RecordCount = SYHSEData_PromiseService.count; Grid1.DataSource = getData; Grid1.DataBind(); } #endregion protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) { if (Grid1.SelectedRowIndexArray.Length == 0) { Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning); return; } PageContext.RegisterStartupScript(WindowAdd.GetShowReference(String.Format("SYHSEData_PromiseEdit.aspx?PromiseId={0}", Grid1.SelectedRowID, "编辑 - "))); } #region 查询 /// /// 查询 /// /// /// protected void btSearch_Click(object sender, EventArgs e) { this.BindGrid(); } #endregion protected void btAdd_Click(object sender, EventArgs e) { if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.SYHSE_PromiseMenuId, Const.BtnAdd)) { PageContext.RegisterStartupScript(WindowAdd.GetShowReference(String.Format("SYHSEData_PromiseEdit.aspx?PromiseId={0}", string.Empty, "新增 - "))); } else { ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } protected void WindowAdd_Close(object sender, WindowCloseEventArgs e) { this.BindGrid(); } #region 删除数据 /// /// 右键删除事件 /// /// /// protected void btnMenuDelete_Click(object sender, EventArgs e) { this.DeleteData(); } /// /// 删除方法 /// private void DeleteData() { if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.SYHSE_PromiseMenuId, Const.BtnAdd)) { if (Grid1.SelectedRowIDArray.Length > 0) { foreach (var item in Grid1.SelectedRowIDArray) { SYHSEData_PromiseService.DeleteProjectById(item); } BindGrid(); ShowNotify("删除数据成功!", MessageBoxIcon.Success); } } else { ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } #endregion #region 分页 /// /// 分页 /// /// /// protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) { BindGrid(); } /// /// 分页显示条数下拉框 /// /// /// protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) { Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); BindGrid(); } /// /// 排序 /// /// /// protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) { BindGrid(); } #endregion public string ConvertMan(Object userId) { Model.Sys_User user = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId.ToString()); if (user != null) { return user.UserName; } else { return userId.ToString(); } } } }