| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Data.SqlClient; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Web; | 
					
						
							|  |  |  |  | using BLL; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.ZHGL.RealName | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class BasicData : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 GetButtonPower(); | 
					
						
							|  |  |  |  |                 SynchroSetService.InitCountryDropDownList(this.drpCountry, false); | 
					
						
							|  |  |  |  |                 this.drpCountry.SelectedValue ="101"; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 SynchroSetService.InitProjectDropDownList(this.drpProject, false); | 
					
						
							| 
									
										
										
										
											2021-06-18 20:37:07 +08:00
										 |  |  |  |                 if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2021-07-06 15:16:17 +08:00
										 |  |  |  |                     var getproject = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); | 
					
						
							|  |  |  |  |                     if (getproject != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2021-07-08 20:34:29 +08:00
										 |  |  |  |                         this.drpProject.SelectedValue = getproject.JTProjectCode; | 
					
						
							| 
									
										
										
										
											2021-07-06 15:16:17 +08:00
										 |  |  |  |                         this.drpProject.Readonly = true; | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-06-18 20:37:07 +08:00
										 |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 // 绑定表格 | 
					
						
							|  |  |  |  |                 this.BindGrid(); | 
					
						
							|  |  |  |  |                 this.BindGrid2(); | 
					
						
							|  |  |  |  |                 this.BindGrid3(); | 
					
						
							|  |  |  |  |                 this.BindGrid4(); | 
					
						
							|  |  |  |  |                 this.BindGrid5(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 获取按钮权限 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取按钮权限 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="button"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         private void GetButtonPower() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2021-12-16 17:09:14 +08:00
										 |  |  |  |             string menuId = !string.IsNullOrEmpty(this.CurrUser.LoginProjectId) ? Const.ProjectRealNameBasicDataMenuId : Const.ServerRealNameBasicDataMenuId; | 
					
						
							| 
									
										
										
										
											2021-06-18 20:37:07 +08:00
										 |  |  |  |             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, menuId); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             if (buttonList.Count() > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (buttonList.Contains(BLL.Const.BtnSave)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     //this.btnSave.Hidden = false; | 
					
						
							|  |  |  |  |                     this.btnDatabaseGo.Hidden = false; | 
					
						
							|  |  |  |  |                     this.btnDatabaseGo2.Hidden = false; | 
					
						
							|  |  |  |  |                     this.btnDatabaseGo3.Hidden = false; | 
					
						
							|  |  |  |  |                     this.btnDatabaseGo31.Hidden = false; | 
					
						
							|  |  |  |  |                     this.btnDatabaseGo4.Hidden = false; | 
					
						
							|  |  |  |  |                     this.btnDatabaseGo5.Hidden = false; | 
					
						
							|  |  |  |  |                     this.btnDatabaseGo51.Hidden = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region TAB 1 基础字典数据 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string strSql = @"SELECT BasicDataId,dictTypeCode,dictCode,dictName FROM dbo.RealName_BasicData" | 
					
						
							|  |  |  |  |                                 + @" WHERE 1=1"; | 
					
						
							|  |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.drpBaseType.SelectedValue)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND dictTypeCode = @dictTypeCode"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@dictTypeCode", this.drpBaseType.SelectedValue)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             Grid1.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid1, tb); | 
					
						
							|  |  |  |  |             Grid1.DataSource = table; | 
					
						
							|  |  |  |  |             Grid1.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         protected void drpBaseType_SelectedIndexChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         protected void btnDatabaseGo_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowNotify(BLL.SynchroSetService.getBasicData(this.drpBaseType.SelectedValue), MessageBoxIcon.Information); | 
					
						
							|  |  |  |  |             this.BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region TAB 2 国家数据 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnDatabaseGo2_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowNotify(BLL.SynchroSetService.getCountry(), MessageBoxIcon.Information); | 
					
						
							|  |  |  |  |             this.BindGrid2(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid2() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string strSql = @"SELECT ID,CountryId,countryCode,cname,name FROM dbo.RealName_Country" | 
					
						
							|  |  |  |  |                                 + @" WHERE 1=1"; | 
					
						
							|  |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             //if (!string.IsNullOrEmpty(this.drpBaseType.SelectedValue)) | 
					
						
							|  |  |  |  |             //{ | 
					
						
							|  |  |  |  |             //    strSql += " AND dictTypeCode = @dictTypeCode"; | 
					
						
							|  |  |  |  |             //    listStr.Add(new SqlParameter("@dictTypeCode", this.drpBaseType.SelectedValue)); | 
					
						
							|  |  |  |  |             //} | 
					
						
							|  |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             Grid2.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid2, tb); | 
					
						
							|  |  |  |  |             Grid2.DataSource = table; | 
					
						
							|  |  |  |  |             Grid2.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region TAB 3 省份数据 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 国家下拉框 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void drpCountry_SelectedIndexChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.BindGrid3(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid3() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string strSql = @"SELECT ID,provinceCode,cityCode,cname,cnShortName,name,countryId FROM dbo.RealName_City" | 
					
						
							|  |  |  |  |                                 + @" WHERE 1=1"; | 
					
						
							|  |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.drpCountry.SelectedValue)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND countryId = @countryId"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@countryId", this.drpCountry.SelectedValue)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             Grid3.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid3, tb); | 
					
						
							|  |  |  |  |             Grid3.DataSource = table; | 
					
						
							|  |  |  |  |             Grid3.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         protected void btnDatabaseGo3_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowNotify(BLL.SynchroSetService.getCity(this.drpCountry.SelectedValue), MessageBoxIcon.Information); | 
					
						
							|  |  |  |  |             this.BindGrid3(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void btnDatabaseGo31_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowNotify(BLL.SynchroSetService.getCity(null), MessageBoxIcon.Information); | 
					
						
							|  |  |  |  |             this.BindGrid3(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region TAB 4 项目数据 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取项目数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnDatabaseGo4_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2021-07-08 20:34:29 +08:00
										 |  |  |  |             List<string> getCodeList = new List<string>(); | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 var getProject = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); | 
					
						
							|  |  |  |  |                 if (getProject != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     getCodeList.Add(getProject.JTProjectCode); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 getCodeList = Funs.DB.RealName_SynchroSet.Select(x => x.ProCode).ToList(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (getCodeList != null && getCodeList.Count() > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 string info = string.Empty; | 
					
						
							|  |  |  |  |                 foreach (var item in getCodeList) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     info += "项目[" + item + "]" + SynchroSetService.getProject(item); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 ShowNotify(info, MessageBoxIcon.Information); | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             this.BindGrid4(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定项目数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid4() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string strSql = @"SELECT ID,proCode,proName,proShortName FROM dbo.RealName_Project" | 
					
						
							|  |  |  |  |                                 + @" WHERE 1=1"; | 
					
						
							|  |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             //if (!string.IsNullOrEmpty(this.drpBaseType.SelectedValue)) | 
					
						
							|  |  |  |  |             //{ | 
					
						
							|  |  |  |  |             //    strSql += " AND dictTypeCode = @dictTypeCode"; | 
					
						
							|  |  |  |  |             //    listStr.Add(new SqlParameter("@dictTypeCode", this.drpBaseType.SelectedValue)); | 
					
						
							|  |  |  |  |             //} | 
					
						
							|  |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             Grid4.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid4, tb); | 
					
						
							|  |  |  |  |             Grid4.DataSource = table; | 
					
						
							|  |  |  |  |             Grid4.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region TAB 5 施工队数据 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 国家下拉框 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void drpProject_SelectedIndexChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             this.BindGrid5(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid5() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string strSql = @"SELECT ID,teamId,proCode,teamName,teamLeaderName,teamLeaderMobile FROM dbo.RealName_CollTeam" | 
					
						
							|  |  |  |  |                                 + @" WHERE 1=1"; | 
					
						
							|  |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.drpProject.SelectedValue)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND proCode = @proCode"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@proCode", this.drpProject.SelectedValue)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             Grid5.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid5, tb); | 
					
						
							|  |  |  |  |             Grid5.DataSource = table; | 
					
						
							|  |  |  |  |             Grid5.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         protected void btnDatabaseGo5_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowNotify(BLL.SynchroSetService.getCollTeam(this.drpProject.SelectedValue), MessageBoxIcon.Information); | 
					
						
							|  |  |  |  |             this.BindGrid5(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void btnDatabaseGo51_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ShowNotify(BLL.SynchroSetService.getCollTeam(null), MessageBoxIcon.Information); | 
					
						
							|  |  |  |  |             this.BindGrid5(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |