提交代码
This commit is contained in:
@@ -18,7 +18,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
//Funs.DropDownPageSize(this.ddlPageSize);
|
||||
//权限按钮方法
|
||||
this.GetButtonPower();
|
||||
|
||||
@@ -35,9 +35,11 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
drpUnit.DataBind();
|
||||
this.drpUnit.Readonly = true;
|
||||
|
||||
Grid1.PageSize = 10;
|
||||
|
||||
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
//if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
|
||||
//{
|
||||
// Grid1.PageSize = this.CurrUser.PageSize.Value;
|
||||
//}
|
||||
//this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
// 绑定表格
|
||||
this.BindGrid();
|
||||
}
|
||||
@@ -50,7 +52,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
{
|
||||
string strSql = "select * from Environmental_OperationReport where 1=1 ";
|
||||
|
||||
strSql += " AND UnitId = '" + Const.UnitId_SEDIN + "'";
|
||||
strSql += " AND UnitId = '" + BLL.Const.UnitId_SEDIN + "'";
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
@@ -65,18 +67,25 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
listStr.Add(new SqlParameter("@Quarters", Funs.GetNewInt(this.drpQuarters.SelectedValue)));
|
||||
}
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
//SqlParameter[] parameter = listStr.ToArray();
|
||||
//DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
//Grid1.RecordCount = tb.Rows.Count;
|
||||
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
//var table = this.GetPagedDataTable(Grid1, tb);
|
||||
//Grid1.DataSource = table;
|
||||
//Grid1.DataBind();
|
||||
|
||||
Model.Environmental_OperationReport report = Funs.DB.Environmental_OperationReport.FirstOrDefault(e => e.UnitId == drpUnit.SelectedValue && e.Quarters == Funs.GetNewInt(this.drpQuarters.SelectedValue) && e.Year == Funs.GetNewInt(this.drpYear.SelectedValue));
|
||||
if (report != null)
|
||||
{
|
||||
//根据主表id加载子表
|
||||
var reportItem = Funs.DB.Environmental_OperationReportItem.Where(x => x.BusinessReportId == report.BusinessReportId)
|
||||
.OrderBy(x => x.SortIndex).ToList();
|
||||
|
||||
Grid1.DataSource = reportItem;
|
||||
Grid1.DataBind();
|
||||
|
||||
string upState = string.Empty;
|
||||
if (report.UpState == BLL.Const.UpState_3)
|
||||
{
|
||||
@@ -88,6 +97,14 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
}
|
||||
this.Grid1.Title = "中央企业节能环保和经营状况季报" + this.drpQuarters.SelectedItem.Text + this.drpYear.SelectedItem.Text + upState;
|
||||
}
|
||||
else {
|
||||
|
||||
var upState = "(未上报)";
|
||||
|
||||
this.Grid1.Title = "中央企业节能环保和经营状况季报" + this.drpQuarters.SelectedItem.Text + this.drpYear.SelectedItem.Text + upState;
|
||||
this.Grid1.DataSource = null;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -121,8 +138,8 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
//this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
||||
//BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -161,7 +178,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}", Const.UnitId_SEDIN, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}", BLL.Const.UnitId_SEDIN, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, "编辑 - ")));
|
||||
}
|
||||
/// <summary>
|
||||
/// 双击事件
|
||||
@@ -197,7 +214,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
var operationReport = Funs.DB.Environmental_OperationReport.FirstOrDefault(s => s.BusinessReportId == id);
|
||||
if (operationReport != null)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}&&BusinessReportId={3}", Const.UnitId_SEDIN, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, id, "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}&&BusinessReportId={3}", BLL.Const.UnitId_SEDIN, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, id, "编辑 - ")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,14 +225,19 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
/// <param name="e"></param>
|
||||
protected void btnUpdata_Click(object sender, EventArgs e)
|
||||
{
|
||||
var currUnitId = Const.UnitId_SEDIN;
|
||||
var currUnitId = BLL.Const.UnitId_SEDIN;
|
||||
var year = this.drpYear.SelectedValue;
|
||||
var quarter = this.drpQuarters.SelectedValue;
|
||||
|
||||
Model.Environmental_OperationReport report = Funs.DB.Environmental_OperationReport.Where(s => s.UnitId == currUnitId && s.Year.ToString() == year && s.Quarters.ToString() == quarter).FirstOrDefault();
|
||||
if (report != null)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}&&BusinessReportId={3}&type=Update", Const.UnitId_SEDIN, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, report.BusinessReportId, "编辑 - ")));
|
||||
if (report.UpState=="3")
|
||||
{
|
||||
ShowNotify("当前报表已经上报!不能重复上报。", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OperationReportEdit.aspx?UnitId={0}&&Year={1}&&Quarter={2}&&BusinessReportId={3}&type=Update", BLL.Const.UnitId_SEDIN, this.drpYear.SelectedValue, this.drpQuarters.SelectedValue, report.BusinessReportId, "编辑 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -262,15 +284,22 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
var getD = Funs.DB.Environmental_OperationReport.FirstOrDefault(s => s.BusinessReportId == rowID);
|
||||
if (getD != null)
|
||||
{
|
||||
//先删子表
|
||||
var list = Funs.DB.Environmental_OperationReportItem.Where(x => x.BusinessReportId == getD.BusinessReportId).ToList();
|
||||
if (list.Count > 0)
|
||||
{
|
||||
Funs.DB.Environmental_OperationReportItem.DeleteAllOnSubmit(list);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
BLL.LogService.AddSys_Log(this.CurrUser, null, getD.BusinessReportId, BLL.Const.OperationReportMenuId, BLL.Const.BtnDelete);
|
||||
|
||||
Funs.DB.Environmental_OperationReport.DeleteOnSubmit(getD);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
this.BindGrid();
|
||||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -320,7 +349,7 @@ namespace FineUIPro.Web.ZHGL.Environmental
|
||||
}
|
||||
}
|
||||
|
||||
var unitId = Const.UnitId_SEDIN;
|
||||
var unitId = BLL.Const.UnitId_SEDIN;
|
||||
var year = Funs.GetNewIntOrZero(drpYear.SelectedValue);
|
||||
var quarter = Funs.GetNewIntOrZero(drpQuarters.SelectedValue);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user