using System; using System.Data; using System.Web.UI; using System.Web.UI.WebControls; using SuperMap.RealEstate.CoreFrameWork; using SuperMap.RealEstate.Web.UI; using SuperMap.RealEstate.Web.UI.WebControls; using Business = SuperMap.RealEstate.HighWay.Running.Business; using HZQR.Common; namespace SuperMap.RealEstate.HighWay.Compents.Supplement { public partial class Default : UserControl { Running.Business.HIGHWAYPROINST _HighWayProInst = null; protected override void OnInit(EventArgs e) { Common.PageHelper.CreateHeaderStyle(Page); _HighWayProInst = Running.Business.HIGHWAYPROINST.CreateInstance(Page); ButtonVisible = false; //隐藏打印受理单按钮 ((IWorkFlowPage)Page).SetAcceptBillButton(false); //隐藏受理单按钮 base.OnInit(e); } protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; if (ModifyType == ModifyTypeEnum.Edit || ModifyType == ModifyTypeEnum.EditVisible) { ButtonNew.Visible = true; } else { ButtonNew.Visible = false; } //初始化并加载列表 GridViewEx1.SelectingWithInit(ObjectDataSource1, GridPageEx1); //工具条按钮事件 GridViewEx1.SetOpenControl(ButtonNew, "/HighWay/Compents/Supplement/SUPPLYACCOUNTPage.aspx?HIGHWAYPROINST_ID=" + _HighWayProInst.HIGHWAYPROINST_ID_Encrypt + "&ModifyType=" + ModifyType.ToString()); //设置回车焦点按钮 Page.SetControlClientAction(ButtonSearch); } //在此加入界面的数据初始化(Page_Load之前),如DropDownList的数据源绑定等 public override void InitializeWebControl() { //经营业态 //BUSINESS_TRADE.Items.Add(new ListItemEx("全部", "-1")); //DictionaryHelper.BindingDropDownList("BUSINESS_TRADE", BUSINESS_TRADE.Items, Transaction); } #region 方法 -> 载入数据 public override bool LoadData() { return true; } #endregion #region 方法 -> 列表事件 //查询 protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e) { GridViewEx1.Selecting(ObjectDataSource1, GridPageEx1); //设置UI变化 e.SetValue(GridViewEx1); e.SetValue(GridPageEx1); e.ExcuteClientScript("setData(\"" + CASHPAY.Text + "\")"); } //翻页事件 protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e) { GridViewEx1.Pagging(ObjectDataSource1, GridPageEx1); //设置UI变化 e.SetValue(GridViewEx1); e.ExcuteClientScript("setData(\"" + CASHPAY.Text + "\")"); } //查询SQL设置 protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e) { //搜索选项的搜索条件过滤 if (!string.IsNullOrEmpty(TextBox_Search.Text)) e.AddOrParams(GridViewSearch1, TextBox_Search.Text); //且搜索条件 e.AddAndParams("HIGHWAYPROINST_ID", _HighWayProInst.HIGHWAYPROINST_ID); //经营业态 //if (BUSINESS_TRADE.SelectedValue != "-1") //{ // e.AddAndParams("BUSINESS_TRADE", BUSINESS_TRADE.SelectedValue); //} //经营模式 if (!string.IsNullOrWhiteSpace(BUSINESS_TYPE.SelectedValue) && BUSINESS_TYPE.SelectedValue != "-1") { e.AddAndParams("BUSINESS_TYPE", BUSINESS_TYPE.SelectedValue); } //排序 e.AddOrderByParams(GridViewOrderBy1); } #endregion protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { DataTable CashPayTable = new Running.Business.SUPPLYACCOUNT(Transaction).ExecuteDataTable( "SELECT SUM(CASHPAY) AS CASHPAY FROM T_SUPPLYACCOUNT WHERE HIGHWAYPROINST_ID = " + _HighWayProInst.HIGHWAYPROINST_ID); if (CashPayTable.Rows.Count > 0 && CashPayTable.Rows[0][0].ToString() != "") { CASHPAY.Text = CashPayTable.Rows[0][0].ToString().TryParseToDouble().ToString("0.00"); } else { CASHPAY.Text = "0.00"; } } else if (e.Row.RowType == DataControlRowType.DataRow) { string _SUPPLYACCOUNT_ID = GridViewEx1.DataKeys[e.Row.RowIndex]["SUPPLYACCOUNT_ID"].ToEncrypt(); e.Row.Attributes["onclick"] = GridViewEx1.GetOpenPopDialogClientScript("/HighWay/Compents/Supplement/SUPPLYACCOUNTPage.aspx?ID=" + _SUPPLYACCOUNT_ID + "&HIGHWAYPROINST_ID=" + _HighWayProInst.HIGHWAYPROINST_ID_Encrypt + "&ModifyType=" + ModifyType.ToString()); foreach (ListItemEx _ListItemEx in BUSINESS_TYPE.Items) { if (_ListItemEx.Value == e.Row.Cells[5].Text) { e.Row.Cells[5].Text = _ListItemEx.Text; } } } } } }