/// <summary> /// �Ľ������ /// </summary> public void UpdateObject() { //��ȡ������� PSP_Project_List obj = FocusedObject; if (obj == null) { return; } //���������һ������ PSP_Project_List objCopy = new PSP_Project_List(); DataConverter.CopyTo<PSP_Project_List>(obj, objCopy); //ִ���IJ��� using (FrmPSP_Project_ListDialog dlg = new FrmPSP_Project_ListDialog()) { dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //�ø������½������ DataConverter.CopyTo<PSP_Project_List>(objCopy, obj); //ˢ�±�� gridControl.RefreshDataSource(); }
/// <summary> /// ��Ӷ��� /// </summary> public void AddObject() { //�����������Ƿ��Ѿ����� if (ObjectList == null) { return; } //�½����� PSP_Project_List obj = new PSP_Project_List(); //ִ����Ӳ��� using (FrmPSP_Project_ListDialog dlg = new FrmPSP_Project_ListDialog()) { dlg.IsCreate = true; //�����½���־ dlg.Object = obj; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //���¶�����뵽������ ObjectList.Add(obj); //ˢ�±���������ж�λ���¶����ϡ� gridControl.RefreshDataSource(); GridHelper.FocuseRow(this.gridView, obj); }
private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FrmPSP_Project_ListPrint_TouZiGuSuan tzprint = new FrmPSP_Project_ListPrint_TouZiGuSuan(); PSP_Project_List pp = new PSP_Project_List(); pp.Flag2 = typeFlag; IList list = Services.BaseService.GetList("SelectPSP_Project_ListByFlag2", pp); try { foreach (PSP_Project_List pl in list) { if (pl.L5 != "" && pl.L5 != null) { if (int.Parse(pl.L5) > 1) { pl.L6 = pl.L6 + " X " + pl.L5; } } } } catch { } DataTable dt = Itop.Common.DataConverter.ToDataTable(list, typeof(PSP_Project_List)); tzprint.Text =this.ctrlPowerEachList1.FocusedObject.ListName; //tzprint.gridControl1.Text= "4455"; tzprint.bandedGridView1.GroupPanelText = this.ctrlPowerEachList1.FocusedObject.ListName; tzprint.GridDataTable = dt; tzprint.Show(); }
/// <summary> /// ˢ�±���е����� /// </summary> /// <returns>ture:�ɹ� false:ʧ��</returns> public bool RefreshData() { PSP_Project_List pp=new PSP_Project_List(); pp.Flag2=flag; try { IList<PSP_Project_List> list = Services.BaseService.GetList<PSP_Project_List>("SelectPSP_Project_ListByFlag2", pp); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return false; } return true; }
private void InitPicData() { PSP_Project_List psp_Type = new PSP_Project_List(); string str = ""; try { str = System.Configuration.ConfigurationSettings.AppSettings["SvgID"]; } catch { } dt.Columns.Add("A"); dt.Columns.Add("B"); dt.Columns.Add("C", typeof(bool)); dt.Columns.Add("D"); IList<LayerGrade> li = Services.BaseService.GetList<LayerGrade>("SelectLayerGradeListBySvgDataUid", str); IList<SVG_LAYER> li1 = Services.BaseService.GetList<SVG_LAYER>("SelectSVG_LAYERBySvgID", str); DataTable dt1 = Itop.Common.DataConverter.ToDataTable((IList)li1); foreach (LayerGrade node in li) { DataRow row = dt.NewRow(); row["A"] = node.SUID; row["B"] = node.Name; row["C"] = false; row["D"] = node.ParentID; dt.Rows.Add(row); DataRow[] rows = dt1.Select("YearID='" + node.SUID + "'"); foreach (DataRow row1 in rows) { DataRow row2 = dt.NewRow(); row2["A"] = row1["SUID"].ToString(); row2["B"] = row1["NAME"].ToString(); row2["C"] = false; row2["D"] = node.SUID; dt.Rows.Add(row2); } } //SVGFILE sf = Services.BaseService.GetOneByKey<SVGFILE>("26474eb6-cd92-4e84-a579-2f33946acf1a"); //XmlDocument xd = new XmlDocument(); //xd.LoadXml(sf.SVGDATA); //dt.Columns.Add("A"); //dt.Columns.Add("B"); //dt.Columns.Add("C", typeof(bool)); //XmlNodeList nli = xd.GetElementsByTagName("layer"); //foreach (XmlNode node in nli) //{ // DataRow row =dt.NewRow(); // XmlElement xe=(XmlElement)node; // row["A"] =xe.GetAttribute("id"); // row["B"] = xe.GetAttribute("label"); // row["C"] = false; // dt.Rows.Add(row); //} }
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 { } } } }
private void barButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNode focusedNode = treeList1.FocusedNode; if (focusedNode == null) { return; } FormAddInfo_TouZiGuSuan frm = new FormAddInfo_TouZiGuSuan(); frm.Text = "增加" + focusedNode.GetValue("L3") + "的子项目"; frm.FlagId = typeFlag2; frm.ParentID = focusedNode.GetValue("ID").ToString(); frm.Isupdate = false; if (frm.ShowDialog() == DialogResult.OK) { obj = frm.OBJ; TreeListColumn column = treeList1.Columns["L10"]; CalculateSum(focusedNode, column, obj.L10, false); //// LoadData(); //// FoucsLocation(psp_Type.ID, treeList1.Nodes); //treeList1.RefreshDataSource(); //dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow())); WaitDialogForm wait = null; try { wait = new WaitDialogForm("", "正在重新统计数据, 请稍候..."); LoadDatadata(); wait.Close(); // MsgBox.Show("计算成功"); } catch { wait.Close(); } //treeList1.FocusedNode.SetValue(treeList1.FocusedColumn.FieldName, lastEditValue); } }
private void barButtonItem14_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } if (treeList1.FocusedNode.HasChildren) { MsgBox.Show("此项目下有子项目,请先删除子项目!"); return; } if (treeList1.FocusedNode.ParentNode == null) { if (MsgBox.ShowYesNo("是否删除项目 " + treeList1.FocusedNode.GetValue("L3") + "?") == DialogResult.Yes) { PowerProValues PowerValues = new PowerProValues(); PowerValues.TypeID = treeList1.FocusedNode["ID"].ToString(); PowerValues.Year = typeFlag2; PSP_Project_List ppss = new PSP_Project_List(); ppss.ID = treeList1.FocusedNode["ID"].ToString(); ppss.Flag2 = typeFlag2; PSP_Project_List ppss1 = Services.BaseService.GetOneByKey<PSP_Project_List>(ppss); PowerValues.TypeID1 = ppss1.Code; try { //DeletePowerValuesByType里面删除数据和分类 Common.Services.BaseService.Update("DeletePowerProValuesByType", PowerValues); TreeListNode brotherNode = null; try { if (treeList1.FocusedNode.ParentNode.Nodes.Count > 1) { brotherNode = treeList1.FocusedNode.PrevNode; if (brotherNode == null) { brotherNode = treeList1.FocusedNode.NextNode; } } } catch { } Common.Services.BaseService.Update("DeletePSP_Project_ListByIDFlag2", ppss); treeList1.DeleteNode(treeList1.FocusedNode); WaitDialogForm wait = null; try { wait = new WaitDialogForm("", "正在删除数据, 请稍候..."); // LoadDatadata(); wait.Close(); // MsgBox.Show("计算成功"); } catch { wait.Close(); } } catch (Exception ex) { MsgBox.Show("删除出错:" + ex.Message); } } return; } else { if (MsgBox.ShowYesNo("是否删除项目 " + treeList1.FocusedNode.GetValue("L3") + "?") == DialogResult.Yes) { bool flag = false; PowerProValues PowerValues = new PowerProValues(); PowerValues.TypeID = treeList1.FocusedNode["ID"].ToString(); PowerValues.Year = typeFlag2; PSP_Project_List ppss = new PSP_Project_List(); ppss.ID=treeList1.FocusedNode["ID"].ToString(); ppss.Flag2=typeFlag2; PSP_Project_List ppss1 = Services.BaseService.GetOneByKey<PSP_Project_List>(ppss); PowerValues.TypeID1 = ppss1.Code; try { //DeletePowerValuesByType里面删除数据和分类 Common.Services.BaseService.Update("DeletePowerProValuesByType", PowerValues); TreeListNode brotherNode = null; try { if (treeList1.FocusedNode.ParentNode.Nodes.Count > 1) { flag = false; brotherNode = treeList1.FocusedNode.PrevNode; if (brotherNode == null) { brotherNode = treeList1.FocusedNode.NextNode; } } if (treeList1.FocusedNode.ParentNode.Nodes.Count == 1) { flag = true; } } catch { } Common.Services.BaseService.Update("DeletePSP_Project_ListByIDFlag2", ppss); TreeListColumn column = treeList1.Columns["L10"]; treeList1.DeleteNode(treeList1.FocusedNode); if(flag==false) CalculateSum(treeList1.FocusedNode.ParentNode, column, 0,false); else CalculateSum(treeList1.FocusedNode, column, 0,false); WaitDialogForm wait = null; try { wait = new WaitDialogForm("", "正在删除数据, 请稍候..."); // LoadDatadata(); wait.Close(); //MsgBox.Show("计算成功"); } catch { wait.Close(); } } catch (Exception ex) { MsgBox.Show("删除出错:" + ex.Message); } } } // InitSodata(); //obj= frm.OBJ; // CalculateSum(focusedNode, column, double.Parse(obj.L10)); }
//重新计算造价 private void UpdataLoadDatadata() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Nodes.Clear(); } PSP_Project_List psp_Type = new PSP_Project_List(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPSP_Project_ListByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } Project_Sum ps = new Project_Sum(); ps.S5 = "1"; IList<Project_Sum> sumline = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); ps.S5 = "2"; IList<Project_Sum> sumsubsation = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); Hashtable ha = new Hashtable(); ArrayList al = new ArrayList(); foreach (PSP_Project_List psplf in listTypes) { if (psplf.Flag == 1)//纯线路造价计算 { if (psplf.L8 == "" || psplf.L8 == null) { psplf.L8 = "0"; } foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; psplf.L10 =Math.Round(psum.Num * double.Parse(psplf.L8),2); if (psplf.L11 == "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 = Math.Round(psplf.L10 + double.Parse(psplf.L11), 2); //// Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangByid", psplf); break; } } } if (psplf.Flag == 2) { ha.Clear(); al.Clear(); double sumvaluedata = 0; double sumvalueLine = 0; if (psplf.L6 != "" && psplf.L6 != null && psplf.L5 != "" && psplf.L5 != null)//变电站内的电站造价计算 { if (psplf.IsConn.ToString() == "" || psplf.IsConn.ToString() == null ) psplf.IsConn = "0"; double mva = double.Parse(psplf.IsConn.ToString()); double t5 =0;//单台容量 int ta =0;//主变台数 string l5=""; string l6 = ""; foreach (Project_Sum psum in sumsubsation) { if (psum.S1 == psplf.L4) { try { t5 = Convert.ToDouble(psum.T5);//单台容量 ta = Convert.ToInt32(psum.T1);//主变台数 if (mva == (t5 * ta)) { ha.Add(t5, ta); al.Add(t5); } } catch { } } } if (al.Count >0) { double va = Convert.ToDouble(al[0].ToString()); for (int ii = 0; ii < al.Count; ii++) { if (va < Convert.ToDouble(al[ii].ToString())) va = Convert.ToDouble(al[ii].ToString()); } l5 = ha[va].ToString(); l6 = va.ToString(); } else { l5 = ""; l6 = ""; } psplf.L5 = l5; psplf.L6 = l6; ////if (psplf.L5 != l5 && psplf.L6 != l6) ////{ //// psplf.l5 = l5; //// psplf.L6 = l6; //// Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangByid", psplf); ////} foreach (Project_Sum psum in sumsubsation) { if (psum.T1 == psplf.L5 && psum.T5 == psplf.L6 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvaluedata = psum.Num; break; } } } if (psplf.L8 != "" && psplf.L8 != null)//变电站内的线路造价计算 { foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvalueLine = psum.Num * double.Parse(psplf.L8); break; } } } psplf.L10 =Math.Round(sumvaluedata + sumvalueLine,2); if (psplf.L11== "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 =Math.Round(psplf.L10 + double.Parse(psplf.L11),2); } } dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PSP_Project_List)); treeList1.DataSource = dataTable; ////treeList1.Columns["L3"].Caption = "工程名称"; ////treeList1.Columns["L3"].Width = 80; ////treeList1.Columns["L3"].OptionsColumn.AllowEdit = false; ////treeList1.Columns["L3"].OptionsColumn.AllowSort = false; ////treeList1.Columns["Title"].VisibleIndex = -1; ////treeList1.Columns["Title"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["Flag"].VisibleIndex = -1; ////treeList1.Columns["Flag"].SortOrder = System.Windows.Forms.SortOrder.None; ////treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["Flag2"].VisibleIndex = -1; ////treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["CreateTime"].VisibleIndex = -1; ////treeList1.Columns["CreateTime"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["CreateTime"].SortOrder = System.Windows.Forms.SortOrder.None; ////treeList1.Columns["UpdateTime"].VisibleIndex = -1; ////treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["UpdateTime"].VisibleIndex = -1; ////treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["Code"].VisibleIndex = -1; ////treeList1.Columns["Code"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L1"].VisibleIndex = -1; ////treeList1.Columns["L1"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L7"].VisibleIndex = -1; treeList1.Columns["L7"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L11"].VisibleIndex = -1; ////treeList1.Columns["L11"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L12"].VisibleIndex = -1; ////treeList1.Columns["L12"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L13"].VisibleIndex = -1; ////treeList1.Columns["L13"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L14"].VisibleIndex = -1; ////treeList1.Columns["L14"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L15"].VisibleIndex = -1; ////treeList1.Columns["L15"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L16"].VisibleIndex = -1; ////treeList1.Columns["L16"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L17"].VisibleIndex = -1; treeList1.Columns["L17"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L18"].VisibleIndex = -1; ////treeList1.Columns["L18"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["L19"].VisibleIndex = -1; ////treeList1.Columns["L19"].OptionsColumn.ShowInCustomizationForm = false; ////treeList1.Columns["Remark"].VisibleIndex = -1; ////treeList1.Columns["Remark"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; Application.DoEvents(); LoadValues(); TreeListColumn column = treeList1.Columns["L10"]; TreeListColumn column1 = treeList1.Columns["L12"]; for (int i = 0; i < treeList1.Nodes.Count; i++) { CalculateNodesValue(treeList1.Nodes[i], column, column1); } treeList1.ExpandAll(); } catch { } }
private bool SaveRemarkValue(string typeID, string value) { PSP_Project_List ppt = new PSP_Project_List(); ppt.ID = typeID; ppt.Flag2=typeFlag2; PSP_Project_List ps = Services.BaseService.GetOneByKey<PSP_Project_List>(ppt);//<PowerProTypes>(typeID); ps.Remark = value; try { Common.Services.BaseService.Update<PSP_Project_List>(ps); } catch (Exception ex) { MsgBox.Show("保存数据出错:" + ex.Message); return false; } return true; }
private bool SaveCellValue(string UID, string value) { PSP_Project_List PowerValues = new PSP_Project_List(); PowerValues.ID = UID; try { PowerValues = (PSP_Project_List)Common.Services.BaseService.GetObject("SelectPSP_PowerProValues_LangFangByID", PowerValues); PowerValues.L10 =double.Parse(value); Common.Services.BaseService.Update("UpdatePSP_Project_ListBy", PowerValues); } catch (Exception ex) { MsgBox.Show("保存数据出错:" + ex.Message); return false; } return true; }
private void InsertLineData1() { PowerEachList pel = this.ctrlPowerEachList1.FocusedObject; bool bl = true; string parentid = ""; string id = ""; string flag2 = ""; TreeListNode tln = treeList1.FocusedNode; //if (tln != null) //{ // bl = false; // try // { // parentid = tln["ParentID"].ToString(); // id = tln["ID"].ToString(); // flag2 = tln["Flag2"].ToString(); // } // catch // { } //} //else // { id = "0"; flag2 = pel.UID; //} PSP_Project_List z = new PSP_Project_List(); PowerProYears h = new PowerProYears(); PowerProValues j = new PowerProValues(); object obj = Services.BaseService.GetObject("SelectPowerProTypesList", ""); try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel文件(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); for (int i = 1; i < dts.Rows.Count; i++) { if (dts.Rows[i][1].ToString().IndexOf("合计") >= 0) continue; z.ID = Guid.NewGuid().ToString(); string strflag = ""; foreach (DataColumn dc in dts.Columns) { strflag = dc.Caption.ToString(); try { switch (strflag) { ////case "项目名称": //// z.Title = dts.Rows[i][dc.ColumnName].ToString(); //// break; case "区域": z.L1 = dts.Rows[i][dc.ColumnName].ToString(); break; case "建设性质": z.L2 = dts.Rows[i][dc.ColumnName].ToString(); break; case "项目名称": z.L3 = dts.Rows[i][dc.ColumnName].ToString(); break; case "电压等级": z.L4 = dts.Rows[i][dc.ColumnName].ToString(); break; case "主变台数": z.L5 = dts.Rows[i][dc.ColumnName].ToString(); break; case "单台容量(MVA)": z.L6 = dts.Rows[i][dc.ColumnName].ToString(); break; case "总容量(MVA)": z.IsConn = dts.Rows[i][dc.ColumnName].ToString(); break; case "建设形式": z.L7 = dts.Rows[i][dc.ColumnName].ToString(); break; case "线路长度(KM)": z.L8 = dts.Rows[i][dc.ColumnName].ToString(); break; case "导线型号": z.L9 = dts.Rows[i][dc.ColumnName].ToString(); break; //case "投资造价": // z.L11 = dts.Rows[i][dc.ColumnName].ToString(); // break; //case "造价比例": // z.L12 = dts.Rows[i][dc.ColumnName].ToString(); // break; case "标准造价(万元)": z.L10 =double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "造价调整(万元)": z.L11 = dts.Rows[i][dc.ColumnName].ToString(); break; case "工程总价(万元)": z.L12 = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); break; case "投产年限": z.L15 = dts.Rows[i][dc.ColumnName].ToString(); break; default: ////j.Value = dts.Rows[i][dc.ColumnName].ToString(); ////j.TypeID = z.ID; ////j.Year = dc.ColumnName; ////j.TypeID1 = flag2; ////Services.BaseService.Update<PowerProValues>(j); break; } } catch { } } z.Flag2 = flag2; z.ParentID = "0"; //z.Flag = 1; PSP_Project_List lf = (PSP_Project_List)Services.BaseService.GetObject("SelectPSP_Project_ListByObject", z); if (lf == null) { Services.BaseService.Create<PSP_Project_List>(z); } else { z.Code = lf.Code; z.Flag = lf.Flag; Services.BaseService.Update("UpdatePSP_Project_ListBytable", z); } } } ReLoadData(); } catch { MsgBox.Show("导入格式不正确!"); } }
private void FormAddInfo_LangFang_Load(object sender, EventArgs e) { if (isupdate == true) { PSP_Project_List ppt = new PSP_Project_List(); ppt.ID = poweruid; ppt.Flag2 = flag; //obj = (PSP_Project_List)Common.Services.BaseService.GetObject("SelectPSP_Project_ListByKey", ppt); obj = Common.Services.BaseService.GetOneByKey<PSP_Project_List>(ppt); OBJ = obj; powerid =obj.Code; if (OBJ.Flag == 2) { OBJ.L19 = "变电站"; } else { OBJ.L19 = "线路"; } isupdate = true; UpDateInit(); IList<PSP_Project_List> list = new List<PSP_Project_List>(); list.Add(OBJ); this.vGridControl1.DataSource = list; } if (isupdate == false) { OBJ.ID = Guid.NewGuid().ToString(); OBJ.CreateTime = DateTime.Now; OBJ.UpdateTime = DateTime.Now; OBJ.ParentID = parentID; OBJ.Flag2 = flag; OBJ.Flag = 2; OBJ.L4 = "220"; OBJ.L5 = "1"; OBJ.L7 = "户内站"; OBJ.L11= "0"; OBJ.L12 = 0; OBJ.L10 = 0; OBJ.L19 = "变电站"; CreateInit(); IList<PSP_Project_List> list = new List<PSP_Project_List>(); list.Add(OBJ); this.vGridControl1.DataSource = list; } this.电压等级.Properties.RowEdit.Click += new EventHandler(RowEdit_Click); this.类型.Properties.RowEdit.EditValueChanged += new EventHandler(RowEdit_EditValueChanged); LineInfo li22 = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid); if (li22 != null || OBJ.Flag == 1) { isline = true; } substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid); if (sb != null || OBJ.Flag == 2) { isPower = true; } }