using System; using System.Collections.Generic; using System.Data; using System.Web.UI.WebControls; using SuperMap.RealEstate.Web.UI; using SuperMap.RealEstate.Web.UI.WebControls; using HZQR.Common; using Newtonsoft.Json.Linq; using System.Text; using System.Linq; using Business = SuperMap.RealEstate.HighWay.Storage.Business; using PersonnelBusiness = SuperMap.RealEstate.Personnel.Storage.Business; namespace SuperMap.RealEstate.Personnel.Modules.Department { public partial class DepartmentServer : BasePage { protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; //设置回车焦点按钮 SetControlClientAction(ButtonAdd); GridViewEx1.SelectingWithInit(ObjectDataSource1, null); } protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e) { GridViewEx1.Selecting(ObjectDataSource1, null); //设置UI变化 e.SetValue(GridViewEx1); } protected void GridViewEx1_SelectMethodParameters(object sender, Web.UI.WebControls.SelectMethodParametersArgs e) { if (!string.IsNullOrEmpty(TextBox_Search.Text)) { e.AddOrParams(GridViewSearch1, TextBox_Search.Text); } //if (!string.IsNullOrEmpty(Request["AUTHORITY"])) //{ // e.SetOtherUserCustomWhereSqlString = " SERVERPART_ID IN (" + Request["AUTHORITY"].ToDecrypt() + ")"; //} if (!string.IsNullOrEmpty(GoodsProvinceCode)) { e.AddAndParams("PROVINCE_CODE", GoodsProvinceCode); } //排序 e.AddOrderByParams("SPREGIONTYPE_INDEX,SERVERPART_INDEX", false); } #region 方法 -> 上架商品 protected void ButtonAdd_Click(object sender, EventArgs e) { string _SERVERPART_IDs = ""; foreach (GridViewRow _GVR in GridViewEx1.Rows) { if (_GVR.RowType == DataControlRowType.DataRow) { CheckBoxEx _CheckBox = _GVR.Cells[1].FindControl("SingleSelect") as CheckBoxEx; if (_CheckBox.Checked) { string _SERVERPART_ID = GridViewEx1.DataKeys[_GVR.RowIndex]["SERVERPART_ID"].ToString(); _SERVERPART_IDs += (_SERVERPART_IDs == "" ? "" : ",") + _SERVERPART_ID; } } } if (!string.IsNullOrEmpty(Request["ID"])) { PersonnelBusiness.DEPARTMENT _DEPARTMENT = new PersonnelBusiness.DEPARTMENT(Transaction); _DEPARTMENT.DEPARTMENT_ID_Encrypt = Request["ID"]; if (_DEPARTMENT.Select()) { _DEPARTMENT.DEPARTMENT_AUTHORITY = _SERVERPART_IDs; _DEPARTMENT.Update(); } } Alert("关联成功!",3); GridViewEx1.SelectingWithInit(ObjectDataSource1, null); } #endregion protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string _SERVERPART_ID = GridViewEx1.DataKeys[e.Row.RowIndex].Values["SERVERPART_ID"].ToString(); if (!string.IsNullOrEmpty(Request["AUTHORITY"])) { if (("," + Request["AUTHORITY"].ToDecrypt() + ",").Contains("," + _SERVERPART_ID + ",")) { CheckBoxEx _CheckBoxEx = (CheckBoxEx)e.Row.FindControl("SingleSelect"); _CheckBoxEx.Checked = true; } } } } } }