private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } if (treeList1.FocusedNode.ParentNode == null) { MsgBox.Show("根项目不允许删除!"); return; } if (treeList1.FocusedNode.HasChildren) { MsgBox.Show("此项目下有子项目,请先删除子项目!"); return; } if (MsgBox.ShowYesNo("是否删除项目 " + treeList1.FocusedNode.GetValue("Title") + "?") == DialogResult.Yes) { //PowerProTypes ppy = new PowerProTypes(); //ppy.ID = treeList1.FocusedNode["ID"].ToString(); //ppy.Flag2 = typeFlag2; //PowerProTypes psp_Type = Services.BaseService.GetOneByKey<PowerProTypes>(ppy); PowerProValues PowerValues = new PowerProValues(); PowerValues.TypeID = treeList1.FocusedNode["ID"].ToString(); PowerValues.Year = typeFlag2; try { //DeletePowerValuesByType里面删除数据和分类 Common.Services.BaseService.Update("DeletePowerProValuesByType", PowerValues); TreeListNode brotherNode = null; try { if (treeList1.FocusedNode.ParentNode.Nodes.Count > 1) { brotherNode = treeList1.FocusedNode.PrevNode; if (brotherNode == null) { brotherNode = treeList1.FocusedNode.NextNode; } } } catch { } treeList1.DeleteNode(treeList1.FocusedNode); LoadData(); } catch (Exception ex) { MsgBox.Show("删除出错:" + ex.Message); } } }
private bool SaveCellValue(string year, string typeID, string value) { PowerProValues PowerValues = new PowerProValues(); PowerValues.TypeID = typeID; PowerValues.Value = value; PowerValues.Year = year; PowerValues.TypeID1 = typeFlag2; try { Common.Services.BaseService.Update <PowerProValues>(PowerValues); } catch (Exception ex) { MsgBox.Show("保存数据出错:" + ex.Message); return(false); } return(true); }
private void simpleButton1_Click(object sender, EventArgs e) { type = psp_Year.Year = spinEdit1.Text; if (type.ToString() == "") { MsgBox.Show("类别名称不能为空"); return; } try { if (!IsUpdate) { if (Common.Services.BaseService.GetObject("SelectPowerProYearsByYearFlag", psp_Year) == null) { try { Common.Services.BaseService.Create <PowerProYears>(psp_Year); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MsgBox.Show("出错啦:" + ex.Message); } } else { MsgBox.Show("此分类已经存在,请重新输入!"); } } else { try { PowerProTypes psp_Type = new PowerProTypes(); psp_Type.Flag2 = type1; IList <PowerProTypes> listTypes = new List <PowerProTypes>(); try { listTypes = Common.Services.BaseService.GetList <PowerProTypes>("SelectPowerProTypesByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } foreach (PowerProTypes pstt in listTypes) { PowerProValues psv = new PowerProValues(); psv.TypeID = pstt.ID; psv.Year = psp_Year.Year; psv.Value = year2; psv.TypeID1 = flag2; Common.Services.BaseService.Update("UpdatePowerProValuesByYear", psv); } Common.Services.BaseService.Update <PowerProYears>(psp_Year); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MsgBox.Show("出错啦:" + ex.Message); } } } catch (Exception ex) { MsgBox.Show("出错啦:" + ex.Message); } }
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); }
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); }
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 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 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); } }