| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;using Pur.Entity;using Pur.Entity;
- using Pur.Balance;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- using com.hnshituo.pur.vo;
- using Core.Mes.Client.Comm.Control;
- namespace Pur.Pop_upWindow
- {
- public partial class FrmPopGetBalance : FrmPmsBase
- {
- public string balclass;
- private string strM1;
- private string strM2;
- private string strC1;
- private string strC2;
- private UltraGrid ugM;
- private DataTable dtM;
- private UltraGrid ugC;
- private DataTable dtC;
- /** 主键 */
- private string balanceId;
- public string BalanceId
- {
- get { return balanceId; }
- set { balanceId = value; }
- }
- private string balanceName;
- /** 名称*/
- public string BalanceName
- {
- get { return balanceName; }
- set { balanceName = value; }
- }
- public FrmPopGetBalance()
- {
- InitializeComponent();
- }
- public FrmPopGetBalance(OpeBase ob,String bal)
- {
- this.balclass = bal;
- this.ob = ob;
- InitializeComponent();
- }
- private void FrmPopGetBalance_Load(object sender, EventArgs e)
- {
- preInit(balclass);
- queryM(strM1, strM2, ugM, dtM,balclass);
- }
-
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "querybal": // ButtonTool
- queryM(strM1, strM2,ugM,dtM,balclass);
- break;
- case "submitbal": // ButtonTool
- submitt();
- break;
- case "closebal": // ButtonTool
- this.Close();
- break;
- }
- }
- #region toolbar事件
- private void queryM(String strM1, String srtM2,UltraGrid ugM,DataTable dtM,String balclass)
- {
- try
- {
- //获取查询条件
- String strid = Qid.Text.ToString().Trim();
- String strName = Qname.Text.ToString().Trim();
- //构建实体类
- if (balclass == "1")
- {
- BalanceBasepriceM bc = new BalanceBasepriceM();
- bc.Id = strid;
- bc.Name = strName;
- DataTable dt = this.execute<DataTable>(strM1, srtM2, new object[] { bc });
- GridHelper.CopyDataToDatatable(ref dt, ref dtM, true);
- }
- else if (balclass == "2")
- {
- BalanceCicpriceM bc = new BalanceCicpriceM();
- bc.Id = strid;
- bc.Name = strName;
- DataTable dt = this.execute<DataTable>(strM1, srtM2, new object[] { bc });
- GridHelper.CopyDataToDatatable(ref dt, ref dtM, true);
- }
- else
- {
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("操作失败:"+ex.Message,"提示");
- return;
- }
-
- }
- private void submitbal(object sender, DoubleClickRowEventArgs e)
- {
- balanceId = e.Row.Cells["id"].Value.ToString().Trim();
- balanceName = e.Row.Cells["name"].Value.ToString().Trim();
- this.Close();
- }
- private void ugM_RowClick(object sender, EventArgs e)
- {
- String balId = ugM.ActiveRow.Cells["id"].Value.ToString().Trim();
- //构建实体类
- if (balclass == "1")
- {
- BalanceBasepriceC bc = new BalanceBasepriceC();
- bc.StandId = balId;
- bc.Validflag = "1";
- DataTable dt = this.execute<DataTable>(strC1, strC2, new object[] { bc });
- GridHelper.CopyDataToDatatable(ref dt, ref dtC, true);
- }
- else if (balclass == "2")
- {
- BalanceCicpriceC bc = new BalanceCicpriceC();
- bc.StandId = balId;
- bc.Validflag = "1";
- DataTable dt = this.execute<DataTable>(strC1, strC2, new object[] { bc });
- GridHelper.CopyDataToDatatable(ref dt, ref dtC, true);
- }
- else
- {
- }
- }
- private void submitt()
- {
- try
- {
- if (ugM.ActiveRow != null)
- {
- balanceId = ugM.ActiveRow.Cells["id"].Value.ToString().Trim();
- balanceName = ugM.ActiveRow.Cells["name"].Value.ToString().Trim();
- this.Close();
- }
- else
- {
- MessageBox.Show("", "提示");
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("操作失败:" + ex.Message, "提示");
- return;
- }
- }
- #endregion
- #region 弹出框初始化
- private void preInit(String balclass)
- {
- //加载控件数据
- ArrayList aryTmp = new ArrayList();
- aryTmp.Add(new ValueListItem("1", "基准计价"));
- aryTmp.Add(new ValueListItem("2", "成分计价"));
- aryTmp.Add(new ValueListItem("3", "批量计价"));
- aryTmp.Add(new ValueListItem("9", "其它计价"));
- BalanceClassCommon.FilComboboxbyList(Qbalclass, aryTmp);
- //默认选择的类型
- Qbalclass.Value = balclass;
- //禁用控件
- Qbalclass.Enabled = false;
- //隐藏Tab控件
- ultraTabControl1.Tabs[0].Visible = false;
- ultraTabControl1.Tabs[1].Visible = false;
- ultraTabControl1.Tabs[2].Visible = false;
- ultraTabControl1.Tabs[3].Visible = false;
- ultraTabControl2.Tabs[0].Visible = false;
- ultraTabControl2.Tabs[1].Visible = false;
- ultraTabControl2.Tabs[2].Visible = false;
- ultraTabControl2.Tabs[3].Visible = false;
- //清空路由数据
- strM1="";
- strM2="";
- strC1="";
- strC2 = "";
- //清空页面数据
- //dtM.Clear();
- //dtC.Clear();
- //ugM.Update();
- //ugC.Update();
- //显示Tab控件
- if (balclass == "1")
- {
- ultraTabControl1.Tabs[0].Visible = true;
- ultraTabControl2.Tabs[0].Visible = true;
- strM1 = "com.hnshituo.pur.balance.service.BalanceBasepriceMService";
- strM2 = "doQureyBasePriceM";
- strC1 = "com.hnshituo.pur.balance.service.BalanceBasepriceCService";
- strC2 = "doQureyBasePriceC";
- ugM = ultraGrid1;
- ugC = ultraGrid5;
- dtM = dataTable1;
- dtC = dataTable2;
-
- }
- else if(balclass=="2")
- {
- ultraTabControl1.Tabs[1].Visible = true;
- ultraTabControl2.Tabs[1].Visible = true;
- strM1 = "com.hnshituo.pur.balance.service.BalanceCicpriceMService";
- strM2 = "doQureyCicpPriceM";
- strC1 = "com.hnshituo.pur.balance.service.BalanceCicpriceCService";
- strC2 = "doQureyCicpPriceC";
- ugM = ultraGrid2;
- ugC = ultraGrid6;
- dtM = dataTable3;
- dtC = dataTable4;
- }
- else if(balclass=="3")
- {
- MessageBox.Show("功能未开放,暂无数据", "提示");
- return;
-
- }
- else if (balclass == "9")
- {
- MessageBox.Show("功能未开放,暂无数据", "提示");
- return;
- }
- else
- {
- MessageBox.Show("未知计价标准参数:"+balclass,"提示");
- return;
- }
- ultraExpandableGroupBox1.Expanded = false;
- //添加事件
- ugM.DoubleClickRow += new DoubleClickRowEventHandler(submitbal);
- ugM.AfterRowActivate += new EventHandler(ugM_RowClick);
- }
- #endregion
- }
- }
|