/// <summary> /// 规划变现状 /// </summary> public void Gh_BXZ() { Layer lay1 = null; string stype = ""; int year = 0; SortedList LineList = new SortedList(); SortedList subList = new SortedList(); lay1 = tlVectorControl1.SVGDocument.CurrentLayer; try { year = Convert.ToInt32(lay1.Label.Substring(0, 4)); } catch (Exception e1) { MessageBox.Show("选择图层的图层名称不包含年份信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (year > System.DateTime.Today.Year) { MessageBox.Show("选择图层信息大于当前年份,不能变成现状数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } foreach (SvgElement ele in lay1.GraphList) { if (ele.Name == "use") { if (((Use)ele).GraphId.Contains("gh")) { string elename; //if (((Use)ele).GraphId == "gh-Substation500") //{ // elename= "Substation500-1"; //} //else //{ // elename = ((Use)ele).GraphId.Substring(3); //} //PointF pnt1 = TLMath.getUseOffset("#" + ((Use)ele).GraphId); //PointF pnt2 = TLMath.getUseOffset("#" + elename); //float x = pnt2.X - pnt1.X; //float y = pnt2.Y - pnt1.Y; //ele.SetAttribute("xlink:href", elename); //Matrix matrix2 = ((Use)ele).Transform.Matrix.Clone(); //matrix2.Translate(-x, -y, MatrixOrder.Append); //((Use)ele).Transform = new ItopVector.Core.Types.Transf(matrix2); substation sub1 = new substation(); sub1.EleID = ele.ID; sub1.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; sub1 = (substation)Services.BaseService.GetObject("SelectsubstationByEleID", sub1); if (sub1 != null) { Substation_Info sub = new Substation_Info(); sub.Code = ele.ID; sub = (Substation_Info)Services.BaseService.GetObject("SelectSubstation_InfoByCode", sub); if (sub == null) { sub = new Substation_Info(); sub.UID = Guid.NewGuid().ToString(); sub.Code = sub1.EleID; sub.Flag = "1"; sub.Title = sub1.EleName; sub.L1 = Convert.ToInt32(sub1.ObligateField1); sub.L2 = Convert.ToDouble(sub1.Number); sub.L9 = Convert.ToDouble(sub1.Burthen); sub.L10 = Convert.ToDouble(sub1.ObligateField2.Replace("%", "")); sub.IsConn = "是"; Services.BaseService.Create<Substation_Info>(sub); } } } } if (ele.Name == "polyline" && ele.GetAttribute("IsLead") == "1") { string str = ele.GetAttribute("style"); str = str.Replace("stroke-dasharray:" + ghType + ";", ""); ele.RemoveAttribute("style"); ele.SetAttribute("style", str); LineInfo line1 = new LineInfo(); line1.EleID = ele.ID; line1.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; line1 = (LineInfo)Services.BaseService.GetObject("SelectLineInfoByEleID", line1); if (line1 != null) { line1.ObligateField1 = "运行"; Services.BaseService.Update<LineInfo>(line1); Line_Info line = new Line_Info(); line.Code = ele.ID; line = (Line_Info)Services.BaseService.GetObject("SelectLine_InfoByCode", line); if (line == null) { line = new Line_Info(); line.UID = Guid.NewGuid().ToString(); line.L1 = Convert.ToInt32(line1.Voltage); line.L4 = line1.LineType; line.L5 = Convert.ToDouble(line1.Length); line.Code = line1.EleID; line.IsConn = "是"; line.L6 = DateTime.Today.Year.ToString(); Services.BaseService.Create<Line_Info>(line); } } } } tlVectorControl1.Refresh(); }
private void InitSodata2() { string sid = "1"; Hashtable hs1 = new Hashtable(); Hashtable hs3 = new Hashtable(); IList<substation> listsubstation = Services.BaseService.GetList<substation>("SelectsubstationByPowerIDStuff", sid); foreach (substation s1 in listsubstation) { hs1.Add(Guid.NewGuid().ToString(), s1.UID); } IList<Substation_Info> ll2 = Common.Services.BaseService.GetList<Substation_Info>("SelectSubstation_InfoByFlag", sid); foreach (Substation_Info ps in ll2) { hs3.Add(Guid.NewGuid().ToString(), ps.Code); } foreach (Substation_Info p2 in ll2) { if (p2.Code != "" && !hs1.ContainsValue(p2.Code)) { //ɾ�� Services.BaseService.Delete<Substation_Info>(p2); } } foreach (substation s2 in listsubstation) { if (!hs3.ContainsValue(s2.UID) && s2.ObligateField1 != "") { //��� try { Substation_Info substation1 = new Substation_Info(); substation1.L1 = int.Parse(s2.ObligateField1); substation1.Title = s2.EleName; substation1.Code = s2.UID; substation1.Flag = sid; try { substation1.L1 = int.Parse(s2.ObligateField1); } catch { } try { substation1.L10 = double.Parse(s2.ObligateField2); } catch { } try { substation1.L2 = Convert.ToDouble(s2.Number); } catch { } try { substation1.L9 = Convert.ToDouble(s2.Burthen); } catch { } Services.BaseService.Create<Substation_Info>(substation1); //Substation_Info substation1 = new Substation_Info(); //substation1.L1 = int.Parse(s2.ObligateField1); //substation1.Title = s2.EleName; //substation1.Code = s2.UID; //substation1.Flag = sid; //Services.BaseService.Create<Substation_Info>(substation1); } catch { } } } }
private void bh_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { frmSubSelS f = new frmSubSelS(); if (getSubType(LabelTxt) == "规划") { f.ReDate(layerID, false, false, getLvl(LabelTxt)); } else { f.ReDate("", true, false, getLvl(LabelTxt)); } if (f.ShowDialog() == DialogResult.OK) { p = f.ctrlSubstation_Info1.FocusedObject; sub.EleName = p.Title; if (p.L2 == null || p.L2==0) { sub.Number = 0; } else { sub.Number = Convert.ToDecimal(p.L2); } sub.ObligateField2 = p.L1.ToString(); if (p.L9 == null || p.L9==0) { sub.Burthen = 0; } else { sub.Burthen = Convert.ToDecimal(p.L9); } bh.Text = sub.EleName; fhl.EditValue = sub.ObligateField2; Maxfh.Text = sub.Burthen.ToString("#####.##"); dl.Text = sub.Number.ToString("#####.##"); OldUID = p.Code; p.Code = sub.UID; SubUpdate = true; } }
/// <summary> /// ��Ӷ��� /// </summary> public void AddObject() { //�����������Ƿ��Ѿ����� //if (ObjectList == null) //{ // return; //} //�½����� Substation_Info obj = new Substation_Info(); obj.Flag = flags1; obj.CreateDate = DateTime.Now; //obj.L1 = 100; //obj.L2 = 100; //obj.L3 = 100; //ִ����Ӳ��� using (FrmSubstation_InfoDialog_AHTL dlg = new FrmSubstation_InfoDialog_AHTL()) { dlg.SetVisible(); dlg.Type = types1; dlg.Flag = flags1; dlg.ctrlSubstation_Info = this; dlg.ProjectID = projectid; dlg.IsCreate = true; //�����½���־ dlg.Object = obj; if (dlg.ShowDialog() != DialogResult.OK) { return; } } this.bandedGridView1.BeginUpdate(); CalcTotal(); //CalcTotal(" order by convert(int,L1) desc,AreaName desc,S4,CreateDate,convert(int,S5) "); this.bandedGridView1.EndUpdate(); //���¶�����뵽������ //ObjectList.Add(obj); ////ˢ�±���������ж�λ���¶����ϡ� //gridControl.RefreshDataSource(); //GridHelper.FocuseRow(this.bandedGridView1, obj); }
public void InitSodata() { if (ctrlPowerEachList1.FocusedObject == null) return; string sid = typeFlag2= ctrlPowerEachList1.FocusedObject.UID; Hashtable hs = new Hashtable(); Hashtable hs1 = new Hashtable(); ddd = DateTime.Now; sss += "2:" + ddd.ToString(); IList<Itop.Domain.Graphics.LineInfo> listLineInfo = Services.BaseService.GetList<Itop.Domain.Graphics.LineInfo>("SelectLineInfoByPowerID", sid); foreach (Itop.Domain.Graphics.LineInfo l1 in listLineInfo) { hs.Add(Guid.NewGuid().ToString(), l1.UID); } ddd = DateTime.Now; sss += "3:" + ddd.ToString(); IList<substation> listsubstation = Services.BaseService.GetList<substation>("SelectsubstationByPowerID2", sid); foreach (substation s1 in listsubstation) { hs.Add(Guid.NewGuid().ToString(), s1.UID); } ddd = DateTime.Now; sss += "4:" + ddd.ToString(); PSP_PowerProValues_LangFang psp_Type = new PSP_PowerProValues_LangFang(); psp_Type.Flag2 = sid; IList<PSP_PowerProValues_LangFang> listProTypes = Common.Services.BaseService.GetList<PSP_PowerProValues_LangFang>("SelectPSP_PowerProValues_LangFangByFlag2", psp_Type); foreach (PSP_PowerProValues_LangFang ps in listProTypes) { hs1.Add(Guid.NewGuid().ToString(), ps.Code); } ddd = DateTime.Now; sss += "5:" + ddd.ToString(); foreach (PSP_PowerProValues_LangFang p1 in listProTypes) { if (p1.Code != "" && !hs.ContainsValue(p1.Code) && p1.ParentID != "0") { //删除 Services.BaseService.Delete<PSP_PowerProValues_LangFang>(p1); } } ddd = DateTime.Now; sss += "6:" + ddd.ToString(); foreach (Itop.Domain.Graphics.LineInfo l2 in listLineInfo) { if (!hs1.ContainsValue(l2.UID) && l2.Voltage != "") { //添加 try { PSP_PowerProValues_LangFang ps2 = new PSP_PowerProValues_LangFang(); ps2.ParentID = l2.Voltage.ToUpper().Replace("KV", ""); ps2.L3 = l2.LineName; ps2.Code = l2.UID; ps2.Flag = 1; ps2.Flag2 = sid; ps2.L4 = l2.Voltage; ps2.L8 = double.Parse(l2.Length).ToString(); ; ps2.L9 = l2.LineType; ps2.ID = Guid.NewGuid().ToString(); Services.BaseService.Create<PSP_PowerProValues_LangFang>(ps2); } catch( Exception ex){ System.Console.WriteLine(ex.Message); } } if (hs1.ContainsValue(l2.UID) && l2.Voltage != "") { //更新 try { PSP_PowerProValues_LangFang p2 = new PSP_PowerProValues_LangFang(); p2.Code = l2.UID; p2.Flag2 = sid; PSP_PowerProValues_LangFang ps2=(PSP_PowerProValues_LangFang)Services.BaseService.GetObject("SelectPSP_PowerProValues_LangFangByselectObject", p2); ps2.ParentID = l2.Voltage.ToUpper().Replace("KV", ""); ps2.L3 = l2.LineName; ps2.Flag = 1; ps2.L4 = l2.Voltage; ps2.L8 = double.Parse(l2.Length).ToString(); ; ps2.L9 = l2.LineType; Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangByCode", ps2); } catch (Exception ex) { System.Console.WriteLine(ex.Message); } } } ddd = DateTime.Now; sss += "7:" + ddd.ToString(); //ps.Type = OBJ.L7; Project_Sum psp = new Project_Sum(); psp.S5 = "2"; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", psp); Hashtable ha = new Hashtable(); ArrayList al=new ArrayList(); foreach (substation s2 in listsubstation) { if (!hs1.ContainsValue(s2.UID) && s2.ObligateField1 != "") { ha.Clear(); al.Clear(); int kk = 0; //添加 try { Substation_Info sub = new Substation_Info(); sub.Code = s2.UID; Substation_Info station = (Substation_Info)Common.Services.BaseService.GetObject("SelectSubstation_InfoByCode", sub); PSP_PowerProValues_LangFang ps3 = new PSP_PowerProValues_LangFang(); ps3.ParentID = s2.ObligateField1; ps3.L3 = s2.EleName; ps3.Code = s2.UID; ps3.Flag = 2; ps3.Flag2 = sid; ps3.L4 = s2.ObligateField1.ToString(); if (station != null) { ps3.L5 = station.L3.ToString(); } foreach (Project_Sum ps1 in sum) { if (s2.ObligateField1.ToString() == ps1.S1.ToString()) { try { double mva = double.Parse(s2.Number.ToString()); double t5 = Convert.ToDouble(ps1.T5);//单台容量 int ta = Convert.ToInt32(ps1.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()); } ps3.L5 = ha[va].ToString(); ps3.L6 = va.ToString(); } else { ps3.L5 = ""; ps3.L6 = ""; } ps3.IsConn = double.Parse(s2.Number.ToString()).ToString();//总容量 ps3.ID = Guid.NewGuid().ToString(); Services.BaseService.Create<PSP_PowerProValues_LangFang>(ps3); } catch { } } if (hs1.ContainsValue(s2.UID) && s2.ObligateField1 != "") { ha.Clear(); al.Clear(); int kk = 0; //更新 try { Substation_Info sub = new Substation_Info(); sub.Code = s2.UID; Substation_Info station = (Substation_Info)Common.Services.BaseService.GetObject("SelectSubstation_InfoByCode", sub); PSP_PowerProValues_LangFang p3 = new PSP_PowerProValues_LangFang(); p3.Code = s2.UID; p3.Flag2 = sid; PSP_PowerProValues_LangFang ps3 = (PSP_PowerProValues_LangFang)Services.BaseService.GetObject("SelectPSP_PowerProValues_LangFangByselectObject", p3); ps3.ParentID = s2.ObligateField1; ps3.L3 = s2.EleName; ps3.Flag = 2; ps3.L4 = s2.ObligateField1.ToString(); if (station != null) { ps3.L5 = station.L3.ToString(); } foreach (Project_Sum ps1 in sum) { if (s2.ObligateField1.ToString() == ps1.S1.ToString()) { try { double mva = double.Parse(s2.Number.ToString()); double t5 = Convert.ToDouble(ps1.T5);//单台容量 int ta = Convert.ToInt32(ps1.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()); } ps3.L5 = ha[va].ToString(); ps3.L6 = va.ToString(); } else { ps3.L5 = ""; ps3.L6 = ""; } ps3.IsConn = double.Parse(s2.Number.ToString()).ToString();//总容量 Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangByCode", ps3); } catch { } } } ddd = DateTime.Now; sss += "8:" + ddd.ToString(); if (updat == "true") { LoadDatadata(); } else if (updat == "false") { UpdataLoadDatadata(); updat = "true"; } else { LoadData(); updat = "true"; } ddd = DateTime.Now; sss += "9:" + ddd.ToString(); }
private void InitSodata2() { if (ctrlLayoutList1.FocusedObject == null) return; string sid = ctrlLayoutList1.FocusedObject.UID; Hashtable hs1 = new Hashtable(); Hashtable hs3 = new Hashtable(); IList<substation> listsubstation = Services.BaseService.GetList<substation>("SelectsubstationByPowerID", sid); foreach (substation s1 in listsubstation) { hs1.Add(Guid.NewGuid().ToString(), s1.UID); } IList<Substation_Info> ll2 = Common.Services.BaseService.GetList<Substation_Info>("SelectSubstation_InfoByFlag", sid); foreach (Substation_Info ps in ll2) { hs3.Add(Guid.NewGuid().ToString(), ps.Code); } foreach (Substation_Info p2 in ll2) { if (p2.Code != "" && !hs1.ContainsValue(p2.Code)) { //ɾ�� Services.BaseService.Delete<Substation_Info>(p2); } } foreach (substation s2 in listsubstation) { if (!hs3.ContainsValue(s2.UID) && s2.ObligateField1 != "") { //��� try { Substation_Info substation1 = new Substation_Info(); substation1.L1 = int.Parse(s2.ObligateField1); substation1.Title = s2.EleName; substation1.Code = s2.UID; substation1.Flag = sid; try { substation1.L2 = double.Parse(s2.Number.ToString()); } catch { } substation1.L6 = s2.ObligateField5; substation1.AreaName = s2.ObligateField6; Services.BaseService.Create<Substation_Info>(substation1); } catch { } } } }
private void InitSodata2() { string sid = selectid; if (sid == "") return; Hashtable hs1 = new Hashtable(); Hashtable hs3 = new Hashtable(); substation suub = new substation(); suub.UID = sid; suub.EleName = leixing; IList<substation> listsubstation = Services.BaseService.GetList<substation>("SelectsubstationByPowerID1", sid); foreach (substation s1 in listsubstation) { hs1.Add(Guid.NewGuid().ToString(), s1.UID); } IList<Substation_Info> ll2 = Services.BaseService.GetList<Substation_Info>("SelectSubstation_InfoByFlag", sid); foreach (Substation_Info ps in ll2) { hs3.Add(Guid.NewGuid().ToString(), ps.Code); } foreach (Substation_Info p2 in ll2) { if (p2.Code != "" && !hs1.ContainsValue(p2.Code)) { //ɾ�� Services.BaseService.Delete<Substation_Info>(p2); } } foreach (substation s2 in listsubstation) { if (!hs3.ContainsValue(s2.UID) && s2.ObligateField1 != "") { //��� try { Substation_Info substation1 = new Substation_Info(); substation1.L1 = int.Parse(s2.ObligateField1); substation1.Title = s2.EleName; substation1.Code = s2.UID; substation1.Flag = sid; try { substation1.L1 = int.Parse(s2.ObligateField1); } catch { } try { substation1.L10 = double.Parse(s2.ObligateField2); if (substation1.L10==null&&s2.Number!=0) { substation1.L10 = Convert.ToDouble(s2.Burthen) / Convert.ToDouble(s2.Number) * 100; } } catch { } try { if (s2.Number != 0) { substation1.L2 = (double)(s2.Number); } } catch { } try { substation1.L3=Convert.ToInt32(s2.ObligateField7); } catch { } try { substation1.L9 = Convert.ToDouble(s2.Burthen); } catch { } substation1.AreaID = Itop.Client.MIS.ProgUID; Services.BaseService.Create<Substation_Info>(substation1); } catch { } } } }
/// <summary> /// �Ľ������ /// </summary> public void UpdateObject() { //��ȡ������� Substation_Info obj = FocusedObject; if (obj == null) { return; } if (obj.S4 == "no") { MessageBox.Show("���в�����!"); return; } //���������һ������ Substation_Info objCopy = new Substation_Info(); DataConverter.CopyTo<Substation_Info>(obj, objCopy); //ִ���IJ��� using (FrmSubstation_InfoDialog dlg = new FrmSubstation_InfoDialog()) { dlg.SetVisible(); dlg.IsSelect = isselect; dlg.Type = types1; dlg.Flag = flags1; dlg.ctrlSubstation_Info = this; dlg.ProjectID = projectid; dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //�ø������½������ DataConverter.CopyTo<Substation_Info>(objCopy, obj); this.bandedGridView1.BeginUpdate(); CalcTotal(); //ˢ�±�� //gridControl.RefreshDataSource(); this.bandedGridView1.EndUpdate(); }
private void simpleButton1_Click(object sender, EventArgs e) { //for (int i = 0; i < te.Length; i++) //{ // SaveCellValue(te[i].Name.Replace("Text", ""), poweruid, te[i].Text.Trim()); //} if (OBJ.L4 == "" || OBJ.L4 == null) { MsgBox.Show("电压等级为必填项!"); return; } if (OBJ.L3 == "" || OBJ.L3 == null) { MsgBox.Show("工程名称为必填项!"); return; } if (isline) { try { LineInfo li = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid); if (li != null) { li.LineName = OBJ.L3; li.Voltage = OBJ.L4; li.Length = OBJ.L8; li.LineType = OBJ.L9; Common.Services.BaseService.Update<LineInfo>(li); } } catch { } } if (isPower) { try { substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid); Substation_Info sub = new Substation_Info(); sub.Code = powerid; Substation_Info sbinfo = (Substation_Info)Common.Services.BaseService.GetObject("SelectSubstation_InfoByCode", sub); if (sbinfo != null) { sbinfo.L2 = double.Parse(OBJ.L6); sbinfo.L3 = int.Parse(OBJ.L5); Common.Services.BaseService.Update("UpdateSubstation_InfoByUID", sub); } if (sb != null) { try { sb.EleName = OBJ.L3; sb.ObligateField1 = OBJ.L4; } catch { } Common.Services.BaseService.Update<substation>(sb); } } catch { } } try { Common.Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangBy", OBJ); } catch { } this.DialogResult = DialogResult.OK; }
public void InitSodata() { if (ctrlPowerEachList1.FocusedObject == null) return; string sid = typeFlag = ctrlPowerEachList1.FocusedObject.UID; ctrlPSP_Project_List1.Flag = typeFlag; Hashtable hs = new Hashtable(); Hashtable hs1 = new Hashtable(); IList<LineInfo> listLineInfo = Services.BaseService.GetList<LineInfo>("SelectLineInfoByPowerID", sid); foreach (LineInfo l1 in listLineInfo) { hs.Add(Guid.NewGuid().ToString(), l1.UID); } IList<substation> listsubstation = Services.BaseService.GetList<substation>("SelectsubstationByPowerID2", sid); foreach (substation s1 in listsubstation) { hs.Add(Guid.NewGuid().ToString(), s1.UID); } PSP_Project_List psp_Type = new PSP_Project_List(); psp_Type.Flag2 = sid; IList<PSP_Project_List> listProTypes = Common.Services.BaseService.GetList<PSP_Project_List>("SelectPSP_Project_ListByFlag2", psp_Type); foreach (PSP_Project_List ps in listProTypes) { hs1.Add(Guid.NewGuid().ToString(), ps.Code); } foreach (PSP_Project_List p1 in listProTypes) { if (p1.Code != "" && !hs.ContainsValue(p1.Code) && p1.ParentID != "0") { //ɾ�� Services.BaseService.Delete<PSP_Project_List>(p1); } } foreach (LineInfo l2 in listLineInfo) { if (!hs1.ContainsValue(l2.UID) && l2.Voltage != "") { //��� try { PSP_Project_List ps2 = new PSP_Project_List(); ps2.ParentID = l2.Voltage.ToUpper().Replace("KV", ""); ps2.L3 = l2.LineName; ps2.Code = l2.UID; ps2.Flag = 1; ps2.Flag2 = sid; ps2.L4 = l2.Voltage; ps2.L8 = double.Parse(l2.Length).ToString(); ; ps2.L9 = l2.LineType; if (l2.ObligateField1 == "����") { ps2.L2 = "����"; } else if (l2.ObligateField1 == "�滮") { ps2.L2 = "�½�"; } ps2.L15 = l2.ObligateField3; ps2.ID = Guid.NewGuid().ToString(); Services.BaseService.Create<PSP_Project_List>(ps2); } catch (Exception ex) { System.Console.WriteLine(ex.Message); } } if (hs1.ContainsValue(l2.UID) && l2.Voltage != "") { //���� try { PSP_Project_List p2 = new PSP_Project_List(); p2.Code = l2.UID; p2.Flag2 = sid; PSP_Project_List ps2 = (PSP_Project_List)Services.BaseService.GetObject("SelectPSP_Project_ListByObject", p2); ps2.ParentID = l2.Voltage.ToUpper().Replace("KV", ""); ps2.Flag = 1; if (l2.ObligateField1 == "����") { l2.ObligateField1 = "����"; } else if (l2.ObligateField1 == "�滮") { l2.ObligateField1 = "�½�"; } if (double.Parse(l2.Length).ToString() == "" || double.Parse(l2.Length).ToString() == null) l2.Length="0"; if (ps2.L3 != l2.LineName || ps2.L4 != l2.Voltage || ps2.L8 != double.Parse(l2.Length).ToString() || ps2.L9 != l2.LineType || l2.ObligateField1 != ps2.L2 || ps2.L15 != l2.ObligateField3) { ps2.L3 = l2.LineName; ps2.L4 = l2.Voltage; ps2.L8 = double.Parse(l2.Length).ToString(); ps2.L9 = l2.LineType; if (l2.ObligateField1 == "����") { ps2.L2 = "����"; } else if (l2.ObligateField1 == "�滮") { ps2.L2 = "�½�"; } ps2.L15 = l2.ObligateField3; Services.BaseService.Update("UpdatePSP_Project_ListByCode", ps2); } } catch (Exception ex) { System.Console.WriteLine(ex.Message); } } } Project_Sum psp = new Project_Sum(); psp.S5 = "2"; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", psp); Hashtable ha = new Hashtable(); ArrayList al = new ArrayList(); foreach (substation s2 in listsubstation) { if (!hs1.ContainsValue(s2.UID) && s2.ObligateField1 != "") { ha.Clear(); al.Clear(); int kk = 0; //��� try { Substation_Info sub = new Substation_Info(); sub.Code = s2.UID; //Substation_Info station = (Substation_Info)Common.Services.BaseService.GetObject("SelectSubstation_InfoByCode", sub); PSP_Project_List ps3 = new PSP_Project_List(); ps3.ParentID = s2.ObligateField1; ps3.L3 = s2.EleName; ps3.Code = s2.UID; ps3.Flag = 2; ps3.Flag2 = sid; ps3.L4 = s2.ObligateField1.ToString(); if (s2.ObligateField3 == "����") { ps3.L2 = "����"; } else if (s2.ObligateField3 == "�滮") { ps3.L2 = "�½�"; } ps3.L15 = s2.ObligateField5; //if (station != null) //{ // ps3.L5 = station.L3.ToString(); //} foreach (Project_Sum ps1 in sum) { if (s2.ObligateField1.ToString() == ps1.S1.ToString()) { try { double mva = double.Parse(s2.Number.ToString()); double t5 = Convert.ToDouble(ps1.T5);//��̨���� int ta = Convert.ToInt32(ps1.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()); } ps3.L5 = ha[va].ToString(); ps3.L6 = va.ToString(); } else { ps3.L5 = ""; ps3.L6 = ""; } ps3.IsConn = double.Parse(s2.Number.ToString()).ToString();//������ ps3.ID = Guid.NewGuid().ToString(); Services.BaseService.Create<PSP_Project_List>(ps3); } catch { } } if (hs1.ContainsValue(s2.UID) && s2.ObligateField1 != "") { ha.Clear(); al.Clear(); int kk = 0; //���� try { Substation_Info sub = new Substation_Info(); sub.Code = s2.UID; //Substation_Info station = (Substation_Info)Common.Services.BaseService.GetObject("SelectSubstation_InfoByCode", sub); PSP_Project_List p3 = new PSP_Project_List(); p3.Code = s2.UID; p3.Flag2 = sid; PSP_Project_List ps3 = (PSP_Project_List)Services.BaseService.GetObject("SelectPSP_Project_ListByObject", p3); ps3.ParentID = s2.ObligateField1; ps3.Flag = 2; if (s2.ObligateField3 == "����") { s2.ObligateField3 = "����"; } else if (s2.ObligateField3 == "�滮") { s2.ObligateField3 = "�½�"; } string l5 = ""; string l6 = ""; foreach (Project_Sum ps1 in sum) { if (s2.ObligateField1.ToString() == ps1.S1.ToString()) { try { double mva=0; if(s2.Number.ToString()!=""&&s2.Number.ToString()!=null) mva = double.Parse(s2.Number.ToString()); double t5 = Convert.ToDouble(ps1.T5);//��̨���� int ta = Convert.ToInt32(ps1.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()); } l5 = ha[va].ToString(); l6 = va.ToString(); } else { l5 = ""; l6 = ""; } if (ps3.L3 != s2.EleName || ps3.L4 != s2.ObligateField1.ToString() || s2.ObligateField3 != ps3.L2 || ps3.L15 != s2.ObligateField5 || ps3.L5 != l5 || ps3.L6!= l6) { ps3.L3 = s2.EleName; ps3.L4 = s2.ObligateField1.ToString(); if (s2.ObligateField3 == "����") { ps3.L2 = "����"; } else if (s2.ObligateField3 == "�滮") { ps3.L2 = "�½�"; } ps3.L15 = s2.ObligateField5; //if (station != null) //{ // ps3.L5 = station.L3.ToString(); //} ps3.IsConn = double.Parse(s2.Number.ToString()).ToString();//������ Services.BaseService.Update("UpdatePSP_Project_ListByCode", ps3); } } catch { } } } }
public void CalcTotal() { int x5 = 1, x1 = 1, x2 = 1,x1z=1,x35=1; double h5 = 0, h1 = 0, h2 = 0,h1z=0,h35=0, z5 = 0, z1 = 0, z2 = 0,z1z=0,z35=0; int index5 = -1, index2 = -1, index1 = -1,index1z=-1,index35=-1; Hashtable table = new Hashtable(); bool one = true,five=true,two=true,onez=true,three=true; string area = ""; int j = 0; int now = 0; string con = "Flag='"+flags1+"' and AreaID='"+projectid+"'"; string[] que = new string[60] { "һ", "��", "��", "��", "��", "��", "��", "��", "��", "ʮ", "ʮһ","ʮ��","ʮ��","ʮ��","ʮ��","ʮ��","ʮ��","ʮ��","ʮ��","��ʮ","��ʮһ","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��", "��ʮ��","��ʮ��","��ʮ","��ʮһ","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ","��ʮһ","��ʮ��","��ʮ��","��ʮ��", "��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ","��ʮһ","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ"}; IList list = Common.Services.BaseService.GetList("SelectSubstation_InfoByCon", con); string conn = "L1=110"; // IList groupList = Common.Services.BaseService.GetList("SelectAreaNameGroupByConn", conn); IList<string> groupList = new List<string>(); for (int i = 0; i < list.Count; i++) { if (((Substation_Info)list[i]).L1 == 500) { if (five) { index5 = i; five = false; } ((Substation_Info)list[i]).S3 = x5.ToString(); h5 += ((Substation_Info)list[i]).L2; try { z5 += double.Parse(((Substation_Info)list[i]).L5); } catch { } x5++; } else if (((Substation_Info)list[i]).L1 == 220) { if (two) { index2 = i; two = false; } ((Substation_Info)list[i]).S3 = x2.ToString(); h2 += ((Substation_Info)list[i]).L2; try { z2 += double.Parse(((Substation_Info)list[i]).L5); } catch { } x2++; } else if (((Substation_Info)list[i]).L1 == 110 && ((Substation_Info)list[i]).S4 == "ר��") { if (onez) { index1z = i; onez = false; } ((Substation_Info)list[i]).S3 = x1z.ToString(); h1z += ((Substation_Info)list[i]).L2; try { z1z += double.Parse(((Substation_Info)list[i]).L5); } catch { } x1z++; } else if (((Substation_Info)list[i]).L1 == 110 && ((Substation_Info)list[i]).S4 != "ר��") { if (((Substation_Info)list[i]).AreaName != area) { table.Add(((Substation_Info)list[i]).AreaName, i); groupList.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; area = ((Substation_Info)list[i]).AreaName; } if (one) { index1 = i; one = false; } ((Substation_Info)list[i]).S3 = x1.ToString(); h1 += ((Substation_Info)list[i]).L2; try { z1 += double.Parse(((Substation_Info)list[i]).L5); } catch { } x1++; } else if (((Substation_Info)list[i]).L1 == 35) { if (three) { index35 = i; three = false; } ((Substation_Info)list[i]).S3 = x35.ToString(); h35 += ((Substation_Info)list[i]).L2; try { z35 += double.Parse(((Substation_Info)list[i]).L5); } catch { } x35++; } } if (x5 > 1) { Substation_Info info = new Substation_Info(); info.S3 = que[j]; j++; info.Title = "500ǧ��"; info.L2 = h5; info.L5 = z5.ToString(); info.L1 = 500; info.S4 = "no"; list.Insert(index5,info);//.Add(info); now++; } if (x2 > 1) { Substation_Info info2 = new Substation_Info(); info2.S3 = que[j]; j++; info2.Title = "220ǧ��"; info2.L2 = h2; info2.L5 = z2.ToString(); info2.L1 = 220; info2.S4 = "no"; list.Insert(index2+now, info2); now++; } if (x1 > 1) { Substation_Info info1 = new Substation_Info(); info1.S3 = que[j]; j++; info1.Title = "110ǧ������"; info1.L2 = h1; info1.L5 = z1.ToString(); info1.L1 = 110; info1.S4 = "no"; list.Insert(index1+now, info1); now++; for(int k=0;k<groupList.Count;k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k+65).ToString().ToLower(); infok.Title=groupList[k]; conn="L1=110 and AreaName='"+groupList[k]+"'"; IList temList=Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn",conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 110; infok.S4 = "no"; list.Insert(int.Parse(table[groupList[k]].ToString())+now, infok); now++; } } if (x1z > 1) { Substation_Info info1z = new Substation_Info(); info1z.S3 = que[j]; j++; info1z.Title = "110ǧ��ר��"; info1z.L2 = h1z; info1z.L5 = z1z.ToString(); info1z.L1 = 110; info1z.S4 = "no"; list.Insert(index1z + now, info1z); now++; } if (x35 > 1) { Substation_Info info35 = new Substation_Info(); info35.S3 = que[j]; j++; info35.Title = "35ǧ��"; info35.L2 = h35; info35.L5 = z35.ToString(); info35.L1 = 35; info35.S4 = "no"; list.Insert(index35 + now, info35); now++; } this.gridControl.DataSource = list; }
private void simpleButton1_Click(object sender, EventArgs e) { for (int i = 0; i < te.Length; i++) { SaveCellValue(te[i].Name.Replace("Text", ""), poweruid, te[i].Text.Trim()); } if (isline) { try { LineInfo li=Common.Services.BaseService.GetOneByKey<LineInfo>(powerid); if (li != null) { li.LineName = cb0.Text; li.Voltage = cb1.Text; li.Length = tt4.Text; li.LineType =cb5.Text; Common.Services.BaseService.Update<LineInfo>(li); } } catch { } } if (isPower) { try { substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid); Substation_Info sub = new Substation_Info(); sub.Code = powerid; Substation_Info sbinfo = (Substation_Info)Common.Services.BaseService.GetObject("SelectSubstation_InfoByCode", sub); if(sbinfo!=null) { sbinfo.L2 = double.Parse( cb3.Text); sbinfo.L3 =int.Parse( cb2.Text); Common.Services.BaseService.Update("UpdateSubstation_InfoByUID", sub); } if (sb != null) { try { sb.EleName = cb0.Text; sb.ObligateField1 = cb1.Text; } catch { } Common.Services.BaseService.Update<substation>(sb); } } catch { } } try { PSP_PowerProValues_LangFang ppts = new PSP_PowerProValues_LangFang(); ppts.ID = poweruid; ppts.Flag2 = flag; PSP_PowerProValues_LangFang ppt1 = Common.Services.BaseService.GetOneByKey<PSP_PowerProValues_LangFang>(ppts); try { ppt1.L3 = cb0.Text.ToString(); ppt1.L4 = cb1.Text.ToString(); ppt1.L5 = cb2.Text.ToString(); ppt1.L6 = cb3.Text.ToString(); ppt1.L7 = cb4.Text.ToString(); ppt1.L8 = tt4.Text.ToString(); ppt1.L9 = cb5.Text.ToString(); ppt1.L10 = double.Parse(tt5.Text.ToString()); ppt1.L11 =lookupedit; ppt1.L12 = double.Parse(tt6.Text.ToString()); } catch { } Common.Services.BaseService.Update<PSP_PowerProValues_LangFang>(ppt1); } catch { } this.DialogResult = DialogResult.OK; }
public void Calc(string addConn) { int x5 = 1, x1 = 1, x1z = 1, x2 = 1, x2z = 1, x35 = 1, x35z = 1, x10 = 1, x10z = 1, x6 = 1, x6z = 1, t5 = 0, t2 = 0, t2z = 0, t1 = 0, t1z = 0, t35 = 0, t35z = 0, t10 = 0, t10z = 0, t6 = 0, t6z = 0; double h5 = 0, h1 = 0, h1z = 0, h2 = 0, h2z = 0, h35 = 0, h35z = 0, h10 = 0, h10z = 0, h6 = 0, h6z = 0, z5 = 0, z1 = 0, z1z = 0, z2 = 0, z2z = 0, z35 = 0, z35z = 0, z10 = 0, z10z = 0, z6 = 0, z6z = 0; ; int index5 = -1, index2 = -1, index2z = -1, index1 = -1, index1z = -1, index35 = -1, index35z = -1, index10 = -1, index10z = -1, index6 = -1, index6z = -1; Hashtable table = new Hashtable(); Hashtable table_500 = new Hashtable(); Hashtable table_220 = new Hashtable(); Hashtable table_220z = new Hashtable(); Hashtable table_35 = new Hashtable(); Hashtable table_35z = new Hashtable(); Hashtable table_10 = new Hashtable(); Hashtable table_10z = new Hashtable(); Hashtable table_6 = new Hashtable(); Hashtable table_6z = new Hashtable(); IList<string> groupList_500 = new List<string>(); IList<string> groupList_220 = new List<string>(); IList<string> groupList_220z = new List<string>(); IList<string> groupList_35 = new List<string>(); IList<string> groupList_35z = new List<string>(); IList<string> groupList_10 = new List<string>(); IList<string> groupList_10z = new List<string>(); IList<string> groupList_6 = new List<string>(); IList<string> groupList_6z = new List<string>(); bool five = true, one = true, onez = true, two = true, twoz = true, three = true, threez = true, ten = true, tenz = true, six = true, sixz = true; string area = "1@3$5q99z99"; string area_500 = "1@3$5q99z99"; string area_220 = "1@3$5q99z99"; string area_220z = "1@3$5q99z99"; string area_35 = "1@3$5q99z99"; string area_35z = "1@3$5q99z99"; string area_10 = "1@3$5q99z99"; string area_10z = "1@3$5q99z99"; string area_6 = "1@3$5q99z99"; string area_6z = "1@3$5q99z99"; int j = 0; int now = 0; string con = "AreaID='" + projectid + "'";// +" and Flag='" + Ghflag + "'"; // con += addConn; con += " order by convert(int,L1) desc,S4,AreaName,CreateDate,convert(int,S5)"; string[] que = new string[60] { "һ", "��", "��", "��", "��", "��", "��", "��", "��", "ʮ", "ʮһ","ʮ��","ʮ��","ʮ��","ʮ��","ʮ��","ʮ��","ʮ��","ʮ��","��ʮ","��ʮһ","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��", "��ʮ��","��ʮ��","��ʮ","��ʮһ","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ","��ʮһ","��ʮ��","��ʮ��","��ʮ��", "��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ","��ʮһ","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ��","��ʮ"}; titlestr = que; //IList list = Common.Services.BaseService.GetList("SelectSubstation_InfoByCon", con); IList list = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", con); if (!string.IsNullOrEmpty(addConn)) { List<Substation_Info> listremove = new List<Substation_Info>(); for (int i = 0; i < list.Count;i++ ) { if (((Substation_Info)list[i]).S2.Length!=4) { listremove.Add((Substation_Info)list[i]); } else { if (Convert.ToDouble(((Substation_Info)list[i]).S2)>Convert.ToDouble(addConn)) { listremove.Add((Substation_Info)list[i]); } } } for (int i = 0; i < listremove.Count;i++ ) { list.Remove(listremove[i]); } for (int i = 0; i < list.Count;i++ ) { double rl=0; int bts=0; string where = "where projectid='" + Itop.Client.MIS.ProgUID + "'and type in ('02','03')and SvgUID='" + ((Substation_Info)list[i]).UID + "'"; IList<PSPDEV> list1 = Services.BaseService.GetList<PSPDEV>("SelectPSPDEVByCondition", where); string rlgc = ""; foreach (PSPDEV pd in list1) { if (!string.IsNullOrEmpty(pd.OperationYear) && Convert.ToInt32(pd.OperationYear) <= Convert.ToDouble(addConn)) { if (!string.IsNullOrEmpty(pd.Date2) && pd.Date2.Length == 4 && !string.IsNullOrEmpty(((Substation_Info)list[i]).L29) && !string.IsNullOrEmpty(((Substation_Info)list[i]).L28)) { if (Convert.ToInt32(pd.OperationYear) >= Convert.ToInt32(((Substation_Info)list[i]).L28) && Convert.ToInt32(pd.Date2) <= Convert.ToInt32(((Substation_Info)list[i]).L29)) { if (pd.Type == "03") { rl += pd.SiN; rlgc += pd.SiN.ToString()+"+"; } else { rl += (double)pd.Burthen; rlgc += pd.Burthen.ToString()+"+"; } bts++; } } else { if (pd.Type == "03") { rlgc += pd.SiN.ToString() + "+"; } else { rl += (double)pd.Burthen; rlgc += pd.Burthen.ToString() + "+"; } bts++; } } } if (rlgc.Length>0) { rlgc = rlgc.Substring(0, rlgc.Length - 1); } ((Substation_Info)list[i]).L2 = rl; ((Substation_Info)list[i]).L3 = bts; ((Substation_Info)list[i]).L4 = rlgc; } } string conn = "L1=110"; // IList groupList = Common.Services.BaseService.GetList("SelectAreaNameGroupByConn", conn); IList<string> groupList = new List<string>(); Hashtable table2 = new Hashtable(); IList<string> groupList2 = new List<string>(); string area2 = "1@3$5q99z99"; for (int i = 0; i < list.Count; i++) { if (((Substation_Info)list[i]).L1 == 500 ) { if (((Substation_Info)list[i]).AreaName != area_500) { if (!table_500.Contains(((Substation_Info)list[i]).AreaName)) { table_500.Add(((Substation_Info)list[i]).AreaName, i); groupList_500.Add(((Substation_Info)list[i]).AreaName); } area_500 = ((Substation_Info)list[i]).AreaName; } if (five) { index5 = i; five = false; } ((Substation_Info)list[i]).S3 = x5.ToString(); h5 += ((Substation_Info)list[i]).L2; try { z5 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t5 += (int)((Substation_Info)list[i]).L3; } catch { } x5++; } else if (((Substation_Info)list[i]).L1 == 220 && ((Substation_Info)list[i]).S4 == "ר��") { if (((Substation_Info)list[i]).AreaName != area_220z) { if (!table_220z.Contains(((Substation_Info)list[i]).AreaName)) { table_220z.Add(((Substation_Info)list[i]).AreaName, i); groupList_220z.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; } area_220z = ((Substation_Info)list[i]).AreaName; } if (twoz) { index2z = i; twoz = false; } ((Substation_Info)list[i]).S3 = x2z.ToString(); h2z += ((Substation_Info)list[i]).L2; try { z2z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t2z += (int)((Substation_Info)list[i]).L3; } catch { } x2z++; } else if (((Substation_Info)list[i]).L1 == 220 && ((Substation_Info)list[i]).S4 != "ר��") { if (((Substation_Info)list[i]).AreaName != area_220) { if (!table_220.Contains(((Substation_Info)list[i]).AreaName)) { table_220.Add(((Substation_Info)list[i]).AreaName, i); groupList_220.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; } area_220 = ((Substation_Info)list[i]).AreaName; } if (two) { index2 = i; two = false; } ((Substation_Info)list[i]).S3 = x2.ToString(); h2 += ((Substation_Info)list[i]).L2; try { z2 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t2 += (int)((Substation_Info)list[i]).L3; } catch { } x2++; } else if (((Substation_Info)list[i]).L1 == 110 && ((Substation_Info)list[i]).S4 == "ר��") { if (((Substation_Info)list[i]).AreaName != area2) { if (!table2.Contains(((Substation_Info)list[i]).AreaName)) { table2.Add(((Substation_Info)list[i]).AreaName, i); groupList2.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; } area2 = ((Substation_Info)list[i]).AreaName; } if (onez) { index1z = i; onez = false; } ((Substation_Info)list[i]).S3 = x1z.ToString(); h1z += ((Substation_Info)list[i]).L2; try { z1z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t1z += (int)((Substation_Info)list[i]).L3; } catch { } x1z++; } else if (((Substation_Info)list[i]).L1 == 110 && ((Substation_Info)list[i]).S4 != "ר��") { if (((Substation_Info)list[i]).AreaName != area) { if (!table.Contains(((Substation_Info)list[i]).AreaName)) { table.Add(((Substation_Info)list[i]).AreaName, i); groupList.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; } area = ((Substation_Info)list[i]).AreaName; } if (one) { index1 = i; one = false; } ((Substation_Info)list[i]).S3 = x1.ToString(); h1 += ((Substation_Info)list[i]).L2; try { z1 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t1 += (int)((Substation_Info)list[i]).L3; } catch { } x1++; } else if (((Substation_Info)list[i]).L1 == 35 && ((Substation_Info)list[i]).S4 == "ר��") { if (((Substation_Info)list[i]).AreaName != area_35z) { if (!table_35z.Contains(((Substation_Info)list[i]).AreaName)) { table_35z.Add(((Substation_Info)list[i]).AreaName, i); groupList_35z.Add(((Substation_Info)list[i]).AreaName); } area_35z = ((Substation_Info)list[i]).AreaName; } if (threez) { index35z = i; threez = false; } ((Substation_Info)list[i]).S3 = x35z.ToString(); h35z += ((Substation_Info)list[i]).L2; try { z35z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t35z += (int)((Substation_Info)list[i]).L3; } catch { } x35z++; } else if (((Substation_Info)list[i]).L1 == 35 && ((Substation_Info)list[i]).S4 != "ר��") { if (((Substation_Info)list[i]).AreaName != area_35) { if (!table_35.Contains(((Substation_Info)list[i]).AreaName)) { table_35.Add(((Substation_Info)list[i]).AreaName, i); groupList_35.Add(((Substation_Info)list[i]).AreaName); } area_35 = ((Substation_Info)list[i]).AreaName; } if (three) { index35 = i; three = false; } ((Substation_Info)list[i]).S3 = x35.ToString(); h35 += ((Substation_Info)list[i]).L2; try { z35 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t35 += (int)((Substation_Info)list[i]).L3; } catch { } x35++; } else if (((Substation_Info)list[i]).L1 == 10 && ((Substation_Info)list[i]).S4 == "ר��") { if (((Substation_Info)list[i]).AreaName != area_10z) { if (!table_10z.Contains(((Substation_Info)list[i]).AreaName)) { table_10z.Add(((Substation_Info)list[i]).AreaName, i); groupList_10z.Add(((Substation_Info)list[i]).AreaName); } area_10z = ((Substation_Info)list[i]).AreaName; } if (tenz) { index10z = i; tenz = false; } ((Substation_Info)list[i]).S3 = x10z.ToString(); h10z += ((Substation_Info)list[i]).L2; try { z10z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t10z += (int)((Substation_Info)list[i]).L3; } catch { } x10z++; } else if (((Substation_Info)list[i]).L1 == 10 && ((Substation_Info)list[i]).S4 != "ר��") { if (((Substation_Info)list[i]).AreaName != area_10) { if (!table_10.Contains(((Substation_Info)list[i]).AreaName)) { table_10.Add(((Substation_Info)list[i]).AreaName, i); groupList_10.Add(((Substation_Info)list[i]).AreaName); } area_10 = ((Substation_Info)list[i]).AreaName; } if (ten) { index10 = i; ten = false; } ((Substation_Info)list[i]).S3 = x10.ToString(); h10 += ((Substation_Info)list[i]).L2; try { z10 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t10 += (int)((Substation_Info)list[i]).L3; } catch { } x10++; } else if (((Substation_Info)list[i]).L1 == 6 && ((Substation_Info)list[i]).S4 == "ר��") { if (((Substation_Info)list[i]).AreaName != area_6z) { if (!table_6z.Contains(((Substation_Info)list[i]).AreaName)) { table_6z.Add(((Substation_Info)list[i]).AreaName, i); groupList_6z.Add(((Substation_Info)list[i]).AreaName); } area_6z = ((Substation_Info)list[i]).AreaName; } if (sixz) { index6z = i; sixz = false; } ((Substation_Info)list[i]).S3 = x6z.ToString(); h6z += ((Substation_Info)list[i]).L2; try { z6z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t6z += (int)((Substation_Info)list[i]).L3; } catch { } x6z++; } else if (((Substation_Info)list[i]).L1 == 6 && ((Substation_Info)list[i]).S4 != "ר��") { if (((Substation_Info)list[i]).AreaName != area_6) { if (!table_6.Contains(((Substation_Info)list[i]).AreaName)) { table_6.Add(((Substation_Info)list[i]).AreaName, i); groupList_6.Add(((Substation_Info)list[i]).AreaName); } area_6 = ((Substation_Info)list[i]).AreaName; } if (six) { index6 = i; six = false; } ((Substation_Info)list[i]).S3 = x6.ToString(); h6 += ((Substation_Info)list[i]).L2; try { z6 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t6 += (int)((Substation_Info)list[i]).L3; } catch { } x6++; } } if (x5 > 1) { Substation_Info info = new Substation_Info(); info.S3 = que[j]; j++; info.Title = "500ǧ��"; info.L2 = h5; info.L5 = z5.ToString(); info.L3 = t5; info.L1 = 500; info.S4 = "no"; list.Insert(index5, info);//.Add(info); now++; for (int k = 0; k < groupList_500.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_500[k]; conn = "L1=500 and AreaID='" + projectid + "' and AreaName='" + groupList_500[k] + "'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 500; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_500[groupList_500[k]].ToString()) + now, infok); now++; } } if (x2 > 1) { Substation_Info info2 = new Substation_Info(); info2.S3 = que[j]; j++; info2.Title = "220ǧ������"; info2.L2 = h2; info2.L5 = z2.ToString(); info2.L3 = t2; info2.L1 = 220; info2.S4 = "no"; list.Insert(index2 + now, info2); now++; for (int k = 0; k < groupList_220.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_220[k]; conn = "L1=220 and AreaID='" + projectid + "' and AreaName='" + groupList_220[k] + "' and S4!='ר��'" ; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 220; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_220[groupList_220[k]].ToString()) + now, infok); now++; } } if (x2z > 1) { Substation_Info info2z = new Substation_Info(); info2z.S3 = que[j]; j++; info2z.Title = "220ǧ��ר��"; info2z.L2 = h2z; info2z.L5 = z2z.ToString(); info2z.L3 = t2z; info2z.L1 = 220; info2z.S4 = "no"; list.Insert(index2z + now, info2z); now++; for (int k = 0; k < groupList_220z.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList_220z[k]; conn = "L1=220 and AreaID='" + projectid + "' and AreaName='" + groupList_220z[k] + "' and S4='ר��'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 220; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_220z[groupList_220z[k]].ToString()) + now, infok); now++; } } if (x1 > 1) { Substation_Info info1 = new Substation_Info(); info1.S3 = que[j]; j++; info1.Title = "110ǧ������"; info1.L2 = h1; info1.L5 = z1.ToString(); info1.L3= t1; info1.L1 = 110; info1.S4 = "no"; list.Insert(index1 + now, info1); now++; for (int k = 0; k < groupList.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList[k]; conn = "L1=110 and AreaID='" + projectid + "' and AreaName='" + groupList[k] + "' and S4!='ר��'" ; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 110; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table[groupList[k]].ToString()) + now, infok); now++; } } if (x1z > 1) { Substation_Info info1z = new Substation_Info(); info1z.S3 = que[j]; j++; info1z.Title = "110ǧ��ר��"; info1z.L2 = h1z; info1z.L5 = z1z.ToString(); info1z.L3 = t1z; info1z.L1 = 110; info1z.S4 = "no"; list.Insert(index1z + now, info1z); now++; for (int k = 0; k < groupList2.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList2[k]; conn = "L1=110 and AreaID='" + projectid + "' and AreaName='" + groupList2[k] + "' and S4='ר��'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 110; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table2[groupList2[k]].ToString()) + now, infok); now++; } } if (x35 > 1) { Substation_Info info35 = new Substation_Info(); info35.S3 = que[j]; j++; info35.Title = "35ǧ������"; info35.L2 = h35; info35.L5 = z35.ToString(); info35.L3 = t35; info35.L1 = 35; info35.S4 = "no"; list.Insert(index35 + now, info35); now++; for (int k = 0; k < groupList_35.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_35[k]; conn = "L1=35 and AreaID='" + projectid + "' and AreaName='" + groupList_35[k] + "' and S4!='ר��' "; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 35; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_35[groupList_35[k]].ToString()) + now, infok); now++; } } if (x35z > 1) { Substation_Info info35z = new Substation_Info(); info35z.S3 = que[j]; j++; info35z.Title = "35ǧ��ר��"; info35z.L2 = h35z; info35z.L5 = z35z.ToString(); info35z.L3 = t35z; info35z.L1 = 35; info35z.S4 = "no"; list.Insert(index35z + now, info35z); now++; for (int k = 0; k < groupList_35z.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList_35z[k]; conn = "L1=35 and AreaID='" + projectid + "' and AreaName='" + groupList_35z[k] + "' and S4='ר��'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 35; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_35z[groupList_35z[k]].ToString()) + now, infok); now++; } } if (x10 > 1) { Substation_Info info10 = new Substation_Info(); info10.S3 = que[j]; j++; info10.Title = "10ǧ������"; info10.L2 = h10; info10.L5 = z10.ToString(); info10.L3 = t10; info10.L1 = 10; info10.S4 = "no"; list.Insert(index10 + now, info10); now++; for (int k = 0; k < groupList_10.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_10[k]; conn = "L1=10 and AreaID='" + projectid + "' and AreaName='" + groupList_10[k] + "' and S4!='ר��'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 10; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_10[groupList_10[k]].ToString()) + now, infok); now++; } } if (x10z > 1) { Substation_Info info10z = new Substation_Info(); info10z.S3 = que[j]; j++; info10z.Title = "10ǧ��ר��"; info10z.L2 = h10z; info10z.L5 = z10z.ToString(); info10z.L3 = t10z; info10z.L1 = 10; info10z.S4 = "no"; list.Insert(index10z + now, info10z); now++; for (int k = 0; k < groupList_10z.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList_10z[k]; conn = "L1=10 and AreaID='" + projectid + "' and AreaName='" + groupList_10z[k] + "' and S4='ר��'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 10; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_10z[groupList_10z[k]].ToString()) + now, infok); now++; } } if (x6 > 1) { Substation_Info info6 = new Substation_Info(); info6.S3 = que[j]; j++; info6.Title = "6ǧ������"; info6.L2 = h6; info6.L5 = z6.ToString(); info6.L3 = t6; info6.L1 = 6; info6.S4 = "no"; list.Insert(index6 + now, info6); now++; for (int k = 0; k < groupList_6.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_6[k]; conn = "L1=6 and AreaID='" + projectid + "' and AreaName='" + groupList_6[k] + "' and S4!='ר��'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 6; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_6[groupList_6[k]].ToString()) + now, infok); now++; } } if (x6z > 1) { Substation_Info info6z = new Substation_Info(); info6z.S3 = que[j]; j++; info6z.Title = "6ǧ��ר��"; info6z.L2 = h6z; info6z.L5 = z6z.ToString(); info6z.L3 = t6z; info6z.L1 = 6; info6z.S4 = "no"; list.Insert(index6z + now, info6z); now++; for (int k = 0; k < groupList_6z.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList_6z[k]; conn = "L1=6 and AreaID='" + projectid + "' and AreaName='" + groupList_6z[k] + "' and S4='ר��'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 6; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_6z[groupList_6z[k]].ToString()) + now, infok); now++; } } try { for (int i = 0; i < list.Count; i++) { if (((Substation_Info)list[i]).L9 != null && (double)((Substation_Info)list[i]).L2 != null) { double templ9 = (double)((Substation_Info)list[i]).L9; double templ2 = (double)((Substation_Info)list[i]).L2; ((Substation_Info)list[i]).L10 = (templ2 == 0 ? 0 : templ9 / templ2) * 100; Substation_Info tempsub = Common.Services.BaseService.GetOneByKey<Substation_Info>(((Substation_Info)list[i]).UID); tempsub.L10 = ((Substation_Info)list[i]).L10; Common.Services.BaseService.Update<Substation_Info>(tempsub); } } } catch (Exception ew) { MessageBox.Show("���㸺���ʳ���" + ew.Message); } this.gridControl.DataSource = list; fu_list = list; list_copy(list, fu_list_no); att_list(fu_list_no); }
public bool RefreshDataOut(string addConn) { try { string filepath = ""; string con = "AreaID='" + projectid + "'"; con += addConn; IList<Substation_Info> list = Services.BaseService.GetList<Substation_Info>("SelectSubstation_InfoByCon", con); if (xmlflag == "guihua") filepath = Path.GetTempPath() + "\\" + Path.GetFileName("SubstationGuiHua.xml"); else { filepath = Path.GetTempPath() + "\\" + Path.GetFileName("SubstationLayOut11.xml"); } if (File.Exists(filepath)) { this.bandedGridView1.RestoreLayoutFromXml(filepath); } Substation_Info info = new Substation_Info(); info.Title = "�ϼ�"; info.L9 = 0.0; info.L3 = 0; for (int i = 0; i < list.Count; i++) { info.L5 = Convert.ToString(double.Parse(info.L5 == "" ? "0" : info.L5) + double.Parse((list[i] as Substation_Info).L5 == "" ? "0" : (list[i] as Substation_Info).L5)); info.L6 = Convert.ToString(double.Parse(info.L6 == "" ? "0" : info.L6) + double.Parse((list[i] as Substation_Info).L6 == "" ? "0" : (list[i] as Substation_Info).L6)); info.L3 += ((list[i] as Substation_Info).L3 == null ? 0 : (list[i] as Substation_Info).L3); info.L2 += (list[i] as Substation_Info).L2; info.L9 += (list[i] as Substation_Info).L9; info.L14 = Convert.ToString(double.Parse(info.L14 == "" ? "0" : info.L14) + double.Parse((list[i] as Substation_Info).L14 == "" ? "0" : (list[i] as Substation_Info).L14)); info.L13 = Convert.ToString(double.Parse(info.L13 == "" ? "0" : info.L13) + double.Parse((list[i] as Substation_Info).L13 == "" ? "0" : (list[i] as Substation_Info).L13)); info.S9 = Convert.ToString(double.Parse(info.S9 == "" ? "0" : info.S9) + double.Parse((list[i] as Substation_Info).S9 == "" ? "0" : (list[i] as Substation_Info).S9)); info.S10 = Convert.ToString(double.Parse(info.S10 == "" ? "0" : info.S10) + double.Parse((list[i] as Substation_Info).S10 == "" ? "0" : (list[i] as Substation_Info).S10)); } info.L10 = (info.L2 == 0 ? 0 : info.L9 / info.L2)*100; info.S6 = Convert.ToString(double.Parse(info.L13) == 0.0 ? 0 : double.Parse(info.L14 == "" ? "0" : info.L14)*100 / double.Parse(info.L13)); list.Add(info); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return false; } return true; }
private void InsertSubstation_Info() { //LayoutList ll1 = this.ctrlLayoutList1.FocusedObject; //if (ll1 == null) // return; string columnname = ""; try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel�ļ�(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); string str = ""; IList<Substation_Info> lii = new List<Substation_Info>(); DateTime s8 = DateTime.Now; int x=0; str = ""; for (int i = 0; i < dts.Rows.Count; i++) { if (dts.Rows[i][1].ToString().IndexOf("�ϼ�") >= 0) continue; if (dts.Rows[i]["Title"].ToString() == "500ǧ��" || dts.Rows[i]["Title"].ToString() == "220ǧ��" || dts.Rows[i]["Title"].ToString() == "110ǧ������" || dts.Rows[i]["Title"].ToString() == "110ǧ��ר��") { if (dts.Rows[i]["Title"].ToString() == "110ǧ��ר��") { str = "ר��"; } else if (dts.Rows[i]["Title"].ToString() == "110ǧ������") str = "����"; else str = ""; //continue; } try { int.Parse(dts.Rows[i]["S3"].ToString()); } catch { continue; } Substation_Info l1 = new Substation_Info(); foreach (DataColumn dc in dts.Columns) { columnname = dc.ColumnName; if (dts.Rows[i][dc.ColumnName].ToString() == "" ) continue; switch (dc.ColumnName) { case "L2": case "L9": double LL2 = 0; try { LL2 = Convert.ToDouble(dts.Rows[i][dc.ColumnName].ToString()); } catch { } l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, LL2, null); break; case "L10": double L10 = 0; try { L10 = ChangeDou(dts.Rows[i][dc.ColumnName].ToString()); } catch { } l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, L10, null); break; case "L1": case "L3": int LL3 = 0; try { LL3 = Convert.ToInt32(dts.Rows[i][dc.ColumnName].ToString()); } catch { } l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, LL3, null); break; default: l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, dts.Rows[i][dc.ColumnName].ToString(), null); break; } } l1.S4 = str; l1.Flag = selectid; l1.CreateDate = s8.AddSeconds(i); l1.AreaID = ProjectUID; lii.Add(l1); } foreach (Substation_Info lll in lii) { Substation_Info l1 = new Substation_Info(); //l1.UID += "|" + ProjectUID; l1.AreaName = lll.AreaName; l1.Title = lll.Title; l1.AreaID = ProjectUID; l1.Flag = selectid; try { int tx = int.Parse(l1.S2); if (tx > DateTime.Now.Year) l1.Flag = "2"; else l1.Flag = "1"; } catch { l1.Flag = "1"; } string con = "AreaID='" + ProjectUID + "' and Title='" + l1.Title + "' and Flag='" + selectid + "'"; object obj = Services.BaseService.GetObject("SelectSubstation_InfoByCon", con); ExpressionCalculator ca = new ExpressionCalculator(); if (lll.L4 != "") { if (ca.ISIllegal(ca.CharConverter(lll.L4))) { lll.L2 = ca.Calculator(ca.CharConverter(lll.L4), 2); } } if (obj != null) { lll.UID = ((Substation_Info)obj).UID; Services.BaseService.Update<Substation_Info>(lll); } else { lll.UID += "|" + ProjectUID; Services.BaseService.Create<Substation_Info>(lll); } } this.ctrlSubstation_Info1.CalcTotal(); } } catch (Exception ex) { MsgBox.Show(columnname + ex.Message); MsgBox.Show("�����ʽ����ȷ��"); } }
/// <summary> /// ��Ӷ��� /// </summary> public void AddObject() { //�����������Ƿ��Ѿ����� if (ObjectList == null) { return; } //�½����� Substation_Info obj = new Substation_Info(); obj.Flag = flags1; obj.CreateDate = DateTime.Now; //obj.L1 = 100; //obj.L2 = 100; //obj.L3 = 100; //ִ����Ӳ��� using (FrmSubstation_InfoDialog dlg = new FrmSubstation_InfoDialog()) { dlg.Type = types1; dlg.Flag = flags1; dlg.ctrlSubstation_Info = this; dlg.ProjectID = projectid; dlg.IsCreate = true; //�����½���־ dlg.Object = obj; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //���¶�����뵽������ ObjectList.Add(obj); //ˢ�±���������ж�λ���¶����ϡ� gridControl.RefreshDataSource(); GridHelper.FocuseRow(this.bandedGridView1, obj); }
private void btnOK_Click(object sender, EventArgs e) { if (isselect) { DialogResult = DialogResult.OK; return; } if (!InputCheck()) { return; } if (SaveRecord()) { if (checkEdit1.Checked) { ctrls.RefreshData(); _obj = new Substation_Info(); _obj.Flag = flags1; IList<Substation_Info> list1 = new List<Substation_Info>(); list1.Add(_obj); this.vGridControl.DataSource = list1; } else { DialogResult = DialogResult.OK; } } }
public bool RefreshData(string layer, bool isrun, string power) { IList<Substation_Info> lists = new List<Substation_Info>(); try { Substation_Info ll1 = new Substation_Info(); ll1.AreaID = layer; ll1.L1 = int.Parse(power); if (isrun) { lists = UCDeviceBase.DataService.GetList<Substation_Info>("SelectSubstation_InfoByXZ", ll1); } else { lists = UCDeviceBase.DataService.GetList<Substation_Info>("SelectSubstation_InfoByGH", ll1); } this.gridControl.DataSource = lists; bandedGridView1.OptionsView.ColumnAutoWidth = true; foreach (GridColumn gc in this.bandedGridView1.Columns) { gc.Visible = false; gc.OptionsColumn.ShowInCustomizationForm = false; if (gc.FieldName == "Title" || gc.FieldName == "L9" || gc.FieldName == "L2" || gc.FieldName == "L1" || gc.FieldName == "L10") { gc.Visible = true; gc.OptionsColumn.ShowInCustomizationForm = true; } //if (gc.FieldName.Substring(0, 1) == "S") //{ // gc.Visible = false; // gc.OptionsColumn.ShowInCustomizationForm = false; //} } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return false; } return true; }
private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { GridColumn gc = this.ctrlSubstation_Info1.GridView.FocusedColumn; if (gc == null) return; if (gc.FieldName.Substring(0, 1) != "S") { MsgBox.Show("����ɾ���̶���"); return; } if (MsgBox.ShowYesNo("�Ƿ�ɾ�� " + gc.Caption + " ���������ݣ�") != DialogResult.Yes) { return; } foreach (GridBand gc1 in ctrlSubstation_Info1.GridView.Bands) { try { if (gc1.Columns[0].Name == gc.Name) { gc1.Visible = false; } } catch { } } gc.Visible = false; gc.OptionsColumn.ShowInCustomizationForm = false; Substation_Info si = new Substation_Info(); si.Title = gc.FieldName + "=''"; si.Flag = flag; Itop.Client.Common.Services.BaseService.Update("UpdateSubstation_InfoByFlag", si); PowerSubstationLine psl = new PowerSubstationLine(); psl.ClassType = gc.FieldName; psl.Flag = flag; psl.Type = type; psl.Title = gc.Caption; psl.Type2 = "SubstationGuiHua"; Itop.Client.Common.Services.BaseService.Update("DeletePowerSubstationLineByAll", psl); }
/// <summary> /// �Ľ������ /// </summary> public void UpdateObject() { //��ȡ������� Substation_Info obj = FocusedObject; if (obj == null) { return; } //���������һ������ Substation_Info objCopy = new Substation_Info(); DataConverter.CopyTo<Substation_Info>(obj, objCopy); //ִ���IJ��� using (FrmSubstation_InfoDialog dlg = new FrmSubstation_InfoDialog()) { dlg.IsSelect = isselect; dlg.Type = types1; dlg.Flag = flags1; dlg.ctrlSubstation_Info = this; dlg.ProjectID = projectid; dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //�ø������½������ DataConverter.CopyTo<Substation_Info>(objCopy, obj); //ˢ�±�� gridControl.RefreshDataSource(); }
private void InsertSubstation_Info() { LayoutList ll1 = this.ctrlLayoutList1.FocusedObject; if (ll1 == null) return; string columnname = ""; try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel�ļ�(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); IList<Substation_Info> lii = new List<Substation_Info>(); DateTime s8 = DateTime.Now; for (int i = 1; i < dts.Rows.Count; i++) { if (dts.Rows[i][1].ToString().IndexOf("�ϼ�") >= 0) continue; Substation_Info l1 = new Substation_Info(); foreach (DataColumn dc in dts.Columns) { columnname = dc.ColumnName; if (dts.Rows[i][dc.ColumnName].ToString() == "") continue; switch (dc.ColumnName) { case "L2": case "L9": case "L10": double LL2 = 0; try { LL2 = Convert.ToDouble(dts.Rows[i][dc.ColumnName].ToString()); } catch { } l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, LL2, null); break; case "L1": case "L3": int LL3 = 0; try { LL3 = Convert.ToInt32(dts.Rows[i][dc.ColumnName].ToString()); } catch { } l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, LL3, null); break; default: l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, dts.Rows[i][dc.ColumnName].ToString(), null); break; } } l1.Flag = ll1.UID; l1.CreateDate = s8.AddSeconds(i); lii.Add(l1); } foreach (Substation_Info lll in lii) { Substation_Info l1 = new Substation_Info(); l1.AreaName = lll.AreaName; l1.Title = lll.Title; l1.Flag = ll1.UID; object obj = Services.BaseService.GetObject("SelectSubstation_InfoByNameFlag", l1); if (obj != null) { lll.UID = ((Substation_Info)obj).UID; Services.BaseService.Update<Substation_Info>(lll); } else { Services.BaseService.Create<Substation_Info>(lll); } } this.ctrlSubstation_Info1.RefreshData(); } } catch (Exception ex) { MsgBox.Show(columnname + ex.Message); MsgBox.Show("�����ʽ����ȷ��"); } }
public System.Data.DataTable Calc(string addConn) { int x5 = 1, x1 = 1, x1z = 1, x2 = 1, x2z = 1, x35 = 1, x35z = 1, x10 = 1, x10z = 1, x6 = 1, x6z = 1, t5 = 0, t2 = 0, t2z = 0, t1 = 0, t1z = 0, t35 = 0, t35z = 0, t10 = 0, t10z = 0, t6 = 0, t6z = 0; double h5 = 0, h1 = 0, h1z = 0, h2 = 0, h2z = 0, h35 = 0, h35z = 0, h10 = 0, h10z = 0, h6 = 0, h6z = 0, z5 = 0, z1 = 0, z1z = 0, z2 = 0, z2z = 0, z35 = 0, z35z = 0, z10 = 0, z10z = 0, z6 = 0, z6z = 0; ; int index5 = -1, index2 = -1, index2z = -1, index1 = -1, index1z = -1, index35 = -1, index35z = -1, index10 = -1, index10z = -1, index6 = -1, index6z = -1; Hashtable table = new Hashtable(); Hashtable table_500 = new Hashtable(); Hashtable table_220 = new Hashtable(); Hashtable table_220z = new Hashtable(); Hashtable table_35 = new Hashtable(); Hashtable table_35z = new Hashtable(); Hashtable table_10 = new Hashtable(); Hashtable table_10z = new Hashtable(); Hashtable table_6 = new Hashtable(); Hashtable table_6z = new Hashtable(); IList<string> groupList_500 = new List<string>(); IList<string> groupList_220 = new List<string>(); IList<string> groupList_220z = new List<string>(); IList<string> groupList_35 = new List<string>(); IList<string> groupList_35z = new List<string>(); IList<string> groupList_10 = new List<string>(); IList<string> groupList_10z = new List<string>(); IList<string> groupList_6 = new List<string>(); IList<string> groupList_6z = new List<string>(); bool five = true, one = true, onez = true, two = true, twoz = true, three = true, threez = true, ten = true, tenz = true, six = true, sixz = true; string area = "1@3$5q99z99"; string area_500 = "1@3$5q99z99"; string area_220 = "1@3$5q99z99"; string area_220z = "1@3$5q99z99"; string area_35 = "1@3$5q99z99"; string area_35z = "1@3$5q99z99"; string area_10 = "1@3$5q99z99"; string area_10z = "1@3$5q99z99"; string area_6 = "1@3$5q99z99"; string area_6z = "1@3$5q99z99"; int j = 0; int now = 0; string con = "AreaID='" + projectid + "'" + " and Flag='" + Ghflag + "'"; con += addConn; con += " order by convert(int,L1) desc,S4,AreaName,CreateDate,convert(int,S5)"; string[] que = new string[60] { "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","二十一","二十二","二十三","二十四","二十五","二十六","二十七", "二十八","二十九","三十","三十一","三十二","三十三","三十四","三十五","三十六","三十七","三十八","三十九","四十","四十一","四十二","四十三","四十四", "四十五","四十六","四十七","四十八","四十九","五十","五十一","五十二","五十三","五十四","五十五","五十六","五十七","五十八","五十九","六十"}; titlestr = que; //IList list = Common.Services.BaseService.GetList("SelectSubstation_InfoByCon", con); IList list = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", con); string conn = "L1=110"; // IList groupList = Common.Services.BaseService.GetList("SelectAreaNameGroupByConn", conn); IList<string> groupList = new List<string>(); Hashtable table2 = new Hashtable(); IList<string> groupList2 = new List<string>(); string area2 = "1@3$5q99z99"; for (int i = 0; i < list.Count; i++) { if (((Substation_Info)list[i]).L1 == 500) { if (((Substation_Info)list[i]).AreaName != area_500) { if (!table_500.Contains(((Substation_Info)list[i]).AreaName)) { table_500.Add(((Substation_Info)list[i]).AreaName, i); groupList_500.Add(((Substation_Info)list[i]).AreaName); } area_500 = ((Substation_Info)list[i]).AreaName; } if (five) { index5 = i; five = false; } ((Substation_Info)list[i]).S3 = x5.ToString(); h5 += ((Substation_Info)list[i]).L2; try { z5 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t5 += (int)((Substation_Info)list[i]).L3; } catch { } x5++; } else if (((Substation_Info)list[i]).L1 == 220 && ((Substation_Info)list[i]).S4 == "专用") { if (((Substation_Info)list[i]).AreaName != area_220z) { if (!table_220z.Contains(((Substation_Info)list[i]).AreaName)) { table_220z.Add(((Substation_Info)list[i]).AreaName, i); groupList_220z.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; } area_220z = ((Substation_Info)list[i]).AreaName; } if (twoz) { index2z = i; twoz = false; } ((Substation_Info)list[i]).S3 = x2z.ToString(); h2z += ((Substation_Info)list[i]).L2; try { z2z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t2z += (int)((Substation_Info)list[i]).L3; } catch { } x2z++; } else if (((Substation_Info)list[i]).L1 == 220 && ((Substation_Info)list[i]).S4 != "专用") { if (((Substation_Info)list[i]).AreaName != area_220) { if (!table_220.Contains(((Substation_Info)list[i]).AreaName)) { table_220.Add(((Substation_Info)list[i]).AreaName, i); groupList_220.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; } area_220 = ((Substation_Info)list[i]).AreaName; } if (two) { index2 = i; two = false; } ((Substation_Info)list[i]).S3 = x2.ToString(); h2 += ((Substation_Info)list[i]).L2; try { z2 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t2 += (int)((Substation_Info)list[i]).L3; } catch { } x2++; } else if (((Substation_Info)list[i]).L1 == 110 && ((Substation_Info)list[i]).S4 == "专用") { if (((Substation_Info)list[i]).AreaName != area2) { if (!table2.Contains(((Substation_Info)list[i]).AreaName)) { table2.Add(((Substation_Info)list[i]).AreaName, i); groupList2.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; } area2 = ((Substation_Info)list[i]).AreaName; } if (onez) { index1z = i; onez = false; } ((Substation_Info)list[i]).S3 = x1z.ToString(); h1z += ((Substation_Info)list[i]).L2; try { z1z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t1z += (int)((Substation_Info)list[i]).L3; } catch { } x1z++; } else if (((Substation_Info)list[i]).L1 == 110 && ((Substation_Info)list[i]).S4 != "专用") { if (((Substation_Info)list[i]).AreaName != area) { if (!table.Contains(((Substation_Info)list[i]).AreaName)) { table.Add(((Substation_Info)list[i]).AreaName, i); groupList.Add(((Substation_Info)list[i]).AreaName); // table[((Substation_Info)list[i]).AreaName] = i; } area = ((Substation_Info)list[i]).AreaName; } if (one) { index1 = i; one = false; } ((Substation_Info)list[i]).S3 = x1.ToString(); h1 += ((Substation_Info)list[i]).L2; try { z1 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t1 += (int)((Substation_Info)list[i]).L3; } catch { } x1++; } else if (((Substation_Info)list[i]).L1 == 35 && ((Substation_Info)list[i]).S4 == "专用") { if (((Substation_Info)list[i]).AreaName != area_35z) { if (!table_35z.Contains(((Substation_Info)list[i]).AreaName)) { table_35z.Add(((Substation_Info)list[i]).AreaName, i); groupList_35z.Add(((Substation_Info)list[i]).AreaName); } area_35z = ((Substation_Info)list[i]).AreaName; } if (threez) { index35z = i; threez = false; } ((Substation_Info)list[i]).S3 = x35z.ToString(); h35z += ((Substation_Info)list[i]).L2; try { z35z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t35z += (int)((Substation_Info)list[i]).L3; } catch { } x35z++; } else if (((Substation_Info)list[i]).L1 == 35 && ((Substation_Info)list[i]).S4 != "专用") { if (((Substation_Info)list[i]).AreaName != area_35) { if (!table_35.Contains(((Substation_Info)list[i]).AreaName)) { table_35.Add(((Substation_Info)list[i]).AreaName, i); groupList_35.Add(((Substation_Info)list[i]).AreaName); } area_35 = ((Substation_Info)list[i]).AreaName; } if (three) { index35 = i; three = false; } ((Substation_Info)list[i]).S3 = x35.ToString(); h35 += ((Substation_Info)list[i]).L2; try { z35 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t35 += (int)((Substation_Info)list[i]).L3; } catch { } x35++; } else if (((Substation_Info)list[i]).L1 == 10 && ((Substation_Info)list[i]).S4 == "专用") { if (((Substation_Info)list[i]).AreaName != area_10z) { if (!table_10z.Contains(((Substation_Info)list[i]).AreaName)) { table_10z.Add(((Substation_Info)list[i]).AreaName, i); groupList_10z.Add(((Substation_Info)list[i]).AreaName); } area_10z = ((Substation_Info)list[i]).AreaName; } if (tenz) { index10z = i; tenz = false; } ((Substation_Info)list[i]).S3 = x10z.ToString(); h10z += ((Substation_Info)list[i]).L2; try { z10z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t10z += (int)((Substation_Info)list[i]).L3; } catch { } x10z++; } else if (((Substation_Info)list[i]).L1 == 10 && ((Substation_Info)list[i]).S4 != "专用") { if (((Substation_Info)list[i]).AreaName != area_10) { if (!table_10.Contains(((Substation_Info)list[i]).AreaName)) { table_10.Add(((Substation_Info)list[i]).AreaName, i); groupList_10.Add(((Substation_Info)list[i]).AreaName); } area_10 = ((Substation_Info)list[i]).AreaName; } if (ten) { index10 = i; ten = false; } ((Substation_Info)list[i]).S3 = x10.ToString(); h10 += ((Substation_Info)list[i]).L2; try { z10 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t10 += (int)((Substation_Info)list[i]).L3; } catch { } x10++; } else if (((Substation_Info)list[i]).L1 == 6 && ((Substation_Info)list[i]).S4 == "专用") { if (((Substation_Info)list[i]).AreaName != area_6z) { if (!table_6z.Contains(((Substation_Info)list[i]).AreaName)) { table_6z.Add(((Substation_Info)list[i]).AreaName, i); groupList_6z.Add(((Substation_Info)list[i]).AreaName); } area_6z = ((Substation_Info)list[i]).AreaName; } if (sixz) { index6z = i; sixz = false; } ((Substation_Info)list[i]).S3 = x6z.ToString(); h6z += ((Substation_Info)list[i]).L2; try { z6z += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t6z += (int)((Substation_Info)list[i]).L3; } catch { } x6z++; } else if (((Substation_Info)list[i]).L1 == 6 && ((Substation_Info)list[i]).S4 != "专用") { if (((Substation_Info)list[i]).AreaName != area_6) { if (!table_6.Contains(((Substation_Info)list[i]).AreaName)) { table_6.Add(((Substation_Info)list[i]).AreaName, i); groupList_6.Add(((Substation_Info)list[i]).AreaName); } area_6 = ((Substation_Info)list[i]).AreaName; } if (six) { index6 = i; six = false; } ((Substation_Info)list[i]).S3 = x6.ToString(); h6 += ((Substation_Info)list[i]).L2; try { z6 += double.Parse(((Substation_Info)list[i]).L5); } catch { } try { t6 += (int)((Substation_Info)list[i]).L3; } catch { } x6++; } } if (x5 > 1) { Substation_Info info = new Substation_Info(); info.S3 = que[j]; j++; info.Title = "500千伏"; info.L2 = h5; info.L5 = z5.ToString(); info.L3 = t5; info.L1 = 500; info.S4 = "no"; list.Insert(index5, info);//.Add(info); now++; for (int k = 0; k < groupList_500.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_500[k]; conn = "L1=500 and AreaID='" + projectid + "' and AreaName='" + groupList_500[k] + "'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 500; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_500[groupList_500[k]].ToString()) + now, infok); now++; } } if (x2 > 1) { Substation_Info info2 = new Substation_Info(); info2.S3 = que[j]; j++; info2.Title = "220千伏公变"; info2.L2 = h2; info2.L5 = z2.ToString(); info2.L3 = t2; info2.L1 = 220; info2.S4 = "no"; list.Insert(index2 + now, info2); now++; for (int k = 0; k < groupList_220.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_220[k]; conn = "L1=220 and AreaID='" + projectid + "' and AreaName='" + groupList_220[k] + "' and S4!='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 220; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_220[groupList_220[k]].ToString()) + now, infok); now++; } } if (x2z > 1) { Substation_Info info2z = new Substation_Info(); info2z.S3 = que[j]; j++; info2z.Title = "220千伏专变"; info2z.L2 = h2z; info2z.L5 = z2z.ToString(); info2z.L3 = t2z; info2z.L1 = 220; info2z.S4 = "no"; list.Insert(index2z + now, info2z); now++; for (int k = 0; k < groupList_220z.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList_220z[k]; conn = "L1=220 and AreaID='" + projectid + "' and AreaName='" + groupList_220z[k] + "' and S4='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 220; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_220z[groupList_220z[k]].ToString()) + now, infok); now++; } } if (x1 > 1) { Substation_Info info1 = new Substation_Info(); info1.S3 = que[j]; j++; info1.Title = "110千伏公变"; info1.L2 = h1; info1.L5 = z1.ToString(); info1.L3 = t1; info1.L1 = 110; info1.S4 = "no"; list.Insert(index1 + now, info1); now++; for (int k = 0; k < groupList.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList[k]; conn = "L1=110 and AreaID='" + projectid + "' and AreaName='" + groupList[k] + "' and S4!='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 110; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table[groupList[k]].ToString()) + now, infok); now++; } } if (x1z > 1) { Substation_Info info1z = new Substation_Info(); info1z.S3 = que[j]; j++; info1z.Title = "110千伏专变"; info1z.L2 = h1z; info1z.L5 = z1z.ToString(); info1z.L3 = t1z; info1z.L1 = 110; info1z.S4 = "no"; list.Insert(index1z + now, info1z); now++; for (int k = 0; k < groupList2.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList2[k]; conn = "L1=110 and AreaID='" + projectid + "' and AreaName='" + groupList2[k] + "' and S4='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 110; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table2[groupList2[k]].ToString()) + now, infok); now++; } } if (x35 > 1) { Substation_Info info35 = new Substation_Info(); info35.S3 = que[j]; j++; info35.Title = "35千伏公变"; info35.L2 = h35; info35.L5 = z35.ToString(); info35.L3 = t35; info35.L1 = 35; info35.S4 = "no"; list.Insert(index35 + now, info35); now++; for (int k = 0; k < groupList_35.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_35[k]; conn = "L1=35 and AreaID='" + projectid + "' and AreaName='" + groupList_35[k] + "' and S4!='专用' "; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 35; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_35[groupList_35[k]].ToString()) + now, infok); now++; } } if (x35z > 1) { Substation_Info info35z = new Substation_Info(); info35z.S3 = que[j]; j++; info35z.Title = "35千伏专变"; info35z.L2 = h35z; info35z.L5 = z35z.ToString(); info35z.L3 = t35z; info35z.L1 = 35; info35z.S4 = "no"; list.Insert(index35z + now, info35z); now++; for (int k = 0; k < groupList_35z.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList_35z[k]; conn = "L1=35 and AreaID='" + projectid + "' and AreaName='" + groupList_35z[k] + "' and S4='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 35; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_35z[groupList_35z[k]].ToString()) + now, infok); now++; } } if (x10 > 1) { Substation_Info info10 = new Substation_Info(); info10.S3 = que[j]; j++; info10.Title = "10千伏公变"; info10.L2 = h10; info10.L5 = z10.ToString(); info10.L3 = t10; info10.L1 = 10; info10.S4 = "no"; list.Insert(index10 + now, info10); now++; for (int k = 0; k < groupList_10.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_10[k]; conn = "L1=10 and AreaID='" + projectid + "' and AreaName='" + groupList_10[k] + "' and S4!='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 10; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_10[groupList_10[k]].ToString()) + now, infok); now++; } } if (x10z > 1) { Substation_Info info10z = new Substation_Info(); info10z.S3 = que[j]; j++; info10z.Title = "10千伏专变"; info10z.L2 = h10z; info10z.L5 = z10z.ToString(); info10z.L3 = t10z; info10z.L1 = 10; info10z.S4 = "no"; list.Insert(index10z + now, info10z); now++; for (int k = 0; k < groupList_10z.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList_10z[k]; conn = "L1=10 and AreaID='" + projectid + "' and AreaName='" + groupList_10z[k] + "' and S4='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 10; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_10z[groupList_10z[k]].ToString()) + now, infok); now++; } } if (x6 > 1) { Substation_Info info6 = new Substation_Info(); info6.S3 = que[j]; j++; info6.Title = "6千伏公变"; info6.L2 = h6; info6.L5 = z6.ToString(); info6.L3 = t6; info6.L1 = 6; info6.S4 = "no"; list.Insert(index6 + now, info6); now++; for (int k = 0; k < groupList_6.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList[k]; infok.AreaName = groupList_6[k]; conn = "L1=6 and AreaID='" + projectid + "' and AreaName='" + groupList_6[k] + "' and S4!='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 6; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_6[groupList_6[k]].ToString()) + now, infok); now++; } } if (x6z > 1) { Substation_Info info6z = new Substation_Info(); info6z.S3 = que[j]; j++; info6z.Title = "6千伏专变"; info6z.L2 = h6z; info6z.L5 = z6z.ToString(); info6z.L3 = t6z; info6z.L1 = 6; info6z.S4 = "no"; list.Insert(index6z + now, info6z); now++; for (int k = 0; k < groupList_6z.Count; k++) { Substation_Info infok = new Substation_Info(); infok.S3 = Convert.ToChar(k + 65).ToString().ToLower(); //infok.Title = groupList2[k]; infok.AreaName = groupList_6z[k]; conn = "L1=6 and AreaID='" + projectid + "' and AreaName='" + groupList_6z[k] + "' and S4='专用'"; IList temList = Common.Services.BaseService.GetList("SelectSumSubstation_InfoByConn", conn); infok.L2 = ((Substation_Info)temList[0]).L2; infok.L5 = ((Substation_Info)temList[0]).L5; infok.L1 = 6; infok.S4 = "no"; conn += " and Flag='" + Ghflag + "' order by Title "; temList = Common.Services.BaseService.GetList("SelectSubstation_InfoByWhere", conn); infok.L3 = 0; foreach (Substation_Info temp in temList) { try { infok.L3 += (int)temp.L3; } catch { } } list.Insert(int.Parse(table_6z[groupList_6z[k]].ToString()) + now, infok); now++; } } try { for (int i = 0; i < list.Count; i++) { if (((Substation_Info)list[i]).L9 != null && (double)((Substation_Info)list[i]).L2 != null) { double templ9 = (double)((Substation_Info)list[i]).L9; double templ2 = (double)((Substation_Info)list[i]).L2; ((Substation_Info)list[i]).L10 = (templ2 == 0 ? 0 : templ9 / templ2) * 100; Substation_Info tempsub = Common.Services.BaseService.GetOneByKey<Substation_Info>(((Substation_Info)list[i]).UID); tempsub.L10 = ((Substation_Info)list[i]).L10; Common.Services.BaseService.Update<Substation_Info>(tempsub); } } } catch (Exception ew) { MessageBox.Show("计算负载率出错" + ew.Message); } fu_list = list; list_copy1(list, fu_list_no); att_list(fu_list_no); System.Data.DataTable dataTable = Itop.Common.DataConverter.ToDataTable((IList)list, typeof(Substation_Info)); return dataTable; }