| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880 |
- using com.steering.pss.sale.price.entity;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Control;
- namespace Core.StlMes.Client.SalePrice.BaseForm
- {
-
-
- public partial class FrmPriceBasePrice_Exp : FrmBase
- {
- int MaxIniX = 50;///合并表头时初始化的最大起始坐标X轴
- int MaxSpyX = 20;///合并表头时初始化的最大跨越段数
- int XZhouCount;
- int YZhouCount;
- int Y1Count;
- int Y2Count;
- int BaseFieldCount = 3;
- DataTable dt = new DataTable();
- DataTable dt_Exp = new DataTable();
- public FrmPriceBasePrice_Exp()
- {
- InitializeComponent();
- }
- private void FrmPriceBasePrice_Exp_Load(object sender, EventArgs e)
- {
- InitForm();
- InitComBoBox1();
- ucFrame.Rows[0].Selected=true;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- QueryData();
- break;
- case "Save":
- SaveFormData();
- break;
- case "Delete":
- DeleteOrResume(true);
- break;
- case "Resume":
- DeleteOrResume(false);
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void SaveFormData()
- {
- ugFramePrice_Exp.UpdateData();
- UltraGridRow[] row = ugFramePrice_Exp.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
-
- if (row.Length <= 0 )
- {
- MessageUtil.ShowWarning("请选择需要保存的数据!");
- return;
- }
-
- ArrayList parm = CheckFormData(row);
-
-
- if (MessageUtil.ShowYesNoAndQuestion("是否确认保存数据!") == DialogResult.No) return;
- int i = ServerHelper.SetData("com.steering.pss.sale.price.server.CorePriceFramePriceExp.save",
- new object[] { parm }, this.ob);
-
- if (i > 0)
- {
- MessageUtil.ShowTips("数据保存成功!");
- QueryData();
- }
- else
- {
- MessageUtil.ShowTips("数据保存失败!");
- QueryData();
- }
-
- }
- private void DeleteOrResume(bool flag)
- {
- ugFramePrice_Exp.UpdateData();
- UltraGridRow[] row = ugFramePrice_Exp.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
- if (row.Length <= 0)
- {
- MessageUtil.ShowWarning("请选择需要" + (flag ? "删除" : "恢复") + "的数据!");
- return;
- }
- ArrayList parm = new ArrayList();
-
- if (flag)
- {
- foreach (var uRow in row)
- {
- SlmPriceBasepriceExpEntity spf = new SlmPriceBasepriceExpEntity(); ;
- spf.PriceExpId = uRow.Cells["PRICE_EXP_ID"].Text.ToString();
- if (spf.Validflag == "无效")
- {
- MessageUtil.ShowWarning("您勾选的数据中存在已删除的数据,不必重复删除!");
- return;
- }
- spf.CreateName = UserInfo.GetUserName();
- spf.UpdateName = UserInfo.GetUserName();
- parm.Add(JSONFormat.Format(spf));
- }
- }
- else
- {
- foreach (var uRow in row)
- {
- SlmPriceBasepriceExpEntity spf = new SlmPriceBasepriceExpEntity(); ;
- spf.PriceExpId = uRow.Cells["PRICE_EXP_ID"].Text.ToString();
- if (spf.Validflag == "有效")
- {
- MessageUtil.ShowWarning("您勾选的数据中存在有效的数据,不必进行恢复!");
- return;
- }
- spf.CreateName = UserInfo.GetUserName();
- spf.UpdateName = UserInfo.GetUserName();
- parm.Add(JSONFormat.Format(spf));
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否" + (flag ? "删除" : "恢复") + "所选的数据!") == DialogResult.No) return;
- int i = ServerHelper.SetData("com.steering.pss.sale.price.server.CorePriceFramePriceExp.deleteOrResume", new object[] { parm, flag }, this.ob);
- if (i >= 0)
- {
- MessageUtil.ShowTips("数据" + (flag ? "删除" : "恢复") + "成功!");
- QueryData();
- }
- else
- {
- MessageUtil.ShowTips("数据" + (flag ? "删除" : "恢复") + "失败!");
- QueryData();
- }
- }
- private ArrayList CheckFormData(UltraGridRow[] row)
- {
- ArrayList parm = new ArrayList();
- List<string> list = new List<string>();
-
- foreach (var uRow in row)
- {
- ArrayList FactorValue = new ArrayList();
- SlmPriceBasepriceExpEntity spf = new SlmPriceBasepriceExpEntity(); ;
- FactorValue.Add(uRow.Cells["PRICE_EXP_ID"].Text.ToString());
- FactorValue.Add(uRow.Cells["PRICE_EXP_NAME"].Text.ToString());
- FactorValue.Add(uRow.Cells["Frame_ID"].Text.ToString());
- FactorValue.Add(uRow.Cells["PRICE_HEAD_ID"].Text.ToString());
-
- for (int i = 0; i < XZhouCount*2+1; i++)
- {
-
- FactorValue.Add(uRow.Cells[5 + i].Value.ToString());
-
-
-
- }
- for (int i = 0; i < 8 - XZhouCount; i++)
- {
- FactorValue.Add("");
- FactorValue.Add("0");
- }
- spf.PriceExpId = FactorValue[0].ToString();
- spf.PriceExpName = FactorValue[1].ToString();
- spf.FrameId = FactorValue[2].ToString();
- spf.PriceHeadId = FactorValue[3].ToString();
-
-
- spf.Factor1Id = FactorValue[5].ToString();
- spf.Factor1Price = FactorValue[6] != "" ? Convert.ToDecimal(FactorValue[6]) : 0;
- spf.Factor2Id = FactorValue[7].ToString();
- spf.Factor2Price = FactorValue[8] != "" ? Convert.ToDecimal(FactorValue[8]) : 0;
- spf.Factor3Id = FactorValue[9].ToString();
- spf.Factor3Price = FactorValue[10]!=""? Convert.ToDecimal(FactorValue[10]) : 0 ;
- spf.Factor4Id = FactorValue[11].ToString();
- spf.Factor4Price = FactorValue[12] != "" ? Convert.ToDecimal(FactorValue[12]) : 0;
- spf.Factor5Id = FactorValue[13].ToString();
- spf.Factor5Price = FactorValue[14] != "" ? Convert.ToDecimal(FactorValue[14]) : 0;
- spf.Factor6Id = FactorValue[15].ToString();
- spf.Factor6Price = FactorValue[16] != "" ? Convert.ToDecimal(FactorValue[16]) : 0;
- spf.Factor7Id = FactorValue[17].ToString();
- spf.Factor7Price = FactorValue[18] != "" ? Convert.ToDecimal(FactorValue[18]) : 0;
- spf.Factor8Id = FactorValue[19].ToString();
- spf.Factor8Price = FactorValue[20] != "" ? Convert.ToDecimal(FactorValue[20]) : 0;
- spf.CreateName = UserInfo.GetUserName();
- spf.UpdateName = UserInfo.GetUserName();
- spf.Validflag = uRow.Cells["VALIDFLAG"].Text.ToString();
- if (spf.Validflag == "无效" && spf.CreateName != "")
- {
- MessageUtil.ShowWarning("【" + spf.PriceExpId + "】的因素已经无效,不能修改!");
- return null;
- }
- parm.Add(JSONFormat.Format(spf));
-
- }
- return parm;
- }
- private void InitForm()
- {
- string isValid = "1";
- List<SlmPriceBaseframeSetEntity> list = EntityHelper.GetData<SlmPriceBaseframeSetEntity>(
- "com.steering.pss.sale.price.server.CorePriceBaseFrame.query", new object[] { isValid }, this.ob);
- slmPriceBaseframeSetEntityBindingSource.DataSource = list;
- }
- private void QueryData()
- {
- // List<SlmPriceBasepriceEntity> list = EntityHelper.GetData<SlmPriceBasepriceEntity>(
- // "com.steering.pss.sale.price.server.CorePriceFramePrice.query", null, this.ob);
- DataTable dt_query = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.query", null, this.ob);
- dt.Rows.Clear();
- ugFramePrice.DataSource = dt;
- ugFramePrice.DataBind();
- for (int i = 0; i < dt_query.Rows.Count; i++)
- {
- DataRow dr = dt.NewRow();
- dt.Rows.Add(dr);
- dt.Rows[i]["validflag"] = dt_query.Rows[i]["validflag"].ToString();
- dt.Rows[i]["create_name"] = dt_query.Rows[i]["create_name"].ToString();
- dt.Rows[i]["create_time"] = dt_query.Rows[i]["create_time"].ToString();
- if (dt.Columns.Contains("因素一") == true)
- {
- dt.Rows[i]["因素一"] = dt_query.Rows[i]["X_1_ID_VALUE"].ToString();
- }
- if (dt.Columns.Contains("因素二") == true)
- {
- dt.Rows[i]["因素二"] = dt_query.Rows[i]["X_2_ID_VALUE"].ToString();
- }
- if (dt.Columns.Contains("因素三") == true)
- {
- dt.Rows[i]["因素三"] = dt_query.Rows[i]["X_3_ID_VALUE"].ToString();
- }
- if (dt.Columns.Contains("因素四") == true)
- {
- dt.Rows[i]["因素四"] = dt_query.Rows[i]["X_4_ID_VALUE"].ToString();
- }
- if (dt.Columns.Contains("因素五") == true)
- {
- dt.Rows[i]["因素五"] = dt_query.Rows[i]["X_5_ID_VALUE"].ToString();
- }
- if (dt.Columns.Contains("因素六") == true)
- {
- dt.Rows[i]["因素六"] = dt_query.Rows[i]["X_6_ID_VALUE"].ToString();
- }
- if (dt.Columns.Contains("因素七") == true)
- {
- dt.Rows[i]["因素七"] = dt_query.Rows[i]["X_7_ID_VALUE"].ToString();
- }
- if (dt.Columns.Contains("因素八") == true)
- {
- dt.Rows[i]["因素八"] = dt_query.Rows[i]["X_8_ID_VALUE"].ToString();
- }
- for (int n = 0; n < dt_query.Columns.Count; n++)
- {
- if (dt.Columns.Contains(dt_query.Columns[n].ColumnName.Replace("'", "")))
- {
- string ColName = dt_query.Columns[n].ColumnName;
- dt.Rows[i][ColName.Replace("'", "")] = dt_query.Rows[i][ColName].ToString();
- }
- }
- }
- ugFramePrice.DataSource = dt;
- }
- private void QueryDataExp(string price_head_id,string isValid)
- {
- DataTable dt_query = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePriceExp.queryById", new object[] { price_head_id, isValid }, this.ob);
- dt_Exp.Rows.Clear();
- ugFramePrice_Exp.DataSource = dt_Exp;
- ugFramePrice_Exp.DataBind();
- for (int i = 0; i < dt_query.Rows.Count; i++)
- {
- DataRow dr = dt_Exp.NewRow();
- dt_Exp.Rows.Add(dr);
- dt_Exp.Rows[i]["validflag"] = dt_query.Rows[i]["validflag"].ToString();
- dt_Exp.Rows[i]["create_name"] = dt_query.Rows[i]["create_name"].ToString();
- dt_Exp.Rows[i]["create_time"] = dt_query.Rows[i]["create_time"].ToString();
- if (dt_Exp.Columns.Contains("因素一") == true && dt_query.Rows[i]["Factor1_ID"].ToString()!="")
- {
- dt_Exp.Rows[i]["因素一"] = dt_query.Rows[i]["Factor1_ID"].ToString();
- dt_Exp.Rows[i]["因素一加价"] = dt_query.Rows[i]["Factor1_Price"].ToString();
- }
- if (dt_Exp.Columns.Contains("因素二") == true && dt_query.Rows[i]["Factor2_ID"].ToString() != "")
- {
- dt_Exp.Rows[i]["因素二"] = dt_query.Rows[i]["Factor2_ID"].ToString();
- dt_Exp.Rows[i]["因素二加价"] = dt_query.Rows[i]["Factor2_Price"].ToString();
- }
- if (dt_Exp.Columns.Contains("因素三") == true && dt_query.Rows[i]["Factor3_ID"].ToString() != "")
- {
- dt_Exp.Rows[i]["因素三"] = dt_query.Rows[i]["Factor3_ID"].ToString();
- dt_Exp.Rows[i]["因素三加价"] = dt_query.Rows[i]["Factor3_Price"].ToString();
- }
- if (dt_Exp.Columns.Contains("因素四") == true && dt_query.Rows[i]["Factor4_ID"].ToString() != "")
- {
- dt_Exp.Rows[i]["因素四"] = dt_query.Rows[i]["Factor4_ID"].ToString();
- dt_Exp.Rows[i]["因素四加价"] = dt_query.Rows[i]["Factor4_Price"].ToString();
- }
- if (dt_Exp.Columns.Contains("因素五") == true && dt_query.Rows[i]["Factor5_ID"].ToString() != "")
- {
- dt_Exp.Rows[i]["因素五"] = dt_query.Rows[i]["Factor5_ID"].ToString();
- dt_Exp.Rows[i]["因素五加价"] = dt_query.Rows[i]["Factor5_Price"].ToString();
- }
- if (dt_Exp.Columns.Contains("因素六") == true && dt_query.Rows[i]["Factor6_ID"].ToString() != "")
- {
- dt_Exp.Rows[i]["因素六"] = dt_query.Rows[i]["Factor6_ID"].ToString();
- dt_Exp.Rows[i]["因素六加价"] = dt_query.Rows[i]["Factor6_Price"].ToString();
- }
- if (dt_Exp.Columns.Contains("因素七") == true && dt_query.Rows[i]["Factor7_ID"].ToString() != "")
- {
- dt_Exp.Rows[i]["因素七"] = dt_query.Rows[i]["Factor7_ID"].ToString();
- dt_Exp.Rows[i]["因素七加价"] = dt_query.Rows[i]["Factor7_Price"].ToString();
- }
- if (dt.Columns.Contains("因素八") == true && dt_query.Rows[i]["Factor8_ID"].ToString() != "")
- {
- dt_Exp.Rows[i]["因素八"] = dt_query.Rows[i]["Factor8_ID"].ToString();
- dt_Exp.Rows[i]["因素八加价"] = dt_query.Rows[i]["Factor8_Price"].ToString();
- }
- for (int n = 0; n < dt_query.Columns.Count; n++)
- {
- if (dt_Exp.Columns.Contains(dt_query.Columns[n].ColumnName.Replace("'", "")))
- {
- string ColName = dt_query.Columns[n].ColumnName;
- dt_Exp.Rows[i][ColName.Replace("'", "")] = dt_query.Rows[i][ColName].ToString();
- }
- }
-
- }
- ugFramePrice_Exp.DataSource = dt_Exp;
- }
- private void InitComBoBox1()
- {
- UltraComboEditor uce1 = new UltraComboEditor();
- SalePriceClass.InitComboEditorWithParm(uce1, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
- ucFrame.DisplayLayout.Bands[0].Columns["X1FACTORID"].EditorComponent = uce1;
- ucFrame.DisplayLayout.Bands[0].Columns["X1FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce1);
- uce1.Visible = false;
- UltraComboEditor uce2 = new UltraComboEditor();
- SalePriceClass.InitComboEditorWithParm(uce2, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
- ucFrame.DisplayLayout.Bands[0].Columns["X2FACTORID"].EditorComponent = uce2;
- ucFrame.DisplayLayout.Bands[0].Columns["X2FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce2);
- uce2.Visible = false;
- UltraComboEditor uce3 = new UltraComboEditor();
- SalePriceClass.InitComboEditorWithParm(uce3, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
- ucFrame.DisplayLayout.Bands[0].Columns["X3FACTORID"].EditorComponent = uce3;
- ucFrame.DisplayLayout.Bands[0].Columns["X3FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce3);
- uce3.Visible = false;
- UltraComboEditor uce4 = new UltraComboEditor();
- SalePriceClass.InitComboEditorWithParm(uce4, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
- ucFrame.DisplayLayout.Bands[0].Columns["X4FACTORID"].EditorComponent = uce4;
- ucFrame.DisplayLayout.Bands[0].Columns["X4FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce4);
- uce4.Visible = false;
- UltraComboEditor uce5 = new UltraComboEditor();
- SalePriceClass.InitComboEditorWithParm(uce5, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
- ucFrame.DisplayLayout.Bands[0].Columns["X5FACTORID"].EditorComponent = uce5;
- ucFrame.DisplayLayout.Bands[0].Columns["X5FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce5);
- uce5.Visible = false;
- UltraComboEditor uce6 = new UltraComboEditor();
- SalePriceClass.InitComboEditorWithParm(uce6, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
- ucFrame.DisplayLayout.Bands[0].Columns["X6FACTORID"].EditorComponent = uce6;
- ucFrame.DisplayLayout.Bands[0].Columns["X6FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce6);
- uce6.Visible = false;
- UltraComboEditor uce7 = new UltraComboEditor();
- SalePriceClass.InitComboEditorWithParm(uce7, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
- ucFrame.DisplayLayout.Bands[0].Columns["X7FACTORID"].EditorComponent = uce7;
- ucFrame.DisplayLayout.Bands[0].Columns["X7FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce7);
- uce7.Visible = false;
- UltraComboEditor uce8 = new UltraComboEditor();
- SalePriceClass.InitComboEditorWithParm(uce8, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryFacName", "FACTOR_ID", "FACTOR_NAME", this.ob, true, null);
- ucFrame.DisplayLayout.Bands[0].Columns["X8FACTORID"].EditorComponent = uce8;
- ucFrame.DisplayLayout.Bands[0].Columns["X8FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce8);
- uce8.Visible = false;
- //UltraComboEditor uce9 = new UltraComboEditor();
- //SalePriceClass.InitComboEditorWithParm(uce9, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryRangeName", "CLASS_D_ID", "CLASS_D_NAME", this.ob, true, null);
- //ultraCombo1.DisplayLayout.Bands[0].Columns["Y1FACTORID"].EditorComponent = uce9;
- //ultraCombo1.DisplayLayout.Bands[0].Columns["Y1FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- //this.Controls.Add(uce9);
- //uce9.Visible = false;
- //UltraComboEditor uce10 = new UltraComboEditor();
- //SalePriceClass.InitComboEditorWithParm(uce10, "com.steering.pss.sale.price.server.CorePriceBaseFrame.queryRangeName", "CLASS_D_ID", "CLASS_D_NAME", this.ob, true, null);
- //ultraCombo1.DisplayLayout.Bands[0].Columns["Y2FACTORID"].EditorComponent = uce10;
- //ultraCombo1.DisplayLayout.Bands[0].Columns["Y2FACTORID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- //this.Controls.Add(uce10);
- //uce10.Visible = false;
- }
- private void ultraCombo1_ValueChanged(object sender, EventArgs e)
- {
- dt.Columns.Clear();
- dt.Rows.Clear();
- dt_Exp.Columns.Clear();
- dt_Exp.Rows.Clear();
- bindBaseField(dt); ///绑定基础字段
- LoadXField(dt); ///加载 X轴因素的字段
- // LoadYfield(dt); ///加载 Y轴因素的字段
- bindBaseField1(dt);
- LoadFactorInfo(); ///获取X轴下拉列表
- ///
- bindBaseField_Exp(dt_Exp);
- LoadXField_Exp(dt_Exp);
- bindBaseField1_Exp(dt_Exp);
- LoadFactorInfo_Exp();
- }
- private void bindBaseField(DataTable dt)
- {
- this.ugFramePrice.DisplayLayout.Bands[0].RowLayoutStyle = RowLayoutStyle.GroupLayout;
- // dt.Columns.Add("CHK", typeof(Boolean));
- dt.Columns.Add("PRICE_HEAD_ID", typeof(string));
- // dt.Columns.Add("PRICE_VER_ID", typeof(string));
- dt.Columns.Add("PRICE_VER_M", typeof(string));
- dt.Columns.Add("PRICE_VER_SQE", typeof(string));
- dt.Columns.Add("FRAME_ID", typeof(string));
- ugFramePrice.DataSource = dt;
- ugFramePrice.DataBind();
- ModifyColumnName("PRICE_HEAD_ID", "基价套头ID", this.ugFramePrice, true);
- // ModifyColumnName("PRICE_VER_ID", "基价版本ID",this.ugFramePrice,true);
- ModifyColumnName("PRICE_VER_M", "基价版本描述", this.ugFramePrice, true);
- // ModifyColumnName("PRICE_VER_SQE", "基价序号");
- ModifyColumnName("FRAME_ID", "基价框架", this.ugFramePrice, false);
- // dt.Columns.Add("PRICE_VER_ID", typeof(string));
- //ugFramePrice.DataSource = dt;
- //ugFramePrice.DataBind();
- }
- private void bindBaseField_Exp(DataTable dt_Exp)
- {
- this.ugFramePrice_Exp.DisplayLayout.Bands[0].RowLayoutStyle = RowLayoutStyle.GroupLayout;
- dt_Exp.Columns.Add("CHK", typeof(Boolean));
- dt_Exp.Columns.Add("PRICE_EXP_ID", typeof(string));
- dt_Exp.Columns.Add("PRICE_EXP_NAME", typeof(string));
- dt_Exp.Columns.Add("Frame_ID", typeof(string));
- dt_Exp.Columns.Add("PRICE_HEAD_ID", typeof(string));
- dt_Exp.Columns.Add("Total_Add", typeof(string));
-
- ugFramePrice_Exp.DataSource = dt_Exp;
- ugFramePrice_Exp.DataBind();
- ModifyColumnName("PRICE_EXP_ID", "基价扩展ID", this.ugFramePrice_Exp,true);
- ModifyColumnName("PRICE_EXP_NAME", "基价扩展名称", this.ugFramePrice_Exp,false);
- ModifyColumnName("Frame_ID", "框架ID", this.ugFramePrice_Exp,false);
- ModifyColumnName("PRICE_HEAD_ID", "基价套头ID", this.ugFramePrice_Exp,false);
- ModifyColumnName("Total_Add", "总加价", this.ugFramePrice_Exp, true);
- }
- /// <summary>
- /// 绑定X轴字段
- /// </summary>
- /// <param name="dt"></param>
- private void LoadXField(DataTable dt)
- {
- string facId = "";
- string facName = "";
- string isValid = "1";
- int m = 0;
- for (int i = 1; i < ucFrame.ActiveRow.Cells.Count - 7; i++)
- {
- if (ucFrame.ActiveRow.Cells[i].Value.ToString() != null && ucFrame.ActiveRow.Cells[i].Value.ToString() != "")
- {
- // dt.Columns.Add(ultraCombo1.ActiveRow.Cells[i].Text.ToString(), typeof(string));
- dt.Columns.Add(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString(), typeof(string));
- m += 1;
- }
- }
- ugFramePrice.DataSource = dt;
- ugFramePrice.DataBind();
- for (int i = 1; i < ucFrame.ActiveRow.Cells.Count - 7; i++)
- {
- if (ucFrame.ActiveRow.Cells[i].Value.ToString() != null && ucFrame.ActiveRow.Cells[i].Value.ToString() != "")
- {
- ModifyColumnName(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString(), ucFrame.ActiveRow.Cells[i].Text.ToString(), this.ugFramePrice,true);
- }
- }
- XZhouCount = m;
- }
- private void LoadXField_Exp(DataTable dt_Exp)
- {
- string facId = "";
- string facName = "";
- string isValid = "1";
- int m = 0;
- for (int i = 1; i < ucFrame.ActiveRow.Cells.Count - 7; i++)
- {
- if (ucFrame.ActiveRow.Cells[i].Value.ToString() != null && ucFrame.ActiveRow.Cells[i].Value.ToString() != "")
- {
- // dt.Columns.Add(ultraCombo1.ActiveRow.Cells[i].Text.ToString(), typeof(string));
- dt_Exp.Columns.Add(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString(), typeof(string));
- dt_Exp.Columns.Add(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString() + "加价", typeof(decimal));
- m += 2;
- }
- }
- ugFramePrice_Exp.DataSource = dt_Exp;
- ugFramePrice_Exp.DataBind();
- for (int i = 1; i < ucFrame.ActiveRow.Cells.Count - 7; i++)
- {
- if (ucFrame.ActiveRow.Cells[i].Value.ToString() != null && ucFrame.ActiveRow.Cells[i].Value.ToString() != "")
- {
- ModifyColumnName(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString(), ucFrame.ActiveRow.Cells[i].Text.ToString(), this.ugFramePrice_Exp,true);
- ModifyColumnName(ucFrame.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString() + "加价", ucFrame.ActiveRow.Cells[i].Text.ToString() + "加价", this.ugFramePrice_Exp,true);
- }
- }
- // XZhouCount = m;
-
- }
- private void bindBaseField1(DataTable dt)
- {
- dt.Columns.Add("validflag", typeof(string));
- dt.Columns.Add("create_name", typeof(string));
- dt.Columns.Add("create_time", typeof(string));
- dt.Columns.Add("update_name", typeof(string));
- dt.Columns.Add("update_time", typeof(string));
- ugFramePrice.DataSource = dt;
- ugFramePrice.DataBind();
- ModifyColumnName("validflag", "有效标志", this.ugFramePrice,true);
- ModifyColumnName("create_name", "创建人", this.ugFramePrice,true);
- ModifyColumnName("create_time", "创建时间", this.ugFramePrice,true);
- ModifyColumnName("update_name", "修改人", this.ugFramePrice,true);
- ModifyColumnName("update_time", "修改时间", this.ugFramePrice,true);
- }
- private void bindBaseField1_Exp(DataTable dt_Exp)
- {
- dt_Exp.Columns.Add("validflag", typeof(string));
- dt_Exp.Columns.Add("create_name", typeof(string));
- dt_Exp.Columns.Add("create_time", typeof(string));
- dt_Exp.Columns.Add("update_name", typeof(string));
- dt_Exp.Columns.Add("update_time", typeof(string));
- ugFramePrice_Exp.DataSource = dt_Exp;
- ugFramePrice_Exp.DataBind();
- ModifyColumnName("validflag", "有效标志", this.ugFramePrice_Exp,true);
- ModifyColumnName("create_name", "创建人", this.ugFramePrice_Exp,true);
- ModifyColumnName("create_time", "创建时间", this.ugFramePrice_Exp,true);
- ModifyColumnName("update_name", "修改人", this.ugFramePrice_Exp,true);
- ModifyColumnName("update_time", "修改时间", this.ugFramePrice_Exp,true);
- }
- /// <summary>
- /// 加载Grid下啦列表
- /// </summary>
- private void LoadFactorInfo()
- {
- for (int i = 0; i < ugFramePrice.DisplayLayout.Bands[0].Columns.Count; i++)
- {
- string FactorName = ugFramePrice.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString();
- DataTable FactorInfo = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.GetFactorInfo", new object[] { FactorName }, this.ob);
- if (FactorInfo != null && FactorInfo.Rows.Count > 0 && FactorInfo.Rows[0]["Table_Name"].ToString() != "")
- {
- UltraComboEditor uce1 = new UltraComboEditor();
- string sql_getFactorBind = "";
- string TableName = FactorInfo.Rows[0]["TABLE_NAME"].ToString();
- string DataValue = FactorInfo.Rows[0]["COLUMN_KEY"].ToString();
- string DataDesc = FactorInfo.Rows[0]["COLUMN_NAME"].ToString();
- string sql_getSQL = FactorInfo.Rows[0]["VAL_SQL"].ToString();
- DataTable dtFactor = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.FactorBind", new object[] { TableName, DataValue, DataDesc, sql_getSQL }, this.ob);
- if (dtFactor != null && dtFactor.Rows.Count > 0)
- {
- Object[] obj = new Object[] { "", "" };
- DataRow dr = dtFactor.NewRow();
- dr.ItemArray = obj;
- dtFactor.Rows.InsertAt(dr, 0);
- uce1.DataSource = dtFactor;
- uce1.DataMember = "";
- uce1.ValueMember = DataValue;
- uce1.DisplayMember = DataDesc;
- ClsBaseInfo.SetComboItemHeight(uce1);
- }
- ugFramePrice.DisplayLayout.Bands[0].Columns[i].EditorComponent = uce1;
- ugFramePrice.DisplayLayout.Bands[0].Columns[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce1);
- uce1.Visible = false;
- }
- }
- }
- private void LoadFactorInfo_Exp()
- {
- for (int i = 0; i < ugFramePrice_Exp.DisplayLayout.Bands[0].Columns.Count; i++)
- {
- string FactorName = ugFramePrice_Exp.DisplayLayout.Bands[0].Columns[i].Header.Caption.ToString();
- DataTable FactorInfo = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.GetFactorInfo", new object[] { FactorName }, this.ob);
- if (FactorInfo != null && FactorInfo.Rows.Count > 0 && FactorInfo.Rows[0]["Table_Name"].ToString() != "")
- {
- UltraComboEditor uce1 = new UltraComboEditor();
- string sql_getFactorBind = "";
- string TableName = FactorInfo.Rows[0]["TABLE_NAME"].ToString();
- string DataValue = FactorInfo.Rows[0]["COLUMN_KEY"].ToString();
- string DataDesc = FactorInfo.Rows[0]["COLUMN_NAME"].ToString();
- string sql_getSQL = FactorInfo.Rows[0]["VAL_SQL"].ToString();
- DataTable dtFactor = ServerHelper.GetData("com.steering.pss.sale.price.server.CorePriceFramePrice.FactorBind", new object[] { TableName, DataValue, DataDesc, sql_getSQL }, this.ob);
- if (dtFactor != null && dtFactor.Rows.Count > 0)
- {
- Object[] obj = new Object[] { "", "" };
- DataRow dr = dtFactor.NewRow();
- dr.ItemArray = obj;
- dtFactor.Rows.InsertAt(dr, 0);
- uce1.DataSource = dtFactor;
- uce1.DataMember = "";
- uce1.ValueMember = DataValue;
- uce1.DisplayMember = DataDesc;
- ClsBaseInfo.SetComboItemHeight(uce1);
- }
- ugFramePrice_Exp.DisplayLayout.Bands[0].Columns[i].EditorComponent = uce1;
- ugFramePrice_Exp.DisplayLayout.Bands[0].Columns[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- this.Controls.Add(uce1);
- uce1.Visible = false;
- }
- }
- }
- /// <summary>
- /// 合并表头函数
- /// </summary>
- /// <param name="columnName">列名</param>
- /// <param name="caption">表头名</param>
- /// <param name="x">表头横轴起始点</param>
- /// <param name="y">表头纵轴起始点</param>
- /// <param name="spanX">横向跨度</param>
- /// <param name="spanY">纵向跨度</param>
- private void modifyColumn(string columnName, string caption, int x, int y, int spanX, int spanY)
- {
- // this.ugFramePrice.DisplayLayout.Bands[0].Columns.Add(columnName);
- UltraGridColumn GridColumn = this.ugFramePrice.DisplayLayout.Bands[0].Columns[columnName];
- GridColumn.Header.Caption = caption;
- GridColumn.Header.Appearance.TextVAlign = Infragistics.Win.VAlign.Middle;
- GridColumn.Header.Appearance.TextHAlign = Infragistics.Win.HAlign.Center;
- GridColumn.RowLayoutColumnInfo.OriginX = x;
- GridColumn.RowLayoutColumnInfo.OriginY = y;
- GridColumn.RowLayoutColumnInfo.SpanX = spanX;
- GridColumn.RowLayoutColumnInfo.SpanY = spanY;
- //GridColumn.CellActivation = Activation.Disabled;
- GridColumn.RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.None;
- GridColumn.SortIndicator = SortIndicator.Disabled;
- }
- /// <summary>
- /// 根据Column的 KEY来更改列显示标题
- /// </summary>
- /// <param name="BR_ID"></param>
- /// <param name="colName"></param>
- private void ModifyColumnName(string BR_ID, string colName,UltraGrid ug,Boolean bl)
- {
- // this.ugFramePrice.DisplayLayout.Bands[0].Columns.Add(BR_ID);
- UltraGridColumn GridColumn = ug.DisplayLayout.Bands[0].Columns[BR_ID];
- GridColumn.Header.Caption = colName;
- GridColumn.Hidden = !bl;
- }
- private void ugFramePrice_Exp_InitializeLayout(object sender, InitializeLayoutEventArgs e)
- {
- e.Layout.Bands[0].Columns["CHK"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;
- e.Layout.Bands[0].Columns["CHK"].Header.Caption = "选择";
- e.Layout.Bands[0].Columns["CHK"].DefaultCellValue = false;
- }
- private void ugFramePrice_Exp_AfterRowInsert(object sender, RowEventArgs e)
- {
- e.Row.Cells["PRICE_HEAD_ID"].Value = ugFramePrice.ActiveRow.Cells["PRICE_HEAD_ID"].Value.ToString();
- string maxId = ugFramePrice_Exp.Rows.AsQueryable().Max(a => a.Cells["PRICE_EXP_ID"].Value.ToString());
- if (maxId == "")
- {
- e.Row.Cells["PRICE_EXP_ID"].Value = "E000001";
- }
- else
- {
- string str = "E" + (Convert.ToInt32(maxId.Substring(1, 6)) + 1).ToString().PadLeft(6, '0');
- e.Row.Cells["PRICE_EXP_ID"].Value = str;
- }
- }
- private void ugFramePrice_Exp_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- // e.Row.Cells["Total_Add"].Value = e.Row.Cells["因素一加价"].Value.ToString() + e.Row.Cells["因素二加价"].Value.ToString() + e.Row.Cells["因素三加价"].Value.ToString() + e.Row.Cells["因素四加价"].Value.ToString() + e.Row.Cells["因素五加价"].Value.ToString() + e.Row.Cells["因素六加价"].Value.ToString() + e.Row.Cells["因素七加价"].Value.ToString() + e.Row.Cells["因素八加价"].Value.ToString();
- if (e.Row != null)
-
- {
- Decimal total_Add = 0;
- UltraGridBand ugb = this.ugFramePrice_Exp.DisplayLayout.Bands[0];
- if (e.Row.Cells.Exists("因素一加价") == true)
- {
- total_Add += Convert.ToDecimal(e.Row.Cells["因素一加价"].Value.ToString3());
- }
- if (e.Row.Cells.Exists("因素二加价") == true)
- {
- total_Add += Convert.ToDecimal(e.Row.Cells["因素二加价"].Value.ToString3());
- }
- if (e.Row.Cells.Exists("因素三加价") == true)
- {
- total_Add += Convert.ToDecimal(e.Row.Cells["因素三加价"].Value.ToString3());
- }
- if (e.Row.Cells.Exists("因素四加价") == true)
- {
- total_Add += Convert.ToDecimal(e.Row.Cells["因素四加价"].Value.ToString3());
- }
- if (e.Row.Cells.Exists("因素五加价") == true)
- {
- total_Add += Convert.ToDecimal(e.Row.Cells["因素五加价"].Value.ToString3());
- }
- if (e.Row.Cells.Exists("因素六加价") == true)
- {
- total_Add += Convert.ToDecimal(e.Row.Cells["因素六加价"].Value.ToString3());
- }
- if (e.Row.Cells.Exists("因素七加价") == true)
- {
- total_Add += Convert.ToDecimal(e.Row.Cells["因素七加价"].Value.ToString3());
- }
- if (e.Row.Cells.Exists("因素八加价") == true)
- {
- total_Add += Convert.ToDecimal(e.Row.Cells["因素八加价"].Value.ToString3());
- }
- e.Row.Cells["Total_Add"].Value = total_Add;
-
-
- }
-
-
-
-
- }
- private void ugFramePrice_AfterRowActivate(object sender, EventArgs e)
- {
- if (ugFramePrice.ActiveRow.Cells["price_head_id"].Value.ToString() != "")
- {
- string price_head_id = ugFramePrice.ActiveRow.Cells["price_head_id"].Value.ToString();
- string isValid= "1";
- QueryDataExp(price_head_id, isValid);
- }
- }
- }
- }
|