2025-03-27 15:05:14 +08:00

133 lines
5.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using SuperMap.RealEstate.CoreFrameWork;
using SuperMap.RealEstate.ServiceModel;
using SuperMap.RealEstate.Utility;
using SuperMap.RealEstate.Web.UI;
using SuperMap.RealEstate.Web.UI.WebControls;
using SuperMap.RealEstate.Web.Utility;
using Business = SuperMap.RealEstate.SendRec.Storage.Business;
using HighWayBusiness = SuperMap.RealEstate.HighWay.Storage.Business;
using StorageHighWay = SuperMap.RealEstate.HighWay.Storage;
namespace SuperMap.RealEstate.SendRec.Modules.SearchCommodity
{
public partial class ObjectPage : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
//初始化并加载列表
InitWebControls();
GridViewEx1.SelectingWithInit<Business.APPLYCOMMODITY>(ObjectDataSource1, GridPageEx1,
DictionaryHelper.GetDictionary(Transaction, "COMMODITYGRADE").AsNewKeys("COMMODITY_GRADE"));
//设置回车焦点按钮
SetControlClientAction(ButtonSearch);
}
private void InitWebControls()
{
SERVERPART_ID.Clear();
ListItemEx _ListItemEx = new ListItemEx();
_ListItemEx.Text = StorageHighWay.Business.CommonHelper.GetConfigValue("bCompanyName");
_ListItemEx.Value = "0";
SERVERPART_ID.Items.Add(_ListItemEx);
foreach (StorageHighWay.Business.SERVERPART _SERVERPART in (new StorageHighWay.Business.SERVERPART(this.Transaction)).GetPassportServerPart(PassportInfo.CityAuthority))
{
_ListItemEx = new ListItemEx();
_ListItemEx.Text = _SERVERPART.SERVERPART_NAME;
_ListItemEx.Value = _SERVERPART.SERVERPART_ID.ToString();
SERVERPART_ID.Items.Add(_ListItemEx);
}
if (Session["SERVERPART_ID"] != null)
{
SERVERPART_ID.SelectedValue = Session["SERVERPART_ID"].ToString();
}
}
//查询
protected void ButtonSearch_CallBackClick(object sender,ClientSetEventArgs e)
{
GridViewEx1.Selecting<Business.APPLYCOMMODITY>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
e.SetValue(GridPageEx1);
}
//翻页事件
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
{
GridViewEx1.Pagging<Business.APPLYCOMMODITY>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
}
//查询SQL设置
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
{
//搜索选项的搜索条件过滤
if (!string.IsNullOrEmpty(TextBox_Search.Text))
e.AddOrParams(GridViewSearch1, TextBox_Search.Text);
//添加商品类别过滤
//添加服务区选项
e.AddAndParams("SERVERPART_ID", SERVERPART_ID.SelectedValue);
if (Request["ID"] != null)
{
string OutTypeString = Request["ID"].ToDecrypt();
StorageHighWay.Business.COMMODITYTYPE _COMMODITYTYPE = new StorageHighWay.Business.COMMODITYTYPE(this.Transaction);
_COMMODITYTYPE.GetSubCommodityType(ref OutTypeString, Request["ID"].ToDecrypt(), "", true);
e.SetOtherUserCustomWhereSqlString = "COMMODITYTYPE_ID in(" + OutTypeString + ")";
}
else
e.AddAndParams("COMMODITYTYPE_ID", -1);
//排序
e.AddOrderByParams(GridViewOrderBy1);
}
protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
try
{
HighWayBusiness.COMMODITYTYPE _COMMODITYTYPE = new HighWayBusiness.COMMODITYTYPE(this.Transaction);
_COMMODITYTYPE.COMMODITYTYPE_ID_Encrypt = e.Row.Cells[2].Text.ToEncrypt();
if (_COMMODITYTYPE.Select())
{
e.Row.Cells[2].Text = _COMMODITYTYPE.COMMODITYTYPE_NAME;
}
}
catch
{ }
//进货明细--领用明细
string _SERVERPARTSTOCK_ID = GridViewEx1.DataKeys[e.Row.RowIndex].Values["SERVERPARTSTOCK_ID"].ToString().ToEncrypt();
LinkButton LinkButton_Proinst = (LinkButton)e.Row.FindControl("LinkButton_Proinst");
LinkButton_Proinst.OnClientClick = GridViewEx1.GetOpenPopDialogClientScript("Proinst/APPLYPROINSTList.aspx?SERVERPARTSTOCK_ID=" + _SERVERPARTSTOCK_ID , 1000, 600) + " return false;";
}
}
protected void SERVERPART_ID_CallBackSetControl(object sender, ClientSetEventArgs e)
{
Session["SERVERPART_ID"] = SERVERPART_ID.SelectedValue;
//刷新数据
ButtonSearch_CallBackClick(null, e);
}
}
}