11
This commit is contained in:
@@ -0,0 +1,248 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
{
|
||||
public partial class DailyReportComplete : PageBase
|
||||
{
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||||
var teamGroup = BLL.Welder_TeamGroupService.GetAllTeamGroupList(CurrUser.LoginProjectId, "");
|
||||
drpTeamGroup.DataValueField = "Value";
|
||||
drpTeamGroup.DataTextField = "Text";
|
||||
drpTeamGroup.DataSource = teamGroup;
|
||||
drpTeamGroup.DataBind();
|
||||
Funs.FineUIPleaseSelect(drpTeamGroup, "");
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT daily.DailyReportCompleteId,unit.UnitCode,team.TeamGroupName,daily.DailyReportDate,daily.IsComplete
|
||||
FROM dbo.Pipeline_DailyReportComplete daily
|
||||
LEFT JOIN dbo.Welder_TeamGroup team ON team.TeamGroupId = daily.TeamGroupId
|
||||
LEFT JOIN dbo.Base_Unit unit ON unit.UnitId = daily.UnitId
|
||||
WHERE 1=1";
|
||||
List<SqlParameter> parms = new List<SqlParameter>();
|
||||
if (this.drpTeamGroup.SelectedValue != "" && this.drpTeamGroup.SelectedValue!=Const._Null)
|
||||
{
|
||||
strSql += " and daily.TeamGroupId = @TeamGroupId ";
|
||||
parms.Add(new SqlParameter("@TeamGroupId", this.drpTeamGroup.SelectedValue));
|
||||
}
|
||||
strSql += " ORDER BY daily.DailyReportDate DESC ";
|
||||
SqlParameter[] parameter = parms.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = dt.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, dt);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
this.BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 统计按钮事件
|
||||
/// <summary>
|
||||
/// 统计
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
|
||||
}
|
||||
|
||||
#region 增加按钮事件
|
||||
/// <summary>
|
||||
/// 增加按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GetButtonPower(Const.BtnAdd))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DailyReportCompleteEdit.aspx", "新增 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑/查看/删除数据
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
private void EditData()
|
||||
{
|
||||
if (GetButtonPower(BLL.Const.BtnModify))
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInParent(Resources.Lan.SelectLeastOneRecord);
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DailyReportCompleteEdit.aspx?completeId={0}", Id, "编辑 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键编辑事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.EditData();
|
||||
}
|
||||
|
||||
protected void btnMenuView_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GetButtonPower(BLL.Const.BtnSee))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DailyReportCompleteEdit.aspx?completeId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GetButtonPower(BLL.Const.BtnDelete))
|
||||
{
|
||||
string strShowNotify = string.Empty;
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
BLL.DailyReportCompleteService.DeleteDailyReportComplete(rowID);
|
||||
BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.DailyReportCompleteMenuId, Const.BtnDelete, rowID);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(strShowNotify))
|
||||
{
|
||||
Alert.ShowInTop(strShowNotify, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
BindGrid();
|
||||
ShowNotify(Resources.Lan.DeletedSuccessfully, MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 关闭窗口
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private bool GetButtonPower(string button)
|
||||
{
|
||||
return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.DailyReportCompleteMenuId, button);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user