412 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			412 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using FineUIPro.Web.DataShow;
							 | 
						|||
| 
								 | 
							
								using FineUIPro.Web.ProjectData;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Data.SqlClient;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Web;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.ZHGL.SubPackManage
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class BaseSubPackBlackTeamlist : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            // 表头过滤
							 | 
						|||
| 
								 | 
							
								            //FilterDataRowItem = FilterDataRowItemImplement;
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.InitTreeMenu();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                Funs.DropDownPageSize(this.ddlPageSize);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                GetButtonPower();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                BindGrid();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载树
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void InitTreeMenu()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.tvProjectAndUnit.Nodes.Clear();
							 | 
						|||
| 
								 | 
							
								            var unit = (from x in BLL.Funs.DB.Base_Unit
							 | 
						|||
| 
								 | 
							
								                        join y in BLL.Funs.DB.Base_BranchTeamList on x.UnitId equals y.UnitId
							 | 
						|||
| 
								 | 
							
								                        group x by new { x.UnitId, x.UnitName } into g
							 | 
						|||
| 
								 | 
							
								                        select new
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            UnitName = g.Key.UnitName,
							 | 
						|||
| 
								 | 
							
								                            UnitId = g.Key.UnitId,
							 | 
						|||
| 
								 | 
							
								                        }).ToList();
							 | 
						|||
| 
								 | 
							
								            foreach (var item in unit)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                TreeNode rootNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                rootNode = new TreeNode
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Text = item.UnitName,
							 | 
						|||
| 
								 | 
							
								                    NodeID = item.UnitId,
							 | 
						|||
| 
								 | 
							
								                    ToolTip = "所属分包商",
							 | 
						|||
| 
								 | 
							
								                    CommandName = "unit"
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                };
							 | 
						|||
| 
								 | 
							
								                rootNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                this.tvProjectAndUnit.Nodes.Add(rootNode);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void tvProjectAndUnit_NodeLazyLoad(object sender, TreeNodeEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            DynamicAppendNode(e.Node);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        private void DynamicAppendNode(TreeNode parentNode)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            // 防止浏览器端多次快速点击
							 | 
						|||
| 
								 | 
							
								            parentNode.Nodes.Clear();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            TreeNode node = null;
							 | 
						|||
| 
								 | 
							
								            switch (parentNode.CommandName)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                case "unit":
							 | 
						|||
| 
								 | 
							
								                    GetBranchTeamList(parentNode.Nodes, parentNode);
							 | 
						|||
| 
								 | 
							
								                    if (parentNode.Nodes.Count > 0)
							 | 
						|||
| 
								 | 
							
								                        parentNode.Leaf = false;
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                        parentNode.Leaf = true;
							 | 
						|||
| 
								 | 
							
								                    break;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载劳务公司
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="nodes"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="parentId"></param>
							 | 
						|||
| 
								 | 
							
								        private void GetBranchTeamList(TreeNodeCollection nodes, TreeNode parentNode)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            var branchTeamList = (from x in BLL.Funs.DB.Base_BranchTeamList
							 | 
						|||
| 
								 | 
							
								                                  where x.UnitId == parentNode.NodeID
							 | 
						|||
| 
								 | 
							
								                                  select new
							 | 
						|||
| 
								 | 
							
								                                  {
							 | 
						|||
| 
								 | 
							
								                                      BranchTeamListId = x.BranchTeamListId,
							 | 
						|||
| 
								 | 
							
								                                      BranchTeamListName = x.BranchTeamListName,
							 | 
						|||
| 
								 | 
							
								                                  }).Distinct().ToList();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            TreeNode newNode = null;
							 | 
						|||
| 
								 | 
							
								            foreach (var itme in branchTeamList)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newNode = new TreeNode
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Text = itme.BranchTeamListName,
							 | 
						|||
| 
								 | 
							
								                    NodeID = itme.BranchTeamListId + "|" + parentNode.NodeID,
							 | 
						|||
| 
								 | 
							
								                    ToolTip = "劳务公司",
							 | 
						|||
| 
								 | 
							
								                    CommandName = "branchTeamList",
							 | 
						|||
| 
								 | 
							
								                    Leaf = true
							 | 
						|||
| 
								 | 
							
								                };
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                newNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                nodes.Add(newNode);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 点击TreeView
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 点击TreeView
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void tvProjectAndUnit_NodeCommand(object sender, TreeCommandEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 过滤表头
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Grid1_FilterChange(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 分页
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Grid1.PageIndex = e.NewPageIndex;
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 排序
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Grid1_Sort(object sender, GridSortEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 绑定数据
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public void BindGrid()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            DataTable tb = BranchTeamListData();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            Grid1.RecordCount = tb.Rows.Count;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            tb = GetFilteredTable(Grid1.FilteredData, tb);
							 | 
						|||
| 
								 | 
							
								            var table = this.GetPagedDataTable(Grid1, tb);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            Grid1.DataSource = table;
							 | 
						|||
| 
								 | 
							
								            Grid1.DataBind();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 分页显示条数下拉框
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 加入黑名单
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加入黑名单按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnMenuBack_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var buttonList = BLL.CommonService.GetAllButtonList(null, this.CurrUser.UserId, BLL.Const.BaseSubPackBlackTeamlistMenuId);
							 | 
						|||
| 
								 | 
							
								            if (buttonList.Count <= 0 || !buttonList.Contains(BLL.Const.BtnModify))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("没有操作此功能权限!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (Grid1.SelectedRowIndexArray.Length == 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            string BlackForeignKey = Grid1.SelectedRowID.Split(',')[0];
							 | 
						|||
| 
								 | 
							
								            var item = Funs.DB.View_SubPack_TeamList.FirstOrDefault(p => p.SubPackTeamListDetailID == BlackForeignKey);
							 | 
						|||
| 
								 | 
							
								            if (item == null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("此操作的数据不存在,请检查!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../SubPackManage/SubPackBlackRemark.aspx?BlackForeignKey={0}&IDCard={1}&BlackType={2}&ProjectID={3}", BlackForeignKey, item.CorporateIDCard, Const.SubPackBlackListTeamList, item.ProjectId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 解除黑名单按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnMenuNoTeamListBack_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var buttonList = BLL.CommonService.GetAllButtonList(null, this.CurrUser.UserId, BLL.Const.BaseSubPackBlackTeamlistMenuId);
							 | 
						|||
| 
								 | 
							
								            if (buttonList.Count <= 0 || !buttonList.Contains(BLL.Const.BtnModify))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("没有操作此功能权限!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (Grid1.SelectedRowIndexArray.Length == 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            string id = Grid1.SelectedRowID.Split(',')[0];
							 | 
						|||
| 
								 | 
							
								            //劳务公司名单明细表
							 | 
						|||
| 
								 | 
							
								            var teamListDetail = Funs.DB.SubPack_TeamListDetail.FirstOrDefault(p => p.SubPackTeamListDetailID == id);
							 | 
						|||
| 
								 | 
							
								            //劳务公司变更明细表
							 | 
						|||
| 
								 | 
							
								            var changeRequestDetail = Funs.DB.SubPack_ChangeRequestDetail.FirstOrDefault(p => p.SubPackChangeRequestDetailID == id);
							 | 
						|||
| 
								 | 
							
								            if (teamListDetail == null && changeRequestDetail == null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("你要解除黑名单的数据在数据库已经不存在了,请重新查询试试!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if ((teamListDetail == null || teamListDetail.BackState == "0") && (changeRequestDetail == null || changeRequestDetail.BackState == "0"))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("此劳务队伍已经解除黑名单,请不要重复操作!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            BLL.SubPackBlacklistService.DeleteBackTeamList(id);
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								            ShowNotify("解除黑名单,操作成功)", MessageBoxIcon.Success);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 查询按钮事件
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnQuery_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 获取按钮权限
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 获取按钮权限
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="button"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        private void GetButtonPower()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (Request.Params["value"] == "0")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            var buttonList = BLL.CommonService.GetAllButtonList(null, this.CurrUser.UserId, BLL.Const.BaseBranchTeamListMenuId);
							 | 
						|||
| 
								 | 
							
								            if (buttonList.Count() > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (buttonList.Contains(BLL.Const.BtnModify))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.btnMenuBack.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 数据查询
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        protected DataTable BranchTeamListData()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string selectNode = this.tvProjectAndUnit.SelectedNodeID;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            string strSql = @"select a.SubPackTeamListDetailID,a.UnitWorkId,a.SubPackTeamListName,a.ChargeContract,a.LicenseNumber,a.AptitudeCertNumber,a.EnrollAddress,a.AchievementCondition,a.FundCondition,a.Corporate,a.Remark,a.SortIndex,isnull(a.BackState,'0')BackState,a.CorporateIDCard "
							 | 
						|||
| 
								 | 
							
								                          + @",c.UnitName,d.ProjectName,e.Remark BackRemark "
							 | 
						|||
| 
								 | 
							
								                          + @" FROM View_SubPack_TeamList a"
							 | 
						|||
| 
								 | 
							
								                          + @" inner join Base_BranchTeamList b on a.CorporateIDCard=b.CorporateIDCard "
							 | 
						|||
| 
								 | 
							
								                          + @" left join SubPack_Blacklist e(NOLOCK) on a.SubPackTeamListDetailID=e.BlackForeignKey AND e.BlackType=@BlackType"
							 | 
						|||
| 
								 | 
							
								                          + @" left join Base_Unit c on a.UnitWorkId=c.UnitId "
							 | 
						|||
| 
								 | 
							
								                          + $" left join Base_Project d on a.ProjectId=d.ProjectId WHERE ((a.OrderType = '1' AND a.State = '{Const.SubPackTeamList_AuditCompleted}') OR (a.OrderType = '2' AND a.State = '{Const.SubPackChangeRequest_AuditCompleted}')) ";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            List<SqlParameter> listStr = new List<SqlParameter>();
							 | 
						|||
| 
								 | 
							
								            listStr.Add(new SqlParameter("@BlackType", Const.SubPackBlackListTeamList));
							 | 
						|||
| 
								 | 
							
								            //以叶子结点条件,其它父级节点不要查询
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrWhiteSpace(selectNode))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                string[] nodeArr = selectNode.Split('|');
							 | 
						|||
| 
								 | 
							
								                string toolBranchTeamListId = string.Empty;
							 | 
						|||
| 
								 | 
							
								                if (nodeArr.Length == 2)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    toolBranchTeamListId = nodeArr[0];
							 | 
						|||
| 
								 | 
							
								                    strSql += " AND b.BranchTeamListId=@BranchTeamListId ";
							 | 
						|||
| 
								 | 
							
								                    listStr.Add(new SqlParameter("@BranchTeamListId", toolBranchTeamListId));
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    strSql += " AND 1<>1 ";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                strSql += " AND 1<>1 ";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrWhiteSpace(txtBranchTeamListName.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                strSql += " AND a.SubPackTeamListName like '%'+ @SubPackTeamListName + '%' ";
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@SubPackTeamListName", txtBranchTeamListName.Text.Trim()));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrWhiteSpace(txtProjectName.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                strSql += " AND d.ProjectName like '%'+ @ProjectName + '%' ";
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@ProjectName", txtProjectName.Text.Trim()));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrWhiteSpace(txtCorporate.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                strSql += " AND a.Corporate like '%'+ @Corporate + '%' ";
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@Corporate", txtCorporate.Text.Trim()));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrWhiteSpace(txtCorporateIDCard.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                strSql += " AND a.CorporateIDCard like '%'+ @CorporateIDCard + '%' ";
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@CorporateIDCard", txtCorporateIDCard.Text.Trim()));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (rblState.SelectedValue == "0")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                strSql += " AND isnull(a.BackState,'0')='0' ";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (rblState.SelectedValue == "1")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                strSql += " AND isnull(a.BackState,'0')='1' ";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            SqlParameter[] parameter = listStr.ToArray();
							 | 
						|||
| 
								 | 
							
								            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
							 | 
						|||
| 
								 | 
							
								            return tb;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 把状态转换代号为文字形式
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="state"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        protected string ConvertState(object state)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (state != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (state.ToString() == "0")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    return "正常";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else if (state.ToString() == "1")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    return "黑名单";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    return "";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return "";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 关闭弹出窗
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Window1_Close(object sender, WindowCloseEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void rblState_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |