20230606新增费用申请页面、项目列表按活跃度排序
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.ProjectData
|
||||
{
|
||||
public partial class ProjectUnitSave : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 定义项
|
||||
/// </summary>
|
||||
@@ -20,6 +23,31 @@ namespace FineUIPro.Web.ProjectData
|
||||
}
|
||||
}
|
||||
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string UnitId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["UnitId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["UnitId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
@@ -42,11 +70,13 @@ namespace FineUIPro.Web.ProjectData
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(projectUnit.ProjectId);
|
||||
if (project != null)
|
||||
{
|
||||
this.ProjectId = projectUnit.ProjectId;
|
||||
this.lbProjectName.Text = project.ProjectName;
|
||||
}
|
||||
var unit = BLL.UnitService.GetUnitByUnitId(projectUnit.UnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
this.UnitId = projectUnit.UnitId;
|
||||
this.lbUnitName.Text = unit.UnitName;
|
||||
this.txtCollCropCode.Text = unit.CollCropCode;
|
||||
this.txtLinkName.Text = unit.LinkName;
|
||||
@@ -81,6 +111,8 @@ namespace FineUIPro.Web.ProjectData
|
||||
}
|
||||
this.txtContractRange.Text = projectUnit.ContractRange;
|
||||
}
|
||||
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,5 +158,117 @@ namespace FineUIPro.Web.ProjectData
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
this.Grid1.DataSource =ProjectUnitService.GetProjectUnitItemList(this.ProjectId, this.UnitId);
|
||||
this.Grid1.PageIndex = 0;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.EditData();
|
||||
}
|
||||
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
this.EditData();
|
||||
}
|
||||
|
||||
private void EditData()
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
reSetTable(true);
|
||||
var trainTypeItem = ProjectUnitService.GetProjectUnitItemById(Grid1.SelectedRowID);
|
||||
if (trainTypeItem != null)
|
||||
{
|
||||
this.txtContractNum.Text = trainTypeItem.ContractNum.ToString();
|
||||
this.txtTotalMoney.Text = trainTypeItem.TotalMoney.ToString();
|
||||
this.txtHSEMoney.Text = trainTypeItem.HSEMoney.ToString();
|
||||
this.hdProjectUnitItemId.Text = trainTypeItem.ProjectUnitItemId;
|
||||
}
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
BLL.ProjectUnitService.DeleteProjectUnitItemById(rowID);
|
||||
}
|
||||
}
|
||||
|
||||
this.BindGrid();
|
||||
this.reSetTable(false);
|
||||
this.ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
reSetTable(true);
|
||||
}
|
||||
|
||||
protected void btnItemSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.ProjectId) && !string.IsNullOrEmpty(this.UnitId))
|
||||
{
|
||||
Model.Project_ProjectUnitItem newItem = new Model.Project_ProjectUnitItem()
|
||||
{
|
||||
ProjectId = this.ProjectId,
|
||||
UnitId = this.UnitId,
|
||||
ContractNum = this.txtContractNum.Text.Trim(),
|
||||
TotalMoney = Funs.GetNewDecimalOrZero(this.txtTotalMoney.Text.Trim()),
|
||||
HSEMoney = Funs.GetNewDecimalOrZero(this.txtHSEMoney.Text.Trim()),
|
||||
};
|
||||
|
||||
var getItem = ProjectUnitService.GetProjectUnitItemById(this.hdProjectUnitItemId.Text);
|
||||
if (getItem != null)
|
||||
{
|
||||
newItem.ProjectUnitItemId = getItem.ProjectUnitItemId;
|
||||
ProjectUnitService.UpdateProjectUnitItem(newItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
newItem.CompileDate = DateTime.Now;
|
||||
newItem.CompileManId = this.CurrUser.PersonId;
|
||||
ProjectUnitService.AddProjectUnitItem(newItem);
|
||||
}
|
||||
|
||||
reSetTable(false);
|
||||
this.ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
this.BindGrid();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ShowNotify("请重新选择单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置
|
||||
/// </summary>
|
||||
private void reSetTable(bool isShow)
|
||||
{
|
||||
this.txtContractNum.Focus();
|
||||
this.tr0.Hidden = !isShow;
|
||||
this.txtContractNum.Text = string.Empty;
|
||||
this.txtTotalMoney.Text = string.Empty;
|
||||
this.txtHSEMoney.Text = string.Empty;
|
||||
this.hdProjectUnitItemId.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user