public void UpdateObject(string type) { //��ȡ������� Line_Info obj = FocusedObject; if (obj == null) { return; } if (obj.S4 == "no") { MessageBox.Show("�����Ĵ��У�"); return; } //���������һ������ Line_Info objCopy = new Line_Info(); DataConverter.CopyTo<Line_Info>(obj, objCopy); //ִ���IJ��� using (FrmLine_InfoDialog dlg = new FrmLine_InfoDialog()) { if (gridControl.DataSource != null) dlg.LIST = (IList<Line_Info>)gridControl.DataSource; dlg.IsSelect = isselect; dlg.ctrlLint_Info = this; dlg.Type = types1; //dlg.Type = flagstype; dlg.Flag = flags1; dlg.Type2 = types2; dlg.ProjectID = projectid; if (System.Configuration.ConfigurationSettings.AppSettings["LangFang"].ToString() == "�ȷ�") { dlg.rowAreaName.Properties.Caption = "�����ͺ�"; dlg.rowL2.Visible = false; dlg.rowL3.Visible = false; } dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //�ø������½������ DataConverter.CopyTo<Line_Info>(objCopy, obj); RefreshData(type); gridControl.RefreshDataSource(); }
/// <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(); }
public bool RefreshData(string type,string con) { IList<Line_Info> list = new List<Line_Info>(); string conn = ""; try { types1 = type; int dd = 0; if (types2 == "220") { dd = 220; } else if (types2 == "66") { dd = 66; } else if (types2 == "10") { dd = 10; } Line_Info li = new Line_Info(); li.DY = dd; li.Flag = type; string filepath1 = ""; Econ ec = new Econ(); if (types2 == "220") { conn = "Code='' and Flag='" + type + "'" + con; list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByConn", conn); CalcTotal(ref list); //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml"); if (FlagsType == "") ec.UID = "RefreshDatalayout2"; else ec.UID = FlagsType + "RefreshDatalayout2"; } if (types2 == "66") { conn = "DY>10 and 10000>=DY and AreaID='" + projectid + "' "+con;// ; list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByConn", conn); CalcTotal(ref list); //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml"); if (FlagsType == "") ec.UID = "RefreshDatalayout1"; else ec.UID = FlagsType + "RefreshDatalayout1"; } if (types2 == "10") { conn = " DY>0 and 10>=DY " + con; list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByConn", conn); CalcTotal(ref list); //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType+"RefreshDatalayout1.xml"); //filepath1 = Path.GetTempPath()+ Path.GetFileName(FlagsType + "RefreshDatalayout2.xml"); if (FlagsType == "") ec.UID = "RefreshDatalayout2"; else ec.UID = FlagsType + "RefreshDatalayout2"; } IList<Econ> listxml = Services.BaseService.GetList<Econ>("SelectEconByKey", ec); //if (listxml.Count != 0) //{ // MemoryStream ms = new MemoryStream(listxml[0].ExcelData); // this.bandedGridView2.RestoreLayoutFromStream(ms); //} //if (types2 == "66") //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); } //else if (types2 == "10") //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy1", li); } string s = " ProjectID='" + Itop.Client.MIS.ProgUID + "'"; IList list1 = Services.BaseService.GetList("SelectPS_Table_AreaWHByConn", s); repositoryItemLookUpEdit1.DisplayMember = "Title"; repositoryItemLookUpEdit1.NullText = ""; repositoryItemLookUpEdit1.ValueMember = "ID"; repositoryItemLookUpEdit1.DataSource = list1; //IList<Line_Info> list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return false; } return true; }
public bool RefreshData(string layer, bool isrun, string power) { IList<Line_Info> lists = new List<Line_Info>(); try { Line_Info ll1 = new Line_Info(); ll1.AreaID = layer; ll1.DY = int.Parse(power); //if (isrun) //{ // lists = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByXZ", ll1); // filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshData1layout1.xml"); //} //else //{ // lists = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByGH", ll1); // filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshData1layout2.xml"); //} //if (File.Exists(filepath1)) //{ // this.bandedGridView2.RestoreLayoutFromXml(filepath1); //} if (isrun) { lists = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByXZ", ll1); } else { lists = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByGH", ll1); } this.gridControl.DataSource = lists; //foreach (GridColumn gc in this.bandedGridView2.Columns) //{ // gc.Visible = false; // gc.OptionsColumn.ShowInCustomizationForm = false; // if (gc.FieldName == "Title" || gc.FieldName == "DY" || gc.FieldName == "K2" || gc.FieldName == "K5") // { // gc.Visible = true; // gc.OptionsColumn.ShowInCustomizationForm = true; // } //} bandedGridView2.OptionsView.ColumnAutoWidth = true; foreach (GridBand gc in this.bandedGridView2.Bands) { try { gc.Visible = false; if (gc.Columns[0].FieldName == "Title" || gc.Columns[0].FieldName == "DY" || gc.Columns[0].FieldName == "K2" || gc.Columns[0].FieldName == "K5") { gc.Visible = true; gc.Caption = gc.Columns[0].Caption; gc.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } } catch { } } } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return false; } return true; }
/// <summary> /// ��Ӷ��� /// </summary> public void AddObject() { //�����������Ƿ��Ѿ����� if (ObjectList == null) { return; } //�½����� Line_Info obj = new Line_Info(); obj.L6 = (DateTime.Now).ToString(); obj.CreateDate = DateTime.Now; //ִ����Ӳ��� using (FrmLine_InfoDialog dlg = new FrmLine_InfoDialog()) { if(gridControl.DataSource!=null) dlg.LIST = (IList<Line_Info>)gridControl.DataSource; dlg.Type = types1; dlg.Flag = flags1; dlg.Type2 = types2; dlg.ctrlLint_Info = this; dlg.IsCreate = true; //�����½���־ dlg.Object = obj; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //���¶�����뵽������ ObjectList.Add(obj); //ˢ�±���������ж�λ���¶����ϡ� gridControl.RefreshDataSource(); GridHelper.FocuseRow(this.bandedGridView2, obj); }
/// <summary> /// ˢ�±���е����� /// </summary> /// <returns>ture:�ɹ� false:ʧ��</returns> public bool RefreshData() { try { IList<Line_Info> list = new List<Line_Info>(); int dd = 0; Line_Info li = new Line_Info(); li.DY = dd; li.Flag = flags1; string filepath1 = ""; if (types2 == "66") { list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); //filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("layout1.xml"); } if (types2 == "10") { list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy1", li); //filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("layout2.xml"); } if (File.Exists(filepath1)) { this.bandedGridView2.RestoreLayoutFromXml(filepath1); } string s = " ProjectID='" + Itop.Client.MIS.ProgUID + "'"; IList list1 = Services.BaseService.GetList("SelectPS_Table_AreaWHByConn", s); repositoryItemLookUpEdit1.DisplayMember = "Title"; repositoryItemLookUpEdit1.NullText = ""; repositoryItemLookUpEdit1.ValueMember = "ID"; repositoryItemLookUpEdit1.DataSource = list1; this.gridControl.DataSource = list; //IList<Line_Info> list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return false; } return true; }
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 Line_Info(); _obj.L6 = (DateTime.Now).ToString(); _obj.Flag = flags1; IList<Line_Info> list1 = new List<Line_Info>(); list1.Add(_obj); this.vGridControl.DataSource = list1; } else { DialogResult = DialogResult.OK; } } }
private void InsertLineData2() { //LayoutList lla = this.ctrlLayoutList1.FocusedObject; //if (lla == null) // return; if (selectid == "") 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<Line_Info> lii = new List<Line_Info>(); DateTime s8 = DateTime.Now; for (int i = 0; i < dts.Rows.Count; i++) { if (dts.Rows[i][1].ToString().IndexOf("�ϼ�") >= 0) continue; Line_Info l1 = new Line_Info(); foreach (DataColumn dc in dts.Columns) { columnname = dc.ColumnName; switch (dc.ColumnName) { case "DY": case "L1": case "K1": int LL1 = 0; try { LL1 = Convert.ToInt32(dts.Rows[i][dc.ColumnName].ToString()); } catch { } l1.L1 = LL1; l1.DY = LL1; l1.K1 = LL1; break; case "K4": case "K5": case "K6": case "K7": case "K16": case "K17": case "K18": case "K19": case "K20": case "K21": 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 "K8": case "K9": case "K10": case "K11": case "K12": case "K13": case "K14": case "K15": 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 = selectid; l1.CreateDate = s8.AddSeconds(i); //l1.L6 = DateTime.Now; lii.Add(l1); } foreach (Line_Info lll in lii) { Line_Info l1 = new Line_Info(); l1.AreaName = lll.AreaName; l1.Title = lll.Title; l1.Flag = selectid; object obj = Services.BaseService.GetObject("SelectLine_InfoByNameFlag", l1); if (obj != null) { lll.UID = ((Line_Info)obj).UID; lll.Code = ((Line_Info)obj).Code; Services.BaseService.Update<Line_Info>(lll); } else { Services.BaseService.Create<Line_Info>(lll); } } this.ctrlLine_Info1.RefreshData(selectid); } } catch (Exception ex) { MsgBox.Show(columnname+ex.Message); MsgBox.Show("�����ʽ����ȷ��"); } }
private void InitSodata1() { string sid = "1"; Hashtable hs = new Hashtable(); Hashtable hs2 = new Hashtable(); IList<LineInfo> listLineInfo = Services.BaseService.GetList<LineInfo>("SelectLineInfoByPowerIDStuff", sid); foreach (LineInfo l1 in listLineInfo) { hs.Add(Guid.NewGuid().ToString(), l1.UID); } IList<Line_Info> ll1 = Common.Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlag", sid); foreach (Line_Info ps in ll1) { hs2.Add(Guid.NewGuid().ToString(), ps.Code); } foreach (Line_Info p1 in ll1) { if (p1.Code != "" && !hs.ContainsValue(p1.Code)) { Services.BaseService.Delete<Line_Info>(p1); } } foreach (LineInfo l2 in listLineInfo) { if (!hs2.ContainsValue(l2.UID) && l2.Voltage != "") { //��� try { //Line_Info line1 = new Line_Info(); //line1.DY = int.Parse(l2.Voltage.ToUpper().Replace("KV", "")); //line1.Title = l2.LineName; //line1.Code = l2.UID; //line1.Flag = sid; //Services.BaseService.Create<Line_Info>(line1); Line_Info line1 = new Line_Info(); line1.Title = l2.LineName; line1.Code = l2.UID; line1.Flag = sid; try { int dy = int.Parse(l2.Voltage.ToUpper().Replace("KV", "")); line1.DY = dy; line1.K1 = dy; line1.L1 = dy; } catch { } try { line1.L4 = l2.LineType; line1.K2 = l2.LineType; } catch { } try { line1.L6 = l2.ObligateField3; } catch { line1.L6 = null; } try { line1.L5 = double.Parse(l2.Length); line1.K5 = double.Parse(l2.Length); } catch { } Services.BaseService.Create<Line_Info>(line1); } catch(Exception ex) { MsgBox.Show(ex.Message);} } } }
private void InsertLineData1() { try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel�ļ�(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); IList<Line_Info> lii = new List<Line_Info>(); DateTime s8 = DateTime.Now; for (int i = 1; i < dts.Rows.Count; i++) { if (dts.Rows[i][1].ToString().IndexOf("�ϼ�") >= 0) continue; Line_Info l1 = new Line_Info(); foreach (DataColumn dc in dts.Columns) { if (dc.ColumnName == "L1") { int LL1 = 0; try { LL1 = Convert.ToInt32(dts.Rows[i]["L1"].ToString()); } catch { } l1.L1 = LL1; l1.DY = LL1; l1.K1 = LL1; } else if (dc.ColumnName == "L5") { double LL2 = 0; try { LL2 = Convert.ToDouble(dts.Rows[i]["L5"].ToString()); } catch { } l1.L5 = LL2; } else if (dc.ColumnName == "L6") { //DateTime LL3 = DateTime.Now; //try //{ // LL3 = Convert.ToDateTime(dts.Rows[i]["L6"].ToString()); //} //catch { } l1.L6 = dts.Rows[i]["L6"].ToString(); } else if (dc.ColumnName == "K1") { continue; } else { l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, dts.Rows[i][dc.ColumnName].ToString(), null); } } l1.Flag = "1"; l1.CreateDate = s8.AddSeconds(i); lii.Add(l1); } foreach (Line_Info lll in lii) { Line_Info l1 = new Line_Info(); l1.AreaName = lll.AreaName; l1.Title = lll.Title; l1.Flag = "1"; object obj = Services.BaseService.GetObject("SelectLine_InfoByNameFlag", l1); if (obj != null) { lll.UID = ((Line_Info)obj).UID; Services.BaseService.Update<Line_Info>(lll); } else { Services.BaseService.Create<Line_Info>(lll); } } this.ctrlLine_Info1.RefreshData(); } } catch (Exception ex) { MsgBox.Show(ex.Message); MsgBox.Show("�����ʽ����ȷ��"); } }
private void InitSodata1() { if (ctrlLayoutList1.FocusedObject == null) return; string sid = ctrlLayoutList1.FocusedObject.UID; Hashtable hs = new Hashtable(); Hashtable hs2 = new Hashtable(); IList<LineInfo> listLineInfo = Services.BaseService.GetList<LineInfo>("SelectLineInfoByPowerID", sid); foreach (LineInfo l1 in listLineInfo) { hs.Add(Guid.NewGuid().ToString(), l1.UID); } IList<Line_Info> ll1 = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlag", sid); foreach (Line_Info ps in ll1) { hs2.Add(Guid.NewGuid().ToString(), ps.Code); } foreach (Line_Info p1 in ll1) { if (p1.Code != "" && !hs.ContainsValue(p1.Code)) { Services.BaseService.Delete<Line_Info>(p1); } } foreach (LineInfo l2 in listLineInfo) { if (!hs2.ContainsValue(l2.UID) && l2.Voltage != "") { //��� try { Line_Info line1 = new Line_Info(); line1.Title = l2.LineName; line1.Code = l2.UID; line1.Flag = sid; line1.CreateDate = DateTime.Now; line1.L6 = (DateTime.Now).ToString(); try { int dy = int.Parse(l2.Voltage.ToUpper().Replace("KV", "")); line1.DY = dy; line1.K1 = dy; line1.L1 = dy; } catch { } try { line1.L4 = l2.LineType; line1.K2 = l2.LineType; } catch { } try { line1.L5 = double.Parse(l2.Length); line1.K5 = double.Parse(l2.Length); } catch { } Services.BaseService.Create<Line_Info>(line1); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
/// <summary> /// �Ľ������ /// </summary> public void UpdateObject() { //��ȡ������� Line_Info obj = FocusedObject; if (obj == null) { return; } //���������һ������ Line_Info objCopy = new Line_Info(); DataConverter.CopyTo<Line_Info>(obj, objCopy); //ִ���IJ��� using (FrmLine_InfoDialog dlg = new FrmLine_InfoDialog()) { if (gridControl.DataSource != null) dlg.LIST = (IList<Line_Info>)gridControl.DataSource; dlg.IsSelect = isselect; dlg.ctrlLint_Info = this; dlg.Type = types1; dlg.Flag = flags1; dlg.Type2 = types2; dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //�ø������½������ DataConverter.CopyTo<Line_Info>(objCopy, obj); //ˢ�±�� gridControl.RefreshDataSource(); }
public bool RefreshData(string type) { IList<Line_Info> list = new List<Line_Info>(); try { flags1 = type; int dd = 0; if (types2 == "66") { dd = 66; } else if (types2 == "10") { dd = 10; } else if (Type2=="1000") { dd = 1000; } Line_Info li = new Line_Info(); li.DY = dd; li.Flag = flags1; string filepath1 = ""; if (types2 == "66") { list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshDatalayout1.xml"); } if (types2 == "10") { list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy1", li); filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshDatalayout2.xml"); } if (Type2=="1000") { list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); filepath1 = Path.GetTempPath() + "\\" + Path.GetFileName("RefreshDatalayout3.xml"); } if (File.Exists(filepath1)) { this.bandedGridView2.RestoreLayoutFromXml(filepath1); } //if (types2 == "66") //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); } //else if (types2 == "10") //{ list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy1", li); } //IList<Line_Info> list = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlagDy", li); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return false; } return true; }
private void InitSodata1() { ////if (ctrlLayoutList1.FocusedObject == null) //// return; ////string sid = ctrlLayoutList1.FocusedObject.UID; string sid = selectid; if (sid == "") return; Hashtable hs = new Hashtable(); Hashtable hs2 = new Hashtable(); LineInfo lia1 = new LineInfo(); lia1.LineName = "SELECT " +"t1.uid as UID, " +"EleID, " +"LineName, " +"Length, " +"LineType, " +"Voltage, " + "t2.PicSelectName as SvgUID, " +"LayerID, " +"ObligateField1, " +"ObligateField2, " +"ObligateField3, " +"ObligateField4, " + "ObligateField5,ObligateField6,ObligateField7 " + "FROM LineInfo t1,PSP_PowerPicSelect t2 where t1.LayerID=t2.PicSelectID and t2.EachListID='"+sid+"' and t1.ObligateField1='"+leixing+"'"; IList<LineInfo> listLineInfo = Services.BaseService.GetList<LineInfo>("SelectLineInfoByWhere1", lia1); if (leixing == "����") { IList<LineInfo> lla = new List<LineInfo>(); Hashtable hsss1 = new Hashtable(); foreach (LineInfo l1 in listLineInfo) { if (!hsss1.ContainsKey(l1.LineName)) { lla = new List<LineInfo>(); lla.Add(l1); hsss1.Add(l1.LineName, lla); } else { IList<LineInfo> llb = (IList<LineInfo>)hsss1[l1.LineName]; llb.Add(l1); hsss1[l1.LineName] = llb; } } foreach (DictionaryEntry de1 in hsss1) { string uuid=Guid.NewGuid().ToString(); int sff=10000; IList<LineInfo> llc = (IList<LineInfo>)de1.Value; foreach (LineInfo l2 in llc) { string yearss = l2.SvgUID; int years1 = 0; int years2 = DateTime.Now.Year-1; try { years1 = int.Parse(yearss.Substring(0, 4)); } catch { continue; } if (Math.Abs(years2 - years1) <= sff) { sff = Math.Abs(years2 - years1); if (hs.ContainsKey(uuid)) { hs[uuid] = l2.UID; } else { hs.Add(uuid, l2.UID); } } } } } else { foreach (LineInfo l1 in listLineInfo) { hs.Add(Guid.NewGuid().ToString(), l1.UID); } } IList<Line_Info> ll1 = Common.Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlag", sid); foreach (Line_Info ps in ll1) { if(ps.Code!="") hs2.Add(ps.Code,ps.UID); } foreach (Line_Info p1 in ll1) { if (p1.Code != "" && !hs.ContainsValue(p1.Code)) { Services.BaseService.Delete<Line_Info>(p1); } } foreach (LineInfo l2 in listLineInfo) { if (hs.ContainsValue(l2.UID) && l2.Voltage != "") { Line_Info line1 = new Line_Info(); if (hs2.ContainsKey(l2.UID)) line1 = Services.BaseService.GetOneByKey<Line_Info>(hs2[l2.UID].ToString()); line1.Title = l2.LineName; line1.Code = l2.UID; line1.Flag = sid; if (System.Configuration.ConfigurationSettings.AppSettings["LangFang"].ToString() == "�ȷ�") { line1.AreaName = l2.ObligateField5;//��ʱΪ�����ͺ� } try { int dy = int.Parse(l2.Voltage.ToUpper().Replace("KV", "")); line1.DY = dy; line1.K1 = dy; line1.L1 = dy; } catch { } try { line1.L4 = l2.LineType; line1.K2 = l2.LineType; } catch { } line1.AreaID = ProjectUID; try { line1.L6 = l2.ObligateField3;//Ͷ������ } catch { line1.L6 = null; } try { line1.L5 = double.Parse(l2.Length); line1.K5 = double.Parse(l2.Length); } catch { } try { if (!hs2.ContainsKey(l2.UID)) { Services.BaseService.Create<Line_Info>(line1); } else { //line1.UID = hs2[l2.UID].ToString(); Services.BaseService.Update<Line_Info>(line1); } } catch (Exception ex) { System.Console.Write(ex.Message); } } } }
public void AddObject(string type) { //�����������Ƿ��Ѿ����� if (ObjectList == null) { return; } //�½����� Line_Info obj = new Line_Info(); //obj.L6 = DateTime.Now; obj.CreateDate = DateTime.Now; //ִ����Ӳ��� using (FrmLine_InfoDialog dlg = new FrmLine_InfoDialog()) { if(gridControl.DataSource!=null) dlg.LIST = (IList<Line_Info>)gridControl.DataSource; dlg.ProjectID = projectid; //dlg.Type = types1; dlg.Type = types1; dlg.Flag = flags1; dlg.Type2 = types2; dlg.ctrlLint_Info = this; dlg.IsCreate = true; //�����½���־ dlg.Object = obj; if (System.Configuration.ConfigurationSettings.AppSettings["LangFang"].ToString() == "�ȷ�") { dlg.rowAreaName.Properties.Caption = "�����ͺ�"; dlg.rowL2.Visible = false; dlg.rowL3.Visible = false; } if (dlg.ShowDialog() != DialogResult.OK) { return; } } RefreshData(type); //���¶�����뵽������ //ObjectList.Add(obj); ////ˢ�±���������ж�λ���¶����ϡ� //gridControl.RefreshDataSource(); //GridHelper.FocuseRow(this.bandedGridView2, obj); }
private void InsertLineData1() { //LayoutList lla = this.ctrlLayoutList1.FocusedObject; //if (lla == null) // return; if (selectid == "") return; try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel�ļ�(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); IList<Line_Info> lii = new List<Line_Info>(); DateTime s8 = DateTime.Now; for (int i = 0; i < dts.Rows.Count; i++) { if (dts.Rows[i][1].ToString().IndexOf("�ϼ�") >= 0) continue; Line_Info l1 = new Line_Info(); foreach(DataColumn dc in dts.Columns) { if (dc.ColumnName == "L1") { int LL1 = 0; try { LL1 = Convert.ToInt32(dts.Rows[i]["L1"].ToString()); } catch { } l1.L1 = LL1; l1.DY = LL1; l1.K1 = LL1; } else if (dc.ColumnName == "L5") { double LL2 = 0; try { LL2 = Convert.ToDouble(dts.Rows[i]["L5"].ToString()); } catch { } l1.L5 = LL2; } else if (dc.ColumnName == "L6") { //DateTime LL3 = DateTime.Now; //try //{ // LL3 = Convert.ToDateTime(dts.Rows[i]["L6"].ToString()); //} //catch { } l1.L6 = dts.Rows[i]["L6"].ToString(); } else if (dc.ColumnName == "K1") { continue; } else { l1.GetType().GetProperty(dc.ColumnName).SetValue(l1, dts.Rows[i][dc.ColumnName].ToString(), null); } } l1.Flag = selectid; l1.CreateDate = s8.AddSeconds(i); l1.AreaID = ProjectUID; lii.Add(l1); } foreach (Line_Info lll in lii) { Line_Info l1 = new Line_Info(); // l1.AreaName = lll.AreaName; l1.Title = lll.Title; l1.Flag = selectid; l1.DY = lll.DY; try { int tx = int.Parse(l1.L6); if (tx > DateTime.Now.Year) l1.Flag = "2"; else l1.Flag = "1"; } catch { l1.Flag = "1"; } string conn = "Title='" + lll.Title + "' and Flag='" + l1.Flag + "' and DY='" + lll.DY + "'"; object obj = Services.BaseService.GetObject("SelectLine_InfoByConn", conn); if (obj != null) { lll.UID = ((Line_Info)obj).UID; lll.Code = ((Line_Info)obj).Code; Services.BaseService.Update<Line_Info>(lll); } else { lll.UID += "|" + ProjectUID; Services.BaseService.Create<Line_Info>(lll); } } this.ctrlLine_Info1.RefreshData(selectid); } } catch (Exception ex) { MsgBox.Show(ex.Message); MsgBox.Show("�����ʽ����ȷ��"); } }
public void CalcTotal(ref IList<Line_Info> list) { 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 = "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 ((list[i]).L1 == 500) { if (five) { index5 = i; five = false; } (list[i]).S2 = x5.ToString(); // h5 += (list[i]).L2; try { z5 += (list[i]).L5; } catch { } x5++; } else if ((list[i]).L1 == 220) { if (two) { index2 = i; two = false; } (list[i]).S2 = x2.ToString(); //h2 += (list[i]).L2; try { z2 += (list[i]).L5; } catch { } x2++; } else if ((list[i]).L1 == 110 && (list[i]).S4 == "ר��") { if (onez) { index1z = i; onez = false; } (list[i]).S2 = x1z.ToString(); //h1z += (list[i]).L2; try { z1z += (list[i]).L5; } catch { } x1z++; } else if ((list[i]).L1 == 110 && (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; } (list[i]).S2 = x1.ToString(); // h1 += (list[i]).L2; try { z1 += (list[i]).L5; } catch { } x1++; } else if ((list[i]).L1 == 35) { if (three) { index35 = i; three = false; } (list[i]).S2 = x35.ToString(); //h2 += (list[i]).L2; try { z35 += (list[i]).L5; } catch { } x35++; } } if (x5 > 1) { Line_Info info = new Line_Info(); info.S2 = que[j]; j++; info.Title = "500ǧ����·"; // info.L4 = h5; info.L5 = z5; info.L1 = 500; info.S4 = "no"; list.Insert(index5, info);//.Add(info); now++; } if (x2 > 1) { Line_Info info2 = new Line_Info(); info2.S2 = que[j]; j++; info2.Title = "220ǧ����·"; // info2.L2 = h2; info2.L5 = z2; info2.L1 = 220; info2.S4 = "no"; list.Insert(index2 + now, info2); now++; } if (x1 > 1) { Line_Info info1 = new Line_Info(); info1.S2 = que[j]; j++; info1.Title = "110ǧ��������·"; // info1.L2 = h1; info1.L5 = z1; 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; // list.Insert(int.Parse(table[groupList[k]].ToString()) + now, infok); // now++; //} } if (x1z > 1) { Line_Info info1z = new Line_Info(); info1z.S2 = que[j]; j++; info1z.Title = "110ǧ��ר����·"; // info1z.L2 = h1z; info1z.L5 = z1z; info1z.L1 = 110; info1z.S4 = "no"; list.Insert(index1z + now, info1z); now++; } if (x35 > 1) { Line_Info info35 = new Line_Info(); info35.S2 = que[j]; j++; info35.Title = "35ǧ����·"; // info1z.L2 = h1z; info35.L5 = z35; info35.L1 = 35; info35.S4 = "no"; list.Insert(index35 + now, info35); now++; } // this.gridControl.DataSource = list; }
private void InitSodata1() { if (ctrlLayoutList1.FocusedObject == null) return; string sid = ctrlLayoutList1.FocusedObject.UID; Hashtable hs = new Hashtable(); Hashtable hs2 = new Hashtable(); IList<LineInfo> listLineInfo = Services.BaseService.GetList<LineInfo>("SelectLineInfoByPowerID", sid); foreach (LineInfo l1 in listLineInfo) { hs.Add(Guid.NewGuid().ToString(), l1.UID); } IList<Line_Info> ll1 = Services.BaseService.GetList<Line_Info>("SelectLine_InfoByFlag", sid); foreach (Line_Info ps in ll1) { hs2.Add(Guid.NewGuid().ToString(), ps.Code); } foreach (Line_Info p1 in ll1) { if (p1.Code != "" && !hs.ContainsValue(p1.Code)) { Services.BaseService.Delete<Line_Info>(p1); } } foreach (LineInfo l2 in listLineInfo) { if (!hs2.ContainsValue(l2.UID) && l2.Voltage != "") { //��� try { Line_Info line1 = new Line_Info(); line1.DY = int.Parse(l2.Voltage.ToUpper().Replace("KV", "")); line1.Title = l2.LineName; line1.Code = l2.UID; line1.Flag = sid; Services.BaseService.Create<Line_Info>(line1); } catch { } } } }
private void mc_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { frmSubSel f = new frmSubSel(); string strKv = dj.Text.Replace("kV", ""); if (strKv == "") { strKv = "0"; } if (comboBox1.Text == "规划") { f.ReDate(layerID, false, true, strKv); } else { f.ReDate("", true, true, strKv); } if (f.ShowDialog() == DialogResult.OK) { p = f.ctrlLine_Info1.FocusedObject; line.LineName = p.Title; line.Length = p.K5.ToString(); line.LineType = p.K2; mc.Text = line.LineName; cd.Text = line.Length; xh.Text = line.LineType; OldUID = p.Code; p.Code = line.UID; SubUpdate = true; } }