2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.ProjectData
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class ProjectUnitSave : PageBase
|
|
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
#region 定义项
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 定义项
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string ProjectUnitId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["ProjectUnitId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["ProjectUnitId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-06-06 17:01:34 +08:00
|
|
|
|
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
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载页面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
|
|
|
|
BLL.ConstValue.InitConstValueDropDownList(this.drpUnitType, ConstValue.Group_ProjectUnitType, true);
|
|
|
|
|
|
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpIdcardType, "ZHENGJIAN_TYPE", true);
|
|
|
|
|
|
this.drpIdcardType.SelectedValue = "SHENFEN_ZHENGJIAN";
|
2023-06-13 16:30:08 +08:00
|
|
|
|
this.ckIsSynchro.Checked = false;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
this.ProjectUnitId = Request.QueryString["ProjectUnitId"];
|
|
|
|
|
|
if (!String.IsNullOrEmpty(this.ProjectUnitId))
|
|
|
|
|
|
{
|
|
|
|
|
|
var projectUnit = BLL.ProjectUnitService.GetProjectUnitById(this.ProjectUnitId);
|
|
|
|
|
|
if (projectUnit != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var project = BLL.ProjectService.GetProjectByProjectId(projectUnit.ProjectId);
|
|
|
|
|
|
if (project != null)
|
|
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
this.ProjectId = projectUnit.ProjectId;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
this.lbProjectName.Text = project.ProjectName;
|
|
|
|
|
|
}
|
|
|
|
|
|
var unit = BLL.UnitService.GetUnitByUnitId(projectUnit.UnitId);
|
|
|
|
|
|
if (unit != null)
|
|
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
this.UnitId = projectUnit.UnitId;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
this.lbUnitName.Text = unit.UnitName;
|
|
|
|
|
|
this.txtCollCropCode.Text = unit.CollCropCode;
|
|
|
|
|
|
this.txtLinkName.Text = unit.LinkName;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(unit.IdcardType))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.drpIdcardType.SelectedValue = unit.IdcardType;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.txtIdcardNumber.Text = unit.IdcardNumber;
|
|
|
|
|
|
this.txtLinkMobile.Text = unit.LinkMobile;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(unit.IsChina))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.rblIsChina.SelectedValue = unit.IsChina;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(unit.CollCropStatus))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.rblCollCropStatus.SelectedValue = unit.CollCropStatus;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.txtInTime.Text = string.Format("{0:yyyy-MM-dd}", projectUnit.InTime);
|
|
|
|
|
|
this.txtOutTime.Text = string.Format("{0:yyyy-MM-dd}", projectUnit.OutTime);
|
|
|
|
|
|
if (!string.IsNullOrEmpty(projectUnit.UnitType))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.drpUnitType.SelectedValue = projectUnit.UnitType;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (projectUnit.PlanCostA.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.nbPlanCostA.Text = projectUnit.PlanCostA.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (projectUnit.PlanCostB.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.nbPlanCostB.Text = projectUnit.PlanCostB.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
this.txtContractRange.Text = projectUnit.ContractRange;
|
2023-06-13 16:30:08 +08:00
|
|
|
|
if (projectUnit.IsSynchro == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.ckIsSynchro.Checked = true;
|
|
|
|
|
|
}
|
2026-01-24 15:01:27 +08:00
|
|
|
|
if (projectUnit.IsOutSideUnit == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.ckIsOutSideUnit.Checked = true;
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2023-06-06 17:01:34 +08:00
|
|
|
|
|
|
|
|
|
|
this.BindGrid();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 保存数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var newProjectUnit = BLL.ProjectUnitService.GetProjectUnitById(this.ProjectUnitId);
|
|
|
|
|
|
if (newProjectUnit != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
newProjectUnit.InTime = Funs.GetNewDateTime(this.txtInTime.Text.Trim());
|
|
|
|
|
|
newProjectUnit.OutTime = Funs.GetNewDateTime(this.txtOutTime.Text.Trim());
|
|
|
|
|
|
if (this.drpUnitType.SelectedValue != BLL.Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
newProjectUnit.UnitType = this.drpUnitType.SelectedValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
newProjectUnit.PlanCostA = Funs.GetNewDecimalOrZero(this.nbPlanCostA.Text.Trim());
|
|
|
|
|
|
newProjectUnit.PlanCostB = Funs.GetNewDecimalOrZero(this.nbPlanCostB.Text.Trim());
|
|
|
|
|
|
newProjectUnit.ContractRange = this.txtContractRange.Text.Trim();
|
2023-06-13 16:30:08 +08:00
|
|
|
|
if (this.ckIsSynchro.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
newProjectUnit.IsSynchro = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
newProjectUnit.IsSynchro = false;
|
|
|
|
|
|
}
|
2026-01-24 15:01:27 +08:00
|
|
|
|
if (this.ckIsOutSideUnit.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
newProjectUnit.IsOutSideUnit = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
newProjectUnit.IsOutSideUnit = null;
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
BLL.ProjectUnitService.UpdateProjectUnit(newProjectUnit);
|
|
|
|
|
|
Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(newProjectUnit.UnitId);
|
|
|
|
|
|
if (unit != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.IsChina = this.rblIsChina.SelectedValue;
|
|
|
|
|
|
unit.CollCropCode = this.txtCollCropCode.Text.Trim();
|
|
|
|
|
|
unit.LinkName = this.txtLinkName.Text.Trim();
|
|
|
|
|
|
if (this.drpIdcardType.SelectedValue != BLL.Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.IdcardType = this.drpIdcardType.SelectedValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
unit.IdcardNumber = this.txtIdcardNumber.Text.Trim();
|
|
|
|
|
|
unit.LinkMobile = this.txtLinkMobile.Text.Trim();
|
|
|
|
|
|
unit.CollCropStatus = this.rblCollCropStatus.SelectedValue;
|
|
|
|
|
|
BLL.UnitService.UpdateUnit(unit);
|
|
|
|
|
|
}
|
|
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, null, newProjectUnit.ProjectUnitId, BLL.Const.ProjectUnitMenuId, BLL.Const.BtnModify);
|
|
|
|
|
|
ShowNotify("保存数据成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
// 2. 关闭本窗体,然后回发父窗体
|
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-06 17:01:34 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
this.Grid1.DataSource = ProjectUnitService.GetProjectUnitItemList(this.ProjectId, this.UnitId);
|
2023-06-06 17:01:34 +08:00
|
|
|
|
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)
|
2025-10-10 14:33:21 +08:00
|
|
|
|
{
|
2023-06-06 17:01:34 +08:00
|
|
|
|
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();
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
2023-06-06 17:01:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|