2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
using FineUIPro.Web.BaseInfo;
|
|
|
|
|
|
using Model;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HSSE.CostGoods
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class CostManageItemEdit : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
#region 定义项
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 主键
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private string CostManageItemId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["CostManageItemId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["CostManageItemId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 费用管理主键
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private string CostManageId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["CostManageId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["CostManageId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 加载
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载页面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
|
|
|
|
this.CostManageId = Request.Params["CostManageId"];
|
2023-06-06 17:01:34 +08:00
|
|
|
|
this.CostManageItemId = Request.Params["CostManageItemId"] ?? SQLHelper.GetNewID();
|
|
|
|
|
|
|
|
|
|
|
|
CostTypeService.InitCostTypeDropDownList(this.drpSupCostType, true);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(this.CostManageItemId))
|
|
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
var costManageItem = BLL.CostManageItemService.GetCostManageItemById(this.CostManageItemId);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (costManageItem != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.CostManageId = costManageItem.CostManageId;
|
2023-06-06 17:01:34 +08:00
|
|
|
|
this.drpSupCostType.SelectedValue = costManageItem.SupCostTypeId;
|
|
|
|
|
|
CostTypeService.InitCostTypeItemDropDownList(this.drpCostType, this.drpSupCostType.SelectedValue, false);
|
|
|
|
|
|
this.drpCostType.SelectedValue = costManageItem.CostTypeId;
|
|
|
|
|
|
this.txtInvestCostProject.Text= costManageItem.InvestCostProject;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (costManageItem.PriceMoney != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.txtPriceMoney.Text = Convert.ToString(costManageItem.PriceMoney);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 保存
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 保存按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
bool isSave = true;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
Model.CostGoods_CostManageItem costManageItem = new Model.CostGoods_CostManageItem
|
|
|
|
|
|
{
|
|
|
|
|
|
CostManageId = this.CostManageId,
|
2023-06-06 17:01:34 +08:00
|
|
|
|
CostManageItemId = this.CostManageItemId,
|
|
|
|
|
|
InvestCostProject = this.txtInvestCostProject.Text.Trim(),
|
2022-09-05 16:36:31 +08:00
|
|
|
|
PriceMoney = Funs.GetNewDecimalOrZero(this.txtPriceMoney.Text.Trim()),
|
|
|
|
|
|
};
|
2023-06-06 17:01:34 +08:00
|
|
|
|
|
|
|
|
|
|
var getSupType =CostTypeService.GetCostTypeById(this.drpSupCostType.SelectedValue);
|
|
|
|
|
|
if (getSupType != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
costManageItem.SupCostTypeId = getSupType.CostTypeId;
|
|
|
|
|
|
costManageItem.SupCostTypeName = getSupType.CostTypeName;
|
|
|
|
|
|
costManageItem.SupSortIndex = getSupType.CostTypeCode;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
isSave = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
var getCostType=CostTypeService.GetCostTypeItemById(this.drpCostType.SelectedValue);
|
|
|
|
|
|
if (getCostType != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
costManageItem.CostTypeId = getCostType.CostTypeItemId;
|
|
|
|
|
|
costManageItem.CostTypeName = getCostType.CostTypeItemName;
|
|
|
|
|
|
costManageItem.SortIndex = getCostType.SortIndex;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
isSave = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isSave)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
var getItem = BLL.CostManageItemService.GetCostManageItemById(this.CostManageItemId);
|
|
|
|
|
|
if (getItem != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
costManageItem.CostManageItemId = this.CostManageItemId;
|
|
|
|
|
|
BLL.CostManageItemService.UpdateCostManageItem(costManageItem);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
costManageItem.CostManageItemId = this.CostManageItemId;
|
|
|
|
|
|
BLL.CostManageItemService.AddCostManageItem(costManageItem);
|
|
|
|
|
|
}
|
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
Alert.ShowInTop("费用类别或分项存在问题,请重新选择!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-06-06 17:01:34 +08:00
|
|
|
|
/// 类型下拉框
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
2023-06-06 17:01:34 +08:00
|
|
|
|
protected void drpSupCostType_SelectedIndexChanged(object sender, EventArgs e)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
CostTypeService.InitCostTypeItemDropDownList(this.drpCostType,this.drpSupCostType.SelectedValue, false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 附件上传
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 上传附件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/CostManageItemAttachUrl&menuId={1}", this.CostManageItemId, BLL.Const.ProjectCostManageMenuId)));
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|