集团三库
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using BLL;
|
||||
using FineUIPro.Web.DataShow;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.SysManage
|
||||
{
|
||||
@@ -30,6 +32,8 @@ namespace FineUIPro.Web.SysManage
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
//主数据组织
|
||||
BindGrid();
|
||||
UnitTypeService.InitUnitTypeDropDownList(this.ddlUnitTypeId, true);
|
||||
BasicDataService.InitBasicDataProjectUnitDropDownList(this.drpIdcardType, "ZHENGJIAN_TYPE", true);
|
||||
this.UnitId = Request.Params["UnitId"];
|
||||
@@ -38,6 +42,11 @@ namespace FineUIPro.Web.SysManage
|
||||
Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(this.UnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(unit.MasterAdOrgCode))
|
||||
{
|
||||
this.drpMasterBox1.Value = unit.MasterAdOrgCode;
|
||||
}
|
||||
|
||||
this.txtUnitCode.Text = unit.UnitCode;
|
||||
this.txtUnitName.Text = unit.UnitName;
|
||||
this.txtUnitEnName.Text = unit.UnitEnName;
|
||||
@@ -77,6 +86,90 @@ namespace FineUIPro.Web.SysManage
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 集团主数据项目
|
||||
|
||||
/// <summary>
|
||||
/// 集团主数据项目
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
var list = MasterOrgService.GetMasterOrgUnits();
|
||||
string code = ttbCodeSearch.Text.Trim();
|
||||
string name = ttbNameSearch.Text.Trim();
|
||||
if (!string.IsNullOrWhiteSpace(code))
|
||||
{
|
||||
list = list.Where(x => x.AdOrgCode.Contains(code)).ToList();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
list = list.Where(x => x.AdOrgName.Contains(name) || x.Shortname.Contains(name)).ToList();
|
||||
}
|
||||
// 1.设置总项数(特别注意:数据库分页一定要设置总记录数RecordCount)
|
||||
Grid1.RecordCount = list.Count();
|
||||
// 2.获取当前分页数据
|
||||
DataTable table = Funs.LINQToDataTable(list);
|
||||
|
||||
// 3.绑定到Grid
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
protected void ttbCodeSearch_Trigger1Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbCodeSearch.Text = string.Empty;
|
||||
ttbCodeSearch.ShowTrigger1 = false;
|
||||
BindGrid();
|
||||
}
|
||||
protected void ttbCodeSearch_Trigger2Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbCodeSearch.ShowTrigger1 = true;
|
||||
BindGrid();
|
||||
}
|
||||
protected void ttbNameSearch_Trigger1Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbNameSearch.Text = string.Empty;
|
||||
ttbNameSearch.ShowTrigger1 = false;
|
||||
BindGrid();
|
||||
}
|
||||
protected void ttbNameSearch_Trigger2Click(object sender, EventArgs e)
|
||||
{
|
||||
ttbNameSearch.ShowTrigger1 = true;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#region 集团主数据组织信息选择触发事件
|
||||
|
||||
/// <summary>
|
||||
/// 集团主数据组织信息选择触发事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void MasterData_Changed(object sender, EventArgs e)
|
||||
{
|
||||
string proName = this.drpMasterBox1.Text.Trim();
|
||||
string adOrgCode = Grid1.SelectedRowID;
|
||||
if (!string.IsNullOrWhiteSpace(adOrgCode))
|
||||
{
|
||||
var org = MasterOrgService.GetMasterOrg(adOrgCode);
|
||||
var relate = Funs.DB.Base_Unit.FirstOrDefault(x => x.MasterAdOrgCode == adOrgCode && (x.UnitId != this.UnitId || (this.UnitId == null && x.UnitId != null)));
|
||||
if (relate != null)
|
||||
{
|
||||
ShowNotify($"已存在关联此主数据的单位:({relate.UnitCode}){relate.UnitName}!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
@@ -113,6 +206,20 @@ namespace FineUIPro.Web.SysManage
|
||||
UnitName = this.txtUnitName.Text.Trim(),
|
||||
UnitEnName = this.txtUnitEnName.Text.TrimStart().TrimEnd()
|
||||
};
|
||||
|
||||
string adOrgCode = this.drpMasterBox1.Value;
|
||||
string adOrgName = this.drpMasterBox1.Text;
|
||||
if (!string.IsNullOrWhiteSpace(adOrgCode))
|
||||
{
|
||||
var relate = Funs.DB.Base_Unit.FirstOrDefault(x => x.MasterAdOrgCode == adOrgCode && (x.UnitId != this.UnitId || (this.UnitId == null && x.UnitId != null)));
|
||||
if (relate != null)
|
||||
{
|
||||
Alert.ShowInTop($"已存在关联此主数据的单位:({relate.UnitCode}){relate.UnitName}!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
unit.MasterAdOrgCode = adOrgCode;
|
||||
unit.MasterAdOrgName = adOrgName;
|
||||
}
|
||||
unit.IsBranch = Convert.ToBoolean(this.rblIsBranch.SelectedValue);
|
||||
unit.UnitTypeId = this.ddlUnitTypeId.SelectedValue;
|
||||
unit.Corporate = this.txtCorporate.Text.Trim();
|
||||
|
||||
Reference in New Issue
Block a user