private void FormNewYear_Load(object sender, EventArgs e) { spinEdit1.Text = type; year2 = type; if (!IsUpdate) { psp_Year = new PowerProYears(); psp_Year.Flag = flag2; } else { PowerProYears ps=new PowerProYears(); ps.Flag=flag2; ps.Year=type; psp_Year = (PowerProYears)Common.Services.BaseService.GetObject("SelectPowerProYearsByYearFlag", ps); } }
private void FrmEditProject_Load(object sender, EventArgs e) { string q1 = ""; PowerProTypes ppt = new PowerProTypes(); ppt.ID = poweruid; ppt.Flag2 = flag; PowerProTypes ps = Common.Services.BaseService.GetOneByKey<PowerProTypes>(ppt); if (ps != null) { groupBox1.Text = ps.Title; powerid = ps.Code; q1 = ps.Remark; } LineInfo li22 = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid); if (li22 != null) { isline = true; } substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid); if (sb != null) { isPower = true; } PowerProValues ppv = new PowerProValues(); ppv.TypeID = poweruid; ppv.TypeID1 = flag; IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv); PowerProYears pps = new PowerProYears(); pps.Flag = flag; IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps); lb=new Label[li.Count]; te=new TextEdit[li.Count]; int i=0; foreach (PowerProYears ppy in li) { lb[i] = new Label(); lb[i].Name= "Label"+ppy.Year; lb[i].Text = ppy.Year+":"; lb[i].Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lb[i]); te[i] = new TextEdit(); te[i].Name = "Text" + ppy.Year; te[i].Location = new Point(157, 26 + 33 * i); te[i].Size = new Size(231, 21); groupBox1.Controls.Add(te[i]); foreach (PowerProValues ppy1 in listValues) { if (ppy.Year == ppy1.Year) te[i].Text = ppy1.Value; } i++; } //ls1.Text = "�ƻ���ʼʱ��:"; //ls1.Location = new Point(52, 27 + 33 * i); //groupBox1.Controls.Add(ls1); //ts1 = new TextEdit(); //ts1.Location = new Point(157, 27 + 33 * i); //ts1.Size = new Size(231, 21); //ts1.Properties.DisplayFormat.FormatString = "n0"; //ts1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; //ts1.Properties.EditFormat.FormatString = "n0"; //ts1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; //ts1.Properties.Mask.EditMask = "####"; //ts1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; //groupBox1.Controls.Add(ts1); //ls2.Text = "Ԥ��Ͷ��ʱ��:"; //ls2.Location = new Point(52, 60 + 33 * i); //groupBox1.Controls.Add(ls2); //ts2 = new TextEdit(); //ts2.Location = new Point(157, 60 + 33 * i); //ts2.Size = new Size(231, 21); //ts2.Properties.DisplayFormat.FormatString = "n0"; //ts2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; //ts2.Properties.EditFormat.FormatString = "n0"; //ts2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; //ts2.Properties.Mask.EditMask = "####"; //ts2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; //groupBox1.Controls.Add(ts2); ls3.Text = "��ע:"; ls3.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(ls3); ts3 = new TextEdit(); ts3.Location = new Point(157, 27 + 33 * i); ts3.Size = new Size(231, 21); groupBox1.Controls.Add(ts3); ts3.Text = q1; if (isline) { la.Text = "����:"; la.Location = new Point(52, 61 + 33 * i); groupBox1.Controls.Add(la); ta = new TextEdit(); ta.Location = new Point(157, 60 + 33 * i); ta.Size = new Size(231, 21); groupBox1.Controls.Add(ta); lb1.Text = "�ͺ�:"; lb1.Location = new Point(52, 61 + 33 * (i + 1)); groupBox1.Controls.Add(lb1); tb = new TextEdit(); tb.Location = new Point(157, 60 + 33 * (i + 1)); tb.Size = new Size(231, 21); groupBox1.Controls.Add(tb); try { if (li22 != null) { ta.Text = li22.Length; tb.Text = li22.LineType; } } catch { } } if (isPower) { l11.Text = "����:"; l11.Location = new Point(52, 61 + 33 * i); groupBox1.Controls.Add(l11); t11 = new TextEdit(); t11.Location = new Point(157, 60 + 33 * i); t11.Size = new Size(231, 21); groupBox1.Controls.Add(t11); l33.Text = "������:"; l33.Location = new Point(52, 61 + 33 * (i + 1)); groupBox1.Controls.Add(l33); t33 = new TextEdit(); t33.Location = new Point(157, 60 + 33 * (i + 1)); t33.Size = new Size(231, 21); groupBox1.Controls.Add(t33); try { if (sb != null) { t11.Text = sb.Burthen.ToString(); t33.Text = sb.ObligateField2; } } catch { } } groupBox1.Size = new Size(434, 124 + 33 * i); simpleButton1.Location = new Point(296, 144 + 33 * i); simpleButton2.Location = new Point(389, 144 + 33 * i); this.Size = new Size(490, 224 + 33 * i); }
//重新计算造价 private void UpdataLoadDatadata() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Nodes.Clear(); } ddd = DateTime.Now; sss += " 10:" + ddd.ToString(); PSP_PowerProValues_LangFang psp_Type = new PSP_PowerProValues_LangFang(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPSP_PowerProValues_LangFangByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } ddd = DateTime.Now; sss += " 11:" + ddd.ToString(); Project_Sum ps = new Project_Sum(); ps.S5 = "1"; IList<Project_Sum> sumline = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); ps.S5 = "2"; IList<Project_Sum> sumsubsation = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); Hashtable ha = new Hashtable(); ArrayList al = new ArrayList(); foreach (PSP_PowerProValues_LangFang psplf in listTypes) { if (psplf.Flag == 1)//纯线路造价计算 { if (psplf.L8 == "" || psplf.L8 == null) { psplf.L8 = "0"; } foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; psplf.L10 =Math.Round(psum.Num * double.Parse(psplf.L8),2); if (psplf.L11 == "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 = Math.Round(psplf.L10 + double.Parse(psplf.L11), 2); break; } } } if (psplf.Flag == 2) { ha.Clear(); al.Clear(); double sumvaluedata = 0; double sumvalueLine = 0; if (psplf.L6 != "" && psplf.L6 != null && psplf.L5 != "" && psplf.L5 != null)//变电站内的电站造价计算 { foreach (Project_Sum psum in sumsubsation) { if (psum.S1 == psplf.L4) { try { double mva = double.Parse(psplf.IsConn.ToString()); double t5 = Convert.ToDouble(psum.T5);//单台容量 int ta = Convert.ToInt32(psum.T1);//主变台数 if (mva == (t5 * ta)) { ha.Add(t5, ta); al.Add(t5); } } catch { } if (al.Count >0) { double va = Convert.ToDouble(al[0].ToString()); for (int ii = 0; ii < al.Count; ii++) { if (va < Convert.ToDouble(al[ii].ToString())) va = Convert.ToDouble(al[ii].ToString()); } psplf.L5 = ha[va].ToString(); psplf.L6 = va.ToString(); } else { psplf.L5 = ""; psplf.L6 = ""; } } } foreach (Project_Sum psum in sumsubsation) { if (psum.T1 == psplf.L5 && psum.T5 == psplf.L6 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvaluedata = psum.Num; break; } } } if (psplf.L8 != "" && psplf.L8 != null)//变电站内的线路造价计算 { foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvalueLine = psum.Num * double.Parse(psplf.L8); break; } } } psplf.L10 =Math.Round(sumvaluedata + sumvalueLine,2); if (psplf.L11== "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 =Math.Round(psplf.L10 + double.Parse(psplf.L11),2); Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangByid",psplf); } } ddd = DateTime.Now; sss += " 12:" + ddd.ToString();//测试运算时间,可删除 sss += " 13:" + ddd.ToString();//测试运算时间,可删除 dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PSP_PowerProValues_LangFang)); treeList1.DataSource = dataTable; treeList1.Columns["L3"].Caption = "工程名称"; treeList1.Columns["L3"].Width = 80; treeList1.Columns["L3"].OptionsColumn.AllowEdit = false; treeList1.Columns["L3"].OptionsColumn.AllowSort = false; treeList1.Columns["Title"].VisibleIndex = -1; treeList1.Columns["Title"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag"].VisibleIndex = -1; treeList1.Columns["Flag"].SortOrder = System.Windows.Forms.SortOrder.None; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].VisibleIndex = -1; treeList1.Columns["CreateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].SortOrder = System.Windows.Forms.SortOrder.None; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Code"].VisibleIndex = -1; treeList1.Columns["Code"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L1"].VisibleIndex = -1; treeList1.Columns["L1"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L2"].VisibleIndex = -1; treeList1.Columns["L2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L11"].VisibleIndex = -1; treeList1.Columns["L11"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L12"].VisibleIndex = -1; treeList1.Columns["L12"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L13"].VisibleIndex = -1; treeList1.Columns["L13"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L14"].VisibleIndex = -1; treeList1.Columns["L14"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L15"].VisibleIndex = -1; treeList1.Columns["L15"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L16"].VisibleIndex = -1; treeList1.Columns["L16"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L17"].VisibleIndex = -1; treeList1.Columns["L17"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L18"].VisibleIndex = -1; treeList1.Columns["L18"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L19"].VisibleIndex = -1; treeList1.Columns["L19"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Remark"].VisibleIndex = -1; treeList1.Columns["Remark"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; Application.DoEvents(); LoadValues(); TreeListColumn column = treeList1.Columns["L10"]; TreeListColumn column1 = treeList1.Columns["L12"]; for (int i = 0; i < treeList1.Nodes.Count; i++) { CalculateNodesValue(treeList1.Nodes[i], column, column1); } treeList1.ExpandAll(); } catch { } }
private void LoadDatadata() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Nodes.Clear(); } ddd = DateTime.Now; sss += " 10:" + ddd.ToString(); PSP_PowerProValues_LangFang psp_Type = new PSP_PowerProValues_LangFang(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPSP_PowerProValues_LangFangByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } ddd = DateTime.Now; sss += " 11:" + ddd.ToString(); Project_Sum ps = new Project_Sum(); ps.S5 = "1"; IList<Project_Sum> sumline = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); ps.S5 = "2"; IList<Project_Sum> sumsubsation = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); foreach (PSP_PowerProValues_LangFang psplf in listTypes) { if (psplf.Flag == 1)//纯线路造价计算 { if (psplf.L8 == "" || psplf.L8 == null) { psplf.L8 = "0"; } foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; psplf.L10 = Math.Round(psum.Num * double.Parse(psplf.L8), 2); if (psplf.L11 == "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 = Math.Round(psplf.L10 + double.Parse(psplf.L11), 2); break; } } } if (psplf.Flag == 2) { double sumvaluedata = 0; double sumvalueLine = 0; if (psplf.L6 != "" && psplf.L6 != null && psplf.L5 != "" && psplf.L5 != null)//变电站内的电站造价计算 { foreach (Project_Sum psum in sumsubsation) { if (psum.T1 == psplf.L5 && psum.T5 == psplf.L6 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvaluedata = psum.Num; break; } } } if (psplf.L8 != "" && psplf.L8 != null)//变电站内的线路造价计算 { foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvalueLine = psum.Num * double.Parse(psplf.L8); break; } } } psplf.L10 = Math.Round(sumvaluedata + sumvalueLine, 2); if (psplf.L11 == "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 = Math.Round(psplf.L10 + double.Parse(psplf.L11), 2); } } ddd = DateTime.Now; sss += " 12:" + ddd.ToString();//测试运算时间,可删除 sss += " 13:" + ddd.ToString();//测试运算时间,可删除 dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PSP_PowerProValues_LangFang)); //dataTable.DefaultView.Sort = "L4 desc"; //dataTable.DefaultView.Sort = "Title desc"; //dataTable.DefaultView.Sort = "CreateTime desc"; ////foreach (DataRow rw in dataTable.Rows) ////{ //// string ss = rw["Code"].ToString(); //// LineInfo li = Common.Services.BaseService.GetOneByKey<LineInfo>(ss); ////if (li != null && li.EleID != "") ////{ //// rw["L3"] = li.LineName; //// rw["L8"] = li.Length; //// rw["L9"] = li.LineType; ////} ////substation li1 = Common.Services.BaseService.GetOneByKey<substation>(ss); ////if (li1 != null && li1.EleID != "") ////{ //// rw["L3"] = li1.EleName; //// //rw["L5"] = li1.ObligateField2; //// //rw["L2"] = li1.Number; //// //rw["L6"] = li1.Burthen; ////} ////} treeList1.DataSource = dataTable; treeList1.Columns["L3"].Caption = "工程名称"; treeList1.Columns["L3"].Width = 80; treeList1.Columns["L3"].OptionsColumn.AllowEdit = false; treeList1.Columns["L3"].OptionsColumn.AllowSort = false; treeList1.Columns["Title"].VisibleIndex = -1; treeList1.Columns["Title"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag"].VisibleIndex = -1; treeList1.Columns["Flag"].SortOrder = System.Windows.Forms.SortOrder.None; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].VisibleIndex = -1; treeList1.Columns["CreateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].SortOrder = System.Windows.Forms.SortOrder.None; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Code"].VisibleIndex = -1; treeList1.Columns["Code"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L1"].VisibleIndex = -1; treeList1.Columns["L1"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L2"].VisibleIndex = -1; treeList1.Columns["L2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L11"].VisibleIndex = -1; treeList1.Columns["L11"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L12"].VisibleIndex = -1; treeList1.Columns["L12"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L13"].VisibleIndex = -1; treeList1.Columns["L13"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L14"].VisibleIndex = -1; treeList1.Columns["L14"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L15"].VisibleIndex = -1; treeList1.Columns["L15"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L16"].VisibleIndex = -1; treeList1.Columns["L16"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L17"].VisibleIndex = -1; treeList1.Columns["L17"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L18"].VisibleIndex = -1; treeList1.Columns["L18"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L19"].VisibleIndex = -1; treeList1.Columns["L19"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Remark"].VisibleIndex = -1; treeList1.Columns["Remark"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; Application.DoEvents(); LoadValues(); TreeListColumn column = treeList1.Columns["L10"]; TreeListColumn column1 = treeList1.Columns["L12"]; for (int i = 0; i < treeList1.Nodes.Count; i++) { CalculateNodesValue(treeList1.Nodes[i], column, column1); } treeList1.ExpandAll(); } catch { } }
private void InsertLineData1() { PowerEachList pel = this.ctrlPowerEachList1.FocusedObject; bool bl = true; string parentid = ""; string id = ""; string flag2 = ""; TreeListNode tln = treeList1.FocusedNode; //if (tln != null) //{ // bl = false; // try // { // parentid = tln["ParentID"].ToString(); // id = tln["ID"].ToString(); // flag2 = tln["Flag2"].ToString(); // } // catch // { } //} //else // { id = "0"; flag2 = pel.UID; //} PSP_PowerProValues_LangFang z = new PSP_PowerProValues_LangFang(); PowerProYears h = new PowerProYears(); PowerProValues j = new PowerProValues(); object obj = Services.BaseService.GetObject("SelectPowerProTypesList", ""); try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel文件(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); for (int i = 1; i < dts.Rows.Count; i++) { if (dts.Rows[i][1].ToString().IndexOf("合计") >= 0) continue; z.ID = Guid.NewGuid().ToString(); string strflag = ""; foreach (DataColumn dc in dts.Columns) { strflag = dc.Caption.ToString(); try { switch (strflag) { case "项目名称": z.Title = dts.Rows[i][dc.ColumnName].ToString(); break; case "工程名称": z.L3 = dts.Rows[i][dc.ColumnName].ToString(); break; case "电压等级": z.L4 = dts.Rows[i][dc.ColumnName].ToString(); break; case "主变台数": z.L5 = dts.Rows[i][dc.ColumnName].ToString(); break; case "单台容量(MVA)": z.L6 = dts.Rows[i][dc.ColumnName].ToString(); break; case "总容量(MVA)": z.IsConn = dts.Rows[i][dc.ColumnName].ToString(); break; case "建设形式": z.L7 = dts.Rows[i][dc.ColumnName].ToString(); break; case "线路长度(KM)": z.L8 = dts.Rows[i][dc.ColumnName].ToString(); break; case "导线型号": z.L9 = dts.Rows[i][dc.ColumnName].ToString(); break; //case "投资造价": // z.L11 = dts.Rows[i][dc.ColumnName].ToString(); // break; //case "造价比例": // z.L12 = dts.Rows[i][dc.ColumnName].ToString(); // break; case "标准造价(万元)": z.L10 =double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "造价调整(万元)": z.L11 = dts.Rows[i][dc.ColumnName].ToString(); break; case "工程总价(万元)": z.L12 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; default: j.Value = dts.Rows[i][dc.ColumnName].ToString(); j.TypeID = z.ID; j.Year = dc.ColumnName; j.TypeID1 = flag2; Services.BaseService.Update<PowerProValues>(j); break; } } catch { } } z.Flag2 = flag2; z.ParentID = "0"; //z.Flag = 1; PSP_PowerProValues_LangFang lf=(PSP_PowerProValues_LangFang)Services.BaseService.GetObject("SelectPSP_PowerProValues_LangFangByObject",z); if (lf == null) { Services.BaseService.Create<PSP_PowerProValues_LangFang>(z); } else { z.Code = lf.Code; z.Flag = lf.Flag; Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangBytable", z); } } } ReLoadData(); } catch { MsgBox.Show("导入格式不正确!"); } }
//加载设备情况表列字段 private void LoadData() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Columns.Clear(); } PowerProTypes psp_Type = new PowerProTypes(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPowerProTypesByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PowerProTypes)); foreach (DataRow rw in dataTable.Rows) { string ss = rw["Code"].ToString(); LineInfo li = Common.Services.BaseService.GetOneByKey<LineInfo>(ss); if (li != null && li.EleID != "") { rw["Title"] = li.LineName; rw["L3"] = li.Length; rw["L4"] = li.LineType; } substation li1 = Common.Services.BaseService.GetOneByKey<substation>(ss); if (li1 != null && li1.EleID != "") { rw["Title"] = li1.EleName; rw["L5"] = li1.ObligateField2; rw["L2"] = li1.Number; rw["L6"] = li1.Burthen; } } treeList1.DataSource = dataTable; treeList1.Columns["Title"].Caption = "项目名称"; treeList1.Columns["Title"].Width = 180; treeList1.Columns["Title"].OptionsColumn.AllowEdit = false; treeList1.Columns["Title"].OptionsColumn.AllowSort = false; treeList1.Columns["Flag"].VisibleIndex = -1; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag"].SortOrder = System.Windows.Forms.SortOrder.Ascending; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].VisibleIndex = -1; treeList1.Columns["CreateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].SortOrder = System.Windows.Forms.SortOrder.Ascending; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["IsConn"].VisibleIndex = -1; treeList1.Columns["IsConn"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["StartYear"].VisibleIndex = -1; treeList1.Columns["StartYear"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["EndYear"].VisibleIndex = -1; treeList1.Columns["EndYear"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; IList<PowerProYears> listYears = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", psp_Year); foreach (PowerProYears item in listYears) { AddColumn(item.Year); } AddColumn1(); Application.DoEvents(); LoadValues(); treeList1.ExpandAll(); } catch { } }
//加载设备情况表列字段 private void LoadData() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Columns.Clear(); } PowerProTypes psp_Type = new PowerProTypes(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPowerProTypesByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } DataTable ddt = new DataTable(); //ddt.Columns.Clear(); //ddt = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PowerProTypes)); //ddt.DefaultView.Sort = "CreateTime asc"; //DataView dv = new DataView(ddt); //dv.Sort = "CreateTime desc"; //DataSet ds = new DataSet(); //ds.Tables.Add(ddt); //ds.Tables[0].DefaultView.Sort = " CreateTime asc"; //dataTable = ddt.DefaultView.Table; dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PowerProTypes)); treeList1.DataSource = dataTable; treeList1.Columns["Title"].Caption = "区域名称"; treeList1.Columns["Title"].Width = 180; treeList1.Columns["Title"].OptionsColumn.AllowEdit = false; treeList1.Columns["Title"].OptionsColumn.AllowSort = false; treeList1.Columns["Flag"].VisibleIndex = -1; // treeList1.Columns["Flag"].SortOrder = System.Windows.Forms.SortOrder.Ascending; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].VisibleIndex = -1; treeList1.Columns["CreateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].SortOrder = System.Windows.Forms.SortOrder.Ascending; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; //treeList1.Columns["IsConn"].VisibleIndex = -1; //treeList1.Columns["IsConn"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["ID"].VisibleIndex = -1; treeList1.Columns["ID"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["ParentID"].VisibleIndex = -1; treeList1.Columns["ParentID"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["StartYear"].VisibleIndex = -1; treeList1.Columns["StartYear"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["EndYear"].VisibleIndex = -1; treeList1.Columns["EndYear"].OptionsColumn.ShowInCustomizationForm = false; //treeList1.Columns["Remark"].VisibleIndex = -1; //treeList1.Columns["Remark"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L1"].VisibleIndex = -1; treeList1.Columns["L1"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L2"].VisibleIndex = -1; treeList1.Columns["L2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L3"].VisibleIndex = -1; treeList1.Columns["L3"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; IList<PowerProYears> listYears = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", psp_Year); foreach (PowerProYears item in listYears) { AddColumn(item.Year); } // AddColumn1(); Application.DoEvents(); LoadValues(); treeList1.ExpandAll(); } catch(Exception ex) { MsgBox.Show(ex.Message); } }
private void InsertLineData1() { TreeListNode tln = treeList1.FocusedNode; if (tln == null) return; PowerProTypes z = new PowerProTypes(); PowerProYears h = new PowerProYears(); PowerProValues j = new PowerProValues(); string parentid = tln["ParentID"].ToString(); string id = tln["ID"].ToString(); string flag2 = tln["Flag2"].ToString(); object obj = Services.BaseService.GetObject("SelectPowerProTypesList", ""); try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel文件(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); for (int i = 1; i < dts.Rows.Count; i++) { if (dts.Rows[i][1].ToString().IndexOf("合计") >= 0) continue; z.ID = Guid.NewGuid().ToString(); string strflag = ""; foreach (DataColumn dc in dts.Columns) { strflag = dc.Caption.ToString(); try { switch (strflag) { case "项目名称": z.Title = dts.Rows[i][dc.ColumnName].ToString(); break; case "计划开工时间": if (dts.Rows[i][dc.ColumnName].ToString() == "") { z.StartYear = 0; } else z.StartYear = int.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "计划结束时间": if (dts.Rows[i][dc.ColumnName].ToString() == "") { z.EndYear = 0; } else z.EndYear = int.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "备注": z.IsConn = dts.Rows[i][dc.ColumnName].ToString(); break; case "备注2": break; case "台数": if (dts.Rows[i][dc.ColumnName].ToString() == "") { z.L1 = 0; } else z.L1 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "容量(MVA)": if (dts.Rows[i][dc.ColumnName].ToString() == "") { z.L2 = 0; } else z.L2 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "负荷率(%)": if (dts.Rows[i][dc.ColumnName].ToString() == "") { z.L5 = 0; } else z.L5 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "最大负荷(MVA)": if (dts.Rows[i][dc.ColumnName].ToString() == "") { z.L6 = 0; } else z.L6 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "长度(KM)": if (dts.Rows[i][dc.ColumnName].ToString() == "") { z.L3 = 0; } else z.L3 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "型号": z.L4 = dts.Rows[i][dc.ColumnName].ToString(); break; default: j.Value = dts.Rows[i][dc.ColumnName].ToString(); j.TypeID = z.ID; j.Year = dc.ColumnName; // j.TypeID1 = flag2; Services.BaseService.Create<PowerProValues>(j); break; } } catch { } ////if (dc.Caption.IndexOf("自定义列") >= 0) ////{ //// j.Value = dts.Rows[i][dc.ColumnName].ToString(); //// j.TypeID = z.ID; //// j.Year = dc.ColumnName; //// j.TypeID1 = flag2; //// Services.BaseService.Create<PowerProValues>(j); ////} ////if (dc.Caption.IndexOf("项目名称") >= 0) ////{ //// z.Title = dts.Rows[i][dc.ColumnName].ToString(); ////} ////if (dc.Caption.IndexOf("台数") >= 0) ////{ //// if (dts.Rows[i][dc.ColumnName].ToString() == "") //// { z.L1 = 0; } //// else //// z.L1 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); ////} ////if (dc.Caption.IndexOf("容量") >= 0) ////{ if (dts.Rows[i][dc.ColumnName].ToString() == "") //// { z.L2 = 0; } //// else //// z.L2 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); ////} ////if (dc.Caption.IndexOf("负荷率") >= 0) ////{ //// if (dts.Rows[i][dc.ColumnName].ToString() == "") //// { z.L5 = 0; } //// else //// z.L5 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); ////} ////if (dc.Caption.IndexOf("最大负荷") >= 0) ////{ //// if (dts.Rows[i][dc.ColumnName].ToString() == "") //// { z.L6 = 0; } //// else //// z.L6 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); ////} ////if (dc.Caption.IndexOf("长度") >= 0) ////{ //// if (dts.Rows[i][dc.ColumnName].ToString() == "") //// { z.L3 = 0; } //// else //// z.L3 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); ////} ////if (dc.Caption.IndexOf("型号") >= 0) ////{ //// z.L4 = dts.Rows[i][dc.ColumnName].ToString(); ////} ////if (dc.Caption.IndexOf("计划开工") >= 0) ////{ //// if (dts.Rows[i][dc.ColumnName].ToString() == "") //// { z.StartYear =0 ; } //// else //// z.StartYear = int.Parse(dts.Rows[i][dc.ColumnName].ToString()); ////} ////if (dc.Caption.IndexOf("计划结束") >= 0) ////{ //// if (dts.Rows[i][dc.ColumnName].ToString() == "") //// { z.EndYear = 0; } //// else //// z.EndYear = int.Parse(dts.Rows[i][dc.ColumnName].ToString()); ////} ////if (dc.Caption.IndexOf("备注") >= 0) ////{ //// z.IsConn = dts.Rows[i][dc.ColumnName].ToString(); ////} } z.Flag2 = flag2; z.ParentID = id; z.Flag = 1; Services.BaseService.Create<PowerProTypes>(z); } } ReLoadData(); } catch { MsgBox.Show("导入格式不正确!"); } }
private void FrmEditProject_Load(object sender, EventArgs e) { SetData(); string q1 = ""; string q2 = ""; string q3 = ""; string q4 = ""; string q5 = ""; string q6 = ""; string q7 = ""; string q8 = ""; string q9 = ""; string q10 = ""; string q11 = ""; string q12 = ""; int t1 = 0; PSP_PowerProValues_LangFang ppt = new PSP_PowerProValues_LangFang(); ppt.ID = poweruid; ppt.Flag2 = flag; PSP_PowerProValues_LangFang ps = Common.Services.BaseService.GetOneByKey<PSP_PowerProValues_LangFang>(ppt); if (ps != null) { groupBox1.Text = ps.Title; powerid = ps.Code; t1 = ps.Flag; // q1 = ps.L1; // q2 = ps.L2; q3 = ps.L3; q4 = ps.L4; q5 = ps.L5; q6 = ps.L6; q7 = ps.L7; q8 = ps.L8; q9 = ps.L9; q10 = ps.L10.ToString(); q11 = ps.L11; q12 = ps.L12.ToString(); } LineInfo li22 = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid); if (li22 != null || t1==1) { isline = true; } substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid); if (sb != null || t1 == 2) { isPower = true; } PowerProValues ppv = new PowerProValues(); ppv.TypeID = poweruid; ppv.TypeID1 = flag; IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv); PowerProYears pps = new PowerProYears(); pps.Flag = flag; IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps); lb=new Label[li.Count]; te=new TextEdit[li.Count]; int i=0; //if (!isPower) // { ////lt1.Text = "�豸����:"; ////lt1.Location = new Point(52, 27 + 33 * i); ////groupBox1.Controls.Add(lt1); ////tt1 = new TextEdit(); ////tt1.Location = new Point(157, 26 + 33 * i); ////tt1.Size = new Size(231, 21); ////tt1.TextChanged += new EventHandler(tt1_TextChanged); ////tt1.Properties.DisplayFormat.FormatString = "n4"; ////tt1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ////tt1.Properties.EditFormat.FormatString = "n4"; ////tt1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ////tt1.Properties.Mask.EditMask = "#####0.####"; ////tt1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; ////groupBox1.Controls.Add(tt1); ////i++; ////lt2.Text = "̨��:"; ////lt2.Location = new Point(52, 27 + 33 * i); ////groupBox1.Controls.Add(lt2); ////tt2 = new TextEdit(); ////tt2.Location = new Point(157, 26 + 33 * i); ////tt2.Size = new Size(231, 21); ////groupBox1.Controls.Add(tt2); ////i++; // } //if (!isline) { lt3.Text = "�� �� �� �� :"; lt3.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt3); // tt3 = new TextEdit(); cb0.Location = new Point(157, 26 + 33 * i); cb0.Size = new Size(231, 21); cb0.Properties.DisplayFormat.FormatString = "n0"; cb0.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb0.Properties.EditFormat.FormatString = "n0"; cb0.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb0.Properties.Mask.EditMask = "########"; cb0.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb0); i++; lt4.Text = "�� ѹ �� �� :"; lt4.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt4); // tt4 = new TextEdit(); cb1.Location = new Point(157, 26 + 33 * i); cb1.Size = new Size(231, 21); cb1.Properties.DisplayFormat.FormatString = "n4"; cb1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb1.Properties.EditFormat.FormatString = "n4"; cb1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb1.Properties.Mask.EditMask = "#####0.####"; cb1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb1); i++; lt5.Text = "�� �� ̨ �� :"; lt5.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt5); // tt5 = new TextEdit(); cb2.Location = new Point(157, 26 + 33 * i); cb2.Size = new Size(231, 21); cb2.Properties.DisplayFormat.FormatString = "####.##"; cb2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; cb2.Properties.EditFormat.FormatString = "####.##"; cb2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; // cb2.Properties.Mask.EditMask = "P2"; cb2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(cb2); i++; lt6.Text = "��̨������MVA��:"; lt6.Location = new Point(50, 27 + 33 * i); lt6.Width = 105; groupBox1.Controls.Add(lt6); //tt6 = new TextEdit(); cb3.Location = new Point(157, 26 + 33 * i); cb3.Size = new Size(231, 21); cb3.Properties.DisplayFormat.FormatString = "n4"; cb3.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb3.Properties.EditFormat.FormatString = "n4"; cb3.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb3.Properties.Mask.EditMask = "#####0.####"; cb3.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb3); i++; lt7.Text = "�� �� �� ʽ :"; lt7.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt7); //tt6 = new TextEdit(); cb4.Location = new Point(157, 26 + 33 * i); cb4.Size = new Size(231, 21); cb4.Properties.DisplayFormat.FormatString = "n4"; cb4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb4.Properties.EditFormat.FormatString = "n4"; cb4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb4.Properties.Mask.EditMask = "#####0.####"; cb4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb4); i++; lt8.Text = "��·���ȣ�KM��:"; lt8.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt8); //tt6 = new TextEdit(); tt4.Location = new Point(157, 26 + 33 * i); tt4.Size = new Size(231, 21); tt4.Properties.DisplayFormat.FormatString = "n4"; tt4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; tt4.Properties.EditFormat.FormatString = "n4"; tt4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // tt4.Properties.Mask.EditMask = "#####0.####"; tt4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(tt4); i++; lt9.Text = "�� �� �� �� :"; lt9.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt9); //tt6 = new TextEdit(); cb5.Location = new Point(157, 26 + 33 * i); cb5.Size = new Size(231, 21); cb5.Properties.DisplayFormat.FormatString = "n4"; cb5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb5.Properties.EditFormat.FormatString = "n4"; cb5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb5.Properties.Mask.EditMask = "#####0.####"; cb5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb5); i++; Project_Sum sum = new Project_Sum(); sum.S5 = islineflag; sum.S1 = q4; IList<Project_Sum> list = Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5",sum); upedit.Properties.DataSource = list; LookUpColumnInfo a = new LookUpColumnInfo(); a.FieldName = "T3"; a.Caption = "������ʽ"; LookUpColumnInfo c = new LookUpColumnInfo(); c.FieldName = "T2"; c.Caption = "���߹�ģ"; LookUpColumnInfo b = new LookUpColumnInfo(); b.FieldName = "T1"; b.Caption = "����̨��������"; LookUpColumnInfo d = new LookUpColumnInfo(); d.Caption = "��̬Ͷ��"; d.FieldName = "Num"; LookUpColumnInfo nn = new LookUpColumnInfo(); nn.FieldName = "Name"; nn.Caption = "���"; LookUpColumnInfo f = new LookUpColumnInfo(); f.FieldName = "Type"; f.Caption = "����"; upedit.Properties.Columns.Add(f); upedit.Properties.Columns.Add(nn); upedit.Properties.Columns.Add(b); upedit.Properties.Columns.Add(c); upedit.Properties.Columns.Add(a); upedit.Properties.Columns.Add(d); upedit.Properties.DisplayMember = "Num"; //upedit.Properties.SearchMode = SearchMode.AutoComplete; //upedit.Properties.AutoSearchColumnIndex = 5; upedit.Properties.DropDownRows =5; upedit.Properties.PopupWidth = 500; upedit.Properties.ShowHeader = true; lt10.Text = "Ͷ �� �� �� :"; lt10.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt10); upedit.Location = new Point(157, 26 + 33 * i); upedit.Size = new Size(231, 21); upedit.Properties.DisplayFormat.FormatString = "n4"; upedit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; upedit.Properties.EditFormat.FormatString = "n4"; upedit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; upedit.Properties.Mask.EditMask = "###############0.####"; upedit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; upedit.Properties.AllowNullInput=DevExpress.Utils.DefaultBoolean.True; upedit.TextChanged += new EventHandler(upedit_TextChanged); groupBox1.Controls.Add(upedit); i++; lt11.Text = "�� �� �� �� :"; lt11.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt11); //tt6 = new TextEdit(); tt6.Location = new Point(157, 26 + 33 * i); tt6.Size = new Size(231, 21); tt6.Properties.DisplayFormat.FormatString = "n4"; tt6.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.EditFormat.FormatString = "n4"; tt6.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.Mask.EditMask = "###############0.####"; tt6.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; tt6.TextChanged += new EventHandler(tt6_TextChanged); groupBox1.Controls.Add(tt6); i++; lt12.Text = "�� �� �� �� :"; lt12.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt12); //tt6 = new TextEdit(); tt5.Location = new Point(157, 26 + 33 * i); tt5.Size = new Size(231, 21); tt5.Properties.DisplayFormat.FormatString = "n4"; tt5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt5.Properties.EditFormat.FormatString = "n4"; tt5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt5.Properties.Mask.EditMask = "###############0.####"; tt5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt5); i++; } int j = 0; foreach (PowerProYears ppy in li) { lb[j] = new Label(); lb[j].Name = "Label" + ppy.Year; lb[j].Text = ppy.Year + ":"; lb[j].Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lb[j]); te[j] = new TextEdit(); te[j].Name = "Text" + ppy.Year; te[j].Location = new Point(157, 26 + 33 * i); te[j].Size = new Size(231, 21); groupBox1.Controls.Add(te[j]); foreach (PowerProValues ppy1 in listValues) { if (ppy.Year == ppy1.Year) te[j].Text = ppy1.Value; } j++; i++; } if (isline) { try { // cb5.Properties.Items.Contains(q9.ToString()); //tt1.Text = q3.ToString(); //tt2.Text = q4.ToString(); //if (li22 != null) //{ // tt1.Text = li22.Length; // tt2.Text = li22.LineType; //} } catch { } } if (isPower) { try { ////tt3.Text = q1.ToString(); //tt4.Text = q4.ToString(); //tt5.Text = q5.ToString(); //tt6.Text = q6.ToString(); //if (sb != null) //{ // tt5.Text = sb.Number.ToString(); // tt4.Text = sb.ObligateField2; // tt6.Text = sb.Burthen.ToString(); //} } catch { } } PSP_PowerProValues_LangFang pplf = new PSP_PowerProValues_LangFang(); pplf.Flag2 = flag; IList<PSP_PowerProValues_LangFang> plfs = Common.Services.BaseService.GetList<PSP_PowerProValues_LangFang>("SelectPSP_PowerProValues_LangFangByFlag2OrderL3", pplf); tt4.Text = q8.ToString(); tt5.Text = q10.ToString(); tt6.Text = q12.ToString(); if (plfs.Count == 0) { cb0.Text = ""; } foreach (PSP_PowerProValues_LangFang pv in plfs) { if(pv.L3!=""&&pv.L3.Length>0) cb0.Properties.Items.Add(pv.L3); } cb0.Text = q3.ToString(); cb1.Text = q4.ToString(); cb2.Text = q5.ToString(); cb3.Text = q6.ToString(); cb4.Text = q7.ToString(); cb5.Text = q9.ToString(); lookupedit = q11; upedit.Properties.NullText = q11; groupBox1.Size = new Size(434, 40+ 33 * i); simpleButton1.Location = new Point(296, 60 + 33 * i); simpleButton2.Location = new Point(389, 60 + 33 * i); this.Size = new Size(490, 130 + 33 * i); }
private void InsertLineData2() { PowerEachList pel = this.ctrlPowerEachList11.FocusedObject; if (pel==null) { MsgBox.Show("请先添加项目规划"); return; } TreeListNode tln = treeList1.FocusedNode; //try //{ // string parentid = tln["ParentID"].ToString(); // string id = tln["ID"].ToString(); // string flag2 = tln["Flag2"].ToString(); //} //catch { } string typeid = pel.UID; PowerProTypes z = new PowerProTypes(); PowerProYears h = new PowerProYears(); PowerProValues j = new PowerProValues(); PowerProYears ppy1=new PowerProYears(); ppy1.Flag=typeid; //IList<PowerProYears> listppy = Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", ppy1); try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel文件(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); for (int i = 0; i < dts.Rows.Count; i++) { //if (dts.Rows[i][1].ToString().IndexOf("合计") >= 0) // continue; z = new PowerProTypes(); string guid=Guid.NewGuid().ToString(); z.ID = guid; z.Flag2 = typeid; // z.ParentID = id; string strflag = ""; foreach (DataColumn dc in dts.Columns) { strflag = dc.Caption.ToString(); try { switch (strflag) { case "区域名称": z.Title = dts.Rows[i][dc.ColumnName].ToString(); break; case "项目名称": z.Code = dts.Rows[i][dc.ColumnName].ToString(); break; case "建设性质": z.L4 = dts.Rows[i][dc.ColumnName].ToString(); break; case "变电容量(MVA)": try { z.IsConn =dts.Rows[i][dc.ColumnName].ToString(); } catch { z.L2 = 0; } break; case "线路长度(KM)": try { z.Remark = dts.Rows[i][dc.ColumnName].ToString(); } catch { z.L3 = 0; } break; case "投产年限": try { z.L5 = Convert.ToDouble(dts.Rows[i][dc.ColumnName].ToString()); } catch { z.L5 = 0; } break; case "总投资(万元)": try { z.L6 = Convert.ToDouble(dts.Rows[i][dc.ColumnName].ToString()); } catch { z.L6 = 0; } break; default: try { PowerProYears ppy2 = new PowerProYears(); ppy2.Year = strflag; ppy2.Flag = typeid; IList<PowerProYears> listyear2 = Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsByYearFlag", ppy2); if (listyear2.Count == 0) { Services.BaseService.Create<PowerProYears>(ppy2); } PowerProTypes pvalues = (PowerProTypes)Services.BaseService.GetObject("SelectPowerProTypesByCodeAndTitle", z); if (pvalues != null) z.ID = pvalues.ID; j = new PowerProValues(); j.TypeID = z.ID; j.TypeID1 = typeid; j.Year = strflag; j.Value = dts.Rows[i][dc.ColumnName].ToString(); Services.BaseService.Update<PowerProValues>(j); } catch { } break; } } catch { } } Services.BaseService.Update("UpdatePowerProTypesByCodeAndTitle", z); } } ReLoadData(); } catch { MsgBox.Show("导入格式不正确!"); } }
private void FrmEditProject_Load(object sender, EventArgs e) { string q1 = ""; string q2 = ""; string q3 = ""; string q4 = ""; string q5 = ""; double? q6 = null; string q7 = ""; string q8 = ""; string c1 = ""; string c2 = ""; string c3 = ""; int t1 = 0; PowerProTypes ppt = new PowerProTypes(); try { ppt.ID = poweruid.ToString(); } catch { } ppt.Flag2 = flag; try { ppt = (PowerProTypes)Common.Services.BaseService.GetOneByKey<PowerProTypes>(ppt); } catch { } if (ppt != null) { q1 = ppt.Remark; q2 = ppt.L4.ToString(); q3 = ppt.Title; q4 = ppt.IsConn; q5 = ppt.L5.ToString(); q6 = ppt.L6; q7 = ppt.Code.ToString(); } PowerProValues ppv = new PowerProValues(); ppv.TypeID = poweruid; ppv.TypeID1 = flag; IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv); PowerProYears pps = new PowerProYears(); pps.Flag = flag; IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps); lb=new Label[li.Count]; te=new TextEdit[li.Count]; int i=0; lt3.Text = "��������:"; lt3.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt3); tt3 = new TextEdit(); tt3.Location = new Point(157, 26 + 33 * i); tt3.Size = new Size(231, 21); groupBox1.Controls.Add(tt3); i++; lt7.Text = "��Ŀ����:"; lt7.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt7); tt7 = new TextEdit(); tt7.Location = new Point(157, 26 + 33 * i); tt7.Size = new Size(231, 21); groupBox1.Controls.Add(tt7); i++; lt2.Text = "��������:"; lt2.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt2); tt2 = new TextEdit(); tt2.Location = new Point(157, 26 + 33 * i); tt2.Size = new Size(231, 21); groupBox1.Controls.Add(tt2); i++; lt4.Text = "�������:"; lt4.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt4); tt4 = new TextEdit(); tt4.Location = new Point(157, 26 + 33 * i); tt4.Size = new Size(231, 21); ////tt4.Properties.DisplayFormat.FormatString = "n4"; ////tt4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ////tt4.Properties.EditFormat.FormatString = "n4"; ////tt4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ////tt4.Properties.Mask.EditMask = "#########"; ////tt4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt4); i++; lt1.Text = "��·����:"; lt1.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt1); tt1 = new TextEdit(); tt1.Location = new Point(157, 26 + 33 * i); tt1.Size = new Size(231, 21); ////tt1.Properties.DisplayFormat.FormatString = "n4"; ////tt1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ////tt1.Properties.EditFormat.FormatString = "n4"; ////tt1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ////tt1.Properties.Mask.EditMask = "#####0.####"; ////tt1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt1); i++; lt5.Text = "Ͷ������:"; lt5.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt5); tt5 = new TextEdit(); tt5.Location = new Point(157, 26 + 33 * i); tt5.Size = new Size(231, 21); tt5.Properties.DisplayFormat.FormatString = "n4"; tt5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt5.Properties.EditFormat.FormatString = "n4"; tt5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt5.Properties.Mask.EditMask = "####"; tt5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt5); i++; lt6.Text = "��Ͷ�ʣ���Ԫ��:"; lt6.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt6); tt6 = new TextEdit(); tt6.Location = new Point(157, 26 + 33 * i); tt6.Size = new Size(231, 21); tt6.Properties.DisplayFormat.FormatString = "n4"; tt6.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.EditFormat.FormatString = "n4"; tt6.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.Mask.EditMask = "#####0.####"; tt6.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt6); i++; int j = 0; foreach (PowerProYears ppy in li) { lb[j] = new Label(); lb[j].Name = "Label" + ppy.Year; lb[j].Text = ppy.Year + ":"; lb[j].Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lb[j]); te[j] = new TextEdit(); te[j].Name = "Text" + ppy.Year; te[j].Location = new Point(157, 26 + 33 * i); te[j].Size = new Size(231, 21); groupBox1.Controls.Add(te[j]); foreach (PowerProValues ppy1 in listValues) { if (ppy.Year == ppy1.Year) te[j].Text = ppy1.Value; } j++; i++; } try { tt1.Text = q1.ToString(); tt4.Text = q4.ToString(); } catch { } try { tt3.Text = q3.ToString(); tt2.Text = q2.ToString(); tt5.Text = q5.ToString(); tt6.Text = q6.ToString(); tt7.Text = q7.ToString(); } catch { } groupBox1.Size = new Size(434, 30 + 33 * i); simpleButton1.Location = new Point(296, 50 + 33 * i); simpleButton2.Location = new Point(389, 50 + 33 * i); this.Size = new Size(490, 130 + 33 * i); }
//////void GridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) //////{ ////// if (this.ctrlPowerEachList1.FocusedObject == null) ////// return; ////// //this.ctrlPowerEachList1.LineUID = this.ctrlPowerEachTotalList1.FocusedObject.UID; ////// //this.ctrlPowerEachList1.LineName = this.ctrlPowerEachTotalList1.FocusedObject.ListName; ////// //this.ctrlPowerEachList1.RefreshData(); ////// typeFlag2 = this.ctrlPowerEachList1.FocusedObject.UID; ////// this.Cursor = Cursors.WaitCursor; ////// treeList1.BeginUpdate(); ////// LoadData(); ////// treeList1.EndUpdate(); ////// this.Cursor = Cursors.Default; //////} //加载设备情况表列字段 private void LoadData() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Columns.Clear(); } PowerProTypes psp_Type = new PowerProTypes(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPowerProTypesByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PowerProTypes)); treeList1.DataSource = dataTable; treeList1.Columns["Title"].Caption = "项目名称"; treeList1.Columns["Title"].Width = 180; treeList1.Columns["Title"].OptionsColumn.AllowEdit = false; treeList1.Columns["Title"].OptionsColumn.AllowSort = false; treeList1.Columns["Flag"].VisibleIndex = -1; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; IList<PowerProYears> listYears = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", psp_Year); foreach (PowerProYears item in listYears) { AddColumn(item.Year); } AddColumn1(); Application.DoEvents(); LoadValues(); treeList1.ExpandAll(); } catch { } }
private void FrmEditProject_Load(object sender, EventArgs e) { PowerProTypes ps = (PowerProTypes)Common.Services.BaseService.GetObject("SelectPowerProTypesByCode", powerid); if (ps != null) { groupBox1.Text = ps.Title; poweruid = ps.ID; } PowerProValues ppv = new PowerProValues(); ppv.TypeID = poweruid; IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv); PowerProYears pps = new PowerProYears(); pps.Flag = flag; IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps); lb=new Label[li.Count]; te=new TextEdit[li.Count]; int i=0; foreach (PowerProYears ppy in li) { lb[i] = new Label(); lb[i].Name= "Label"+ppy.Year; lb[i].Text = ppy.Year+":"; lb[i].Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lb[i]); te[i] = new TextEdit(); te[i].Name = "Text" + ppy.Year; te[i].Location = new Point(157, 26 + 33 * i); te[i].Size = new Size(231, 21); groupBox1.Controls.Add(te[i]); foreach (PowerProValues ppy1 in listValues) { if (ppy.Year == ppy1.Year) te[i].Text = ppy1.Value; } i++; } if (isline) { la.Text = "����"; la.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(la); TextEdit ta = new TextEdit(); ta.Location = new Point(157, 26 + 33 * i); ta.Size = new Size(231, 21); groupBox1.Controls.Add(ta); lb1.Text = "����"; lb1.Location = new Point(52, 27 + 33 * (i + 1)); groupBox1.Controls.Add(lb1); TextEdit tb = new TextEdit(); tb.Location = new Point(157, 26 + 33 * (i + 1)); tb.Size = new Size(231, 21); groupBox1.Controls.Add(tb); lc.Text = "��ѹ"; lc.Location = new Point(52, 27 + 33 * (i + 2)); groupBox1.Controls.Add(lc); TextEdit tc = new TextEdit(); tc.Location = new Point(157, 26 + 33 * (i + 2)); tc.Size = new Size(231, 21); groupBox1.Controls.Add(tc); } if(isPower) { l11.Text = "����"; l11.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(l11); TextEdit t11 = new TextEdit(); t11.Location = new Point(157, 26 + 33 * i); t11.Size = new Size(231, 21); groupBox1.Controls.Add(t11); l22.Text = "��ѹ�ȼ�"; l22.Location = new Point(52, 27 + 33 * (i + 1)); groupBox1.Controls.Add(l22); TextEdit t22 = new TextEdit(); t22.Location = new Point(157, 26 + 33 * (i + 1)); t22.Size = new Size(231, 21); groupBox1.Controls.Add(t22); l33.Text = "������"; l33.Location = new Point(52, 27 + 33 * (i + 2)); groupBox1.Controls.Add(l33); TextEdit t33 = new TextEdit(); t33.Location = new Point(157, 26 + 33 * (i + 2)); t33.Size = new Size(231, 21); groupBox1.Controls.Add(t33); } }
//加载设备情况表列字段 private void LoadData() { //string uid = ""; //string dy=""; //PowerProTypes ppt = (PowerProTypes)Services.BaseService.GetObject("SelectPowerProTypesByCode", uid); //ppt.ParentID = dy.ToLower().Replace("kv", ""); //ppt.Title = "";//名称 //ppt.L1 = "";//台数 //ppt.L2 = "";//容量 //ppt.L3 = "";//长度 //ppt.L4 = "";//型号 //ppt.L5 = "";//负荷率 //ppt.L6 = "";//最大负荷 //Services.BaseService.Update("UpdatePowerProTypesByCode", ppt); try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Columns.Clear(); } PowerProTypes psp_Type = new PowerProTypes(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPowerProTypesByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PowerProTypes)); treeList1.DataSource = dataTable; treeList1.Columns["Title"].Caption = "项目名称"; treeList1.Columns["Title"].Width = 180; treeList1.Columns["Title"].OptionsColumn.AllowEdit = false; treeList1.Columns["Title"].OptionsColumn.AllowSort = false; treeList1.Columns["Flag"].VisibleIndex = -1; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; IList<PowerProYears> listYears = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", psp_Year); foreach (PowerProYears item in listYears) { AddColumn(item.Year); } AddColumn1(); Application.DoEvents(); LoadValues(); treeList1.ExpandAll(); } catch { } }
private void FrmEditProject_Load(object sender, EventArgs e) { double? q1 = null; double? q2 = null; double? q3 = null; string q4 = ""; double? q5 = null; double? q6 = null; string q7 = ""; string q8 = ""; string c1 = ""; string c2 = ""; string c3 = ""; int t1 = 0; PowerProTypes ppt = new PowerProTypes(); ppt.ID = poweruid; ppt.Flag2 = flag; PowerProTypes ps = Common.Services.BaseService.GetOneByKey<PowerProTypes>(ppt); if (ps != null) { groupBox1.Text = ps.Title; powerid = ps.Code; c1 = ps.StartYear.ToString(); c2 = ps.EndYear.ToString(); c3 = ps.Remark; t1 = ps.Flag; q1 = ps.L1; q2 = ps.L2; q3 = ps.L3; q4 = ps.L4; q5 = ps.L5; q6 = ps.L6; } LineInfo li22 = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid); if (li22 != null || t1==1) { isline = true; } substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid); if (sb != null || t1 == 2) { isPower = true; } PowerProValues ppv = new PowerProValues(); ppv.TypeID = poweruid; ppv.TypeID1 = flag; IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv); PowerProYears pps = new PowerProYears(); pps.Flag = flag; IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps); lb=new Label[li.Count]; te=new TextEdit[li.Count]; int i=0; if (!isPower) { lt1.Text = "����:"; lt1.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt1); tt1 = new TextEdit(); tt1.Location = new Point(157, 26 + 33 * i); tt1.Size = new Size(231, 21); tt1.Properties.DisplayFormat.FormatString = "n4"; tt1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt1.Properties.EditFormat.FormatString = "n4"; tt1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt1.Properties.Mask.EditMask = "#####0.####"; tt1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt1); i++; lt2.Text = "�ͺ�:"; lt2.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt2); tt2 = new TextEdit(); tt2.Location = new Point(157, 26 + 33 * i); tt2.Size = new Size(231, 21); groupBox1.Controls.Add(tt2); i++; } if (!isline) { lt3.Text = "̨��:"; lt3.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt3); tt3 = new TextEdit(); tt3.Location = new Point(157, 26 + 33 * i); tt3.Size = new Size(231, 21); tt3.Properties.DisplayFormat.FormatString = "n0"; tt3.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt3.Properties.EditFormat.FormatString = "n0"; tt3.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt3.Properties.Mask.EditMask = "########"; tt3.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt3); i++; lt4.Text = "����:"; lt4.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt4); tt4 = new TextEdit(); tt4.Location = new Point(157, 26 + 33 * i); tt4.Size = new Size(231, 21); tt4.Properties.DisplayFormat.FormatString = "n4"; tt4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt4.Properties.EditFormat.FormatString = "n4"; tt4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt4.Properties.Mask.EditMask = "#####0.####"; tt4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt4); i++; lt5.Text = "������(%):"; lt5.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt5); tt5 = new TextEdit(); tt5.Location = new Point(157, 26 + 33 * i); tt5.Size = new Size(231, 21); tt5.Properties.DisplayFormat.FormatString = "####.##"; tt5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt5.Properties.EditFormat.FormatString = "####.##"; tt5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt5.Properties.Mask.EditMask = "P2"; tt5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt5); i++; lt6.Text = "���:"; lt6.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt6); tt6 = new TextEdit(); tt6.Location = new Point(157, 26 + 33 * i); tt6.Size = new Size(231, 21); tt6.Properties.DisplayFormat.FormatString = "n4"; tt6.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.EditFormat.FormatString = "n4"; tt6.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.Mask.EditMask = "#####0.####"; tt6.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt6); i++; } int j = 0; foreach (PowerProYears ppy in li) { lb[j] = new Label(); lb[j].Name = "Label" + ppy.Year; lb[j].Text = ppy.Year + ":"; lb[j].Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lb[j]); te[j] = new TextEdit(); te[j].Name = "Text" + ppy.Year; te[j].Location = new Point(157, 26 + 33 * i); te[j].Size = new Size(231, 21); groupBox1.Controls.Add(te[j]); foreach (PowerProValues ppy1 in listValues) { if (ppy.Year == ppy1.Year) te[j].Text = ppy1.Value; } j++; i++; } if (!isstuff) { ls1.Text = "�ƻ���ʼʱ��:"; ls1.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(ls1); ts1 = new TextEdit(); ts1.Location = new Point(157, 27 + 33 * i); ts1.Size = new Size(231, 21); if (c1 == "0" || c1 == "") { ts1.Text = ""; } else { ts1.Text = c1; } ts1.Properties.DisplayFormat.FormatString = "n0"; ts1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ts1.Properties.EditFormat.FormatString = "n0"; ts1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ts1.Properties.Mask.EditMask = "####"; ts1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(ts1); i++; ls2.Text = "Ԥ��Ͷ��ʱ��:"; ls2.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(ls2); ts2 = new TextEdit(); ts2.Location = new Point(157, 27 + 33 * i); ts2.Size = new Size(231, 21); ts2.Properties.DisplayFormat.FormatString = "n0"; ts2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ts2.Properties.EditFormat.FormatString = "n0"; ts2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ts2.Properties.Mask.EditMask = "####"; ts2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(ts2); if (c2 == "0" || c2 == "") { ts2.Text = ""; } else { ts2.Text = c2; } i++; } ls3.Text = "��ע:"; ls3.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(ls3); ts3 = new TextEdit(); ts3.Location = new Point(157, 27 + 33 * i); ts3.Size = new Size(231, 21); groupBox1.Controls.Add(ts3); ts3.Text = c3; if (isline) { try { tt1.Text = q3.ToString(); tt2.Text = q4.ToString(); if (li22 != null) { tt1.Text = li22.Length; tt2.Text = li22.LineType; } } catch { } } if (isPower) { try { tt3.Text = q1.ToString(); tt4.Text = q2.ToString(); tt5.Text = q5.ToString(); tt6.Text = q6.ToString(); if (sb != null) { tt4.Text = sb.Number.ToString(); tt5.Text = sb.ObligateField2; tt6.Text = sb.Burthen.ToString(); } } catch { } } groupBox1.Size = new Size(434, 130 + 33 * i); simpleButton1.Location = new Point(296, 150 + 33 * i); simpleButton2.Location = new Point(389, 150 + 33 * i); this.Size = new Size(490, 230 + 33 * i); }