107 lines
3.6 KiB
C#
107 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.SysManage
|
|
{
|
|
public partial class MasterOrg : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
// 绑定表格
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT BlgGroup,PAdOrgCode,AdOrgCode,AdOrgName,Shortname,SocCrCode,LocAdd,OrgType,IsEnable,
|
|
CASE OrgType WHEN '01' THEN '单位' WHEN '06' THEN '部门' ELSE '' END AS OrgTypeStr,
|
|
CASE IsEnable WHEN '1' THEN '已启用' WHEN '0' THEN '未启用' ELSE '未启用' END AS IsEnableStr
|
|
From CNCEC_MasterData_ad_org AS org
|
|
WHERE 1=1 ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (!string.IsNullOrEmpty(this.txtName.Text.Trim()))
|
|
{
|
|
strSql += " AND (org.AdOrgName LIKE @Name OR org.Shortname LIKE @Name)";
|
|
listStr.Add(new SqlParameter("@Name", "%" + this.txtName.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(this.rbOrgType.SelectedValue))
|
|
{//组织类型
|
|
strSql += " AND org.OrgType = @OrgType";
|
|
listStr.Add(new SqlParameter("@OrgType", this.rbOrgType.SelectedValue));
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(this.rbIsEnable.SelectedValue))
|
|
{//启用状态
|
|
strSql += " AND org.IsEnable = @IsEnable";
|
|
listStr.Add(new SqlParameter("@IsEnable", this.rbIsEnable.SelectedValue));
|
|
}
|
|
strSql += " ORDER BY PAdOrgCode,AdOrgCode ";
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
// var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = tb;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 从集团获取
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnGet_Click(object sender, EventArgs e)
|
|
{
|
|
GetMasterOrg();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 从集团获取主数据组织架构
|
|
/// </summary>
|
|
protected void GetMasterOrg()
|
|
{
|
|
var returnValue = MasterOrgService.GetMasterOrgDataInfos(this.CurrUser.UserName);
|
|
if (returnValue.code == 1)
|
|
{
|
|
ShowNotify(returnValue.message, MessageBoxIcon.Success);
|
|
this.BindGrid();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop(returnValue.message, MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
}
|
|
} |