/// <summary> /// ������·����� /// </summary> /// <param name="DY">��ѹ</param> /// <param name="LineLong">��·���ȣ�KM��</param> /// <param name="LineType">�����ͺ�</param> /// <returns>������·���</returns> public static double ComputerLineMoney(int DY, double LineLong, string LineType) { double sumvalueLine = 0; Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = DY.ToString(); ps.L1 = LineType; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue2", ps); if (sum.Count == 1) { foreach (Project_Sum pp in sum) { if (pp.Num.ToString() == null || pp.Num.ToString() == "") pp.Num = 0; sumvalueLine = pp.Num * LineLong; } } return sumvalueLine; }
//重新计算造价 private void UpdataLoadDatadata() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Nodes.Clear(); } ddd = DateTime.Now; sss += " 10:" + ddd.ToString(); PSP_PowerProValues_LangFang psp_Type = new PSP_PowerProValues_LangFang(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPSP_PowerProValues_LangFangByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } ddd = DateTime.Now; sss += " 11:" + ddd.ToString(); Project_Sum ps = new Project_Sum(); ps.S5 = "1"; IList<Project_Sum> sumline = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); ps.S5 = "2"; IList<Project_Sum> sumsubsation = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); Hashtable ha = new Hashtable(); ArrayList al = new ArrayList(); foreach (PSP_PowerProValues_LangFang psplf in listTypes) { if (psplf.Flag == 1)//纯线路造价计算 { if (psplf.L8 == "" || psplf.L8 == null) { psplf.L8 = "0"; } foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; psplf.L10 =Math.Round(psum.Num * double.Parse(psplf.L8),2); if (psplf.L11 == "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 = Math.Round(psplf.L10 + double.Parse(psplf.L11), 2); break; } } } if (psplf.Flag == 2) { ha.Clear(); al.Clear(); double sumvaluedata = 0; double sumvalueLine = 0; if (psplf.L6 != "" && psplf.L6 != null && psplf.L5 != "" && psplf.L5 != null)//变电站内的电站造价计算 { foreach (Project_Sum psum in sumsubsation) { if (psum.S1 == psplf.L4) { try { double mva = double.Parse(psplf.IsConn.ToString()); double t5 = Convert.ToDouble(psum.T5);//单台容量 int ta = Convert.ToInt32(psum.T1);//主变台数 if (mva == (t5 * ta)) { ha.Add(t5, ta); al.Add(t5); } } catch { } if (al.Count >0) { double va = Convert.ToDouble(al[0].ToString()); for (int ii = 0; ii < al.Count; ii++) { if (va < Convert.ToDouble(al[ii].ToString())) va = Convert.ToDouble(al[ii].ToString()); } psplf.L5 = ha[va].ToString(); psplf.L6 = va.ToString(); } else { psplf.L5 = ""; psplf.L6 = ""; } } } foreach (Project_Sum psum in sumsubsation) { if (psum.T1 == psplf.L5 && psum.T5 == psplf.L6 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvaluedata = psum.Num; break; } } } if (psplf.L8 != "" && psplf.L8 != null)//变电站内的线路造价计算 { foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvalueLine = psum.Num * double.Parse(psplf.L8); break; } } } psplf.L10 =Math.Round(sumvaluedata + sumvalueLine,2); if (psplf.L11== "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 =Math.Round(psplf.L10 + double.Parse(psplf.L11),2); Services.BaseService.Update("UpdatePSP_PowerProValues_LangFangByid",psplf); } } ddd = DateTime.Now; sss += " 12:" + ddd.ToString();//测试运算时间,可删除 sss += " 13:" + ddd.ToString();//测试运算时间,可删除 dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PSP_PowerProValues_LangFang)); treeList1.DataSource = dataTable; treeList1.Columns["L3"].Caption = "工程名称"; treeList1.Columns["L3"].Width = 80; treeList1.Columns["L3"].OptionsColumn.AllowEdit = false; treeList1.Columns["L3"].OptionsColumn.AllowSort = false; treeList1.Columns["Title"].VisibleIndex = -1; treeList1.Columns["Title"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag"].VisibleIndex = -1; treeList1.Columns["Flag"].SortOrder = System.Windows.Forms.SortOrder.None; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].VisibleIndex = -1; treeList1.Columns["CreateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].SortOrder = System.Windows.Forms.SortOrder.None; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Code"].VisibleIndex = -1; treeList1.Columns["Code"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L1"].VisibleIndex = -1; treeList1.Columns["L1"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L2"].VisibleIndex = -1; treeList1.Columns["L2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L11"].VisibleIndex = -1; treeList1.Columns["L11"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L12"].VisibleIndex = -1; treeList1.Columns["L12"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L13"].VisibleIndex = -1; treeList1.Columns["L13"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L14"].VisibleIndex = -1; treeList1.Columns["L14"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L15"].VisibleIndex = -1; treeList1.Columns["L15"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L16"].VisibleIndex = -1; treeList1.Columns["L16"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L17"].VisibleIndex = -1; treeList1.Columns["L17"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L18"].VisibleIndex = -1; treeList1.Columns["L18"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L19"].VisibleIndex = -1; treeList1.Columns["L19"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Remark"].VisibleIndex = -1; treeList1.Columns["Remark"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; Application.DoEvents(); LoadValues(); TreeListColumn column = treeList1.Columns["L10"]; TreeListColumn column1 = treeList1.Columns["L12"]; for (int i = 0; i < treeList1.Nodes.Count; i++) { CalculateNodesValue(treeList1.Nodes[i], column, column1); } treeList1.ExpandAll(); } catch { } }
private void LoadDatadata() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Nodes.Clear(); } ddd = DateTime.Now; sss += " 10:" + ddd.ToString(); PSP_PowerProValues_LangFang psp_Type = new PSP_PowerProValues_LangFang(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPSP_PowerProValues_LangFangByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } ddd = DateTime.Now; sss += " 11:" + ddd.ToString(); Project_Sum ps = new Project_Sum(); ps.S5 = "1"; IList<Project_Sum> sumline = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); ps.S5 = "2"; IList<Project_Sum> sumsubsation = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS5", ps); foreach (PSP_PowerProValues_LangFang psplf in listTypes) { if (psplf.Flag == 1)//纯线路造价计算 { if (psplf.L8 == "" || psplf.L8 == null) { psplf.L8 = "0"; } foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; psplf.L10 = Math.Round(psum.Num * double.Parse(psplf.L8), 2); if (psplf.L11 == "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 = Math.Round(psplf.L10 + double.Parse(psplf.L11), 2); break; } } } if (psplf.Flag == 2) { double sumvaluedata = 0; double sumvalueLine = 0; if (psplf.L6 != "" && psplf.L6 != null && psplf.L5 != "" && psplf.L5 != null)//变电站内的电站造价计算 { foreach (Project_Sum psum in sumsubsation) { if (psum.T1 == psplf.L5 && psum.T5 == psplf.L6 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvaluedata = psum.Num; break; } } } if (psplf.L8 != "" && psplf.L8 != null)//变电站内的线路造价计算 { foreach (Project_Sum psum in sumline) { if (psum.L1 == psplf.L9 && psum.S1 == psplf.L4) { if (psum.Num.ToString() == null || psum.Num.ToString() == "") psum.Num = 0; sumvalueLine = psum.Num * double.Parse(psplf.L8); break; } } } psplf.L10 = Math.Round(sumvaluedata + sumvalueLine, 2); if (psplf.L11 == "" || psplf.L11 == null) { psplf.L11 = "0"; } psplf.L12 = Math.Round(psplf.L10 + double.Parse(psplf.L11), 2); } } ddd = DateTime.Now; sss += " 12:" + ddd.ToString();//测试运算时间,可删除 sss += " 13:" + ddd.ToString();//测试运算时间,可删除 dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PSP_PowerProValues_LangFang)); //dataTable.DefaultView.Sort = "L4 desc"; //dataTable.DefaultView.Sort = "Title desc"; //dataTable.DefaultView.Sort = "CreateTime desc"; ////foreach (DataRow rw in dataTable.Rows) ////{ //// string ss = rw["Code"].ToString(); //// LineInfo li = Common.Services.BaseService.GetOneByKey<LineInfo>(ss); ////if (li != null && li.EleID != "") ////{ //// rw["L3"] = li.LineName; //// rw["L8"] = li.Length; //// rw["L9"] = li.LineType; ////} ////substation li1 = Common.Services.BaseService.GetOneByKey<substation>(ss); ////if (li1 != null && li1.EleID != "") ////{ //// rw["L3"] = li1.EleName; //// //rw["L5"] = li1.ObligateField2; //// //rw["L2"] = li1.Number; //// //rw["L6"] = li1.Burthen; ////} ////} treeList1.DataSource = dataTable; treeList1.Columns["L3"].Caption = "工程名称"; treeList1.Columns["L3"].Width = 80; treeList1.Columns["L3"].OptionsColumn.AllowEdit = false; treeList1.Columns["L3"].OptionsColumn.AllowSort = false; treeList1.Columns["Title"].VisibleIndex = -1; treeList1.Columns["Title"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag"].VisibleIndex = -1; treeList1.Columns["Flag"].SortOrder = System.Windows.Forms.SortOrder.None; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].VisibleIndex = -1; treeList1.Columns["CreateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreateTime"].SortOrder = System.Windows.Forms.SortOrder.None; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["UpdateTime"].VisibleIndex = -1; treeList1.Columns["UpdateTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Code"].VisibleIndex = -1; treeList1.Columns["Code"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L1"].VisibleIndex = -1; treeList1.Columns["L1"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L2"].VisibleIndex = -1; treeList1.Columns["L2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L11"].VisibleIndex = -1; treeList1.Columns["L11"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L12"].VisibleIndex = -1; treeList1.Columns["L12"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L13"].VisibleIndex = -1; treeList1.Columns["L13"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L14"].VisibleIndex = -1; treeList1.Columns["L14"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L15"].VisibleIndex = -1; treeList1.Columns["L15"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L16"].VisibleIndex = -1; treeList1.Columns["L16"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L17"].VisibleIndex = -1; treeList1.Columns["L17"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L18"].VisibleIndex = -1; treeList1.Columns["L18"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["L19"].VisibleIndex = -1; treeList1.Columns["L19"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Remark"].VisibleIndex = -1; treeList1.Columns["Remark"].OptionsColumn.ShowInCustomizationForm = false; AddColumn2(); PowerProYears psp_Year = new PowerProYears(); psp_Year.Flag = typeFlag2; Application.DoEvents(); LoadValues(); TreeListColumn column = treeList1.Columns["L10"]; TreeListColumn column1 = treeList1.Columns["L12"]; for (int i = 0; i < treeList1.Nodes.Count; i++) { CalculateNodesValue(treeList1.Nodes[i], column, column1); } treeList1.ExpandAll(); } catch { } }
private void UpDateInit() { double sumvalue = 0; if (OBJ.L4 == "220") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "220"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "220"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "110") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "110"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "110"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "35") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "35"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "35"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "66") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "66"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "66"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "500") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "500"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "500"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.Flag == 2)//主变台数 { this.repositoryItemComboBox5.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { string str = "S5='" + OBJ.Flag + "'and S1='" + OBJ.L4 + "'and T1 like '" + OBJ.L5 + "%'" + "and T5 ='" + OBJ.L6 + "'and Type ='" + OBJ.L7 +"'"; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByValues", str); foreach (Project_Sum li in sum) { this.repositoryItemComboBox5.Items.Add(li.T1); } } } if (OBJ.Flag == 2) { this.repositoryItemComboBox6.Items.Clear(); if (OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type = OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox6.Items.Add(li.T2); } } } if (OBJ.Flag == 2) { this.repositoryItemComboBox7.Items.Clear(); if (OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.T2 = OBJ.L2; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type = OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue1", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox7.Items.Add(li.T3); } } } if (OBJ.Flag == 2) { this.repositoryItemComboBox8.Items.Clear(); if (OBJ.L13 != null && OBJ.L13 != "" && OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.T2 = OBJ.L2; ps.T3 = OBJ.L13; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type = OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue2", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox8.Items.Add(li.T4); } } } if (OBJ.Flag == 2)//变电站下的线路 { this.repositoryItemComboBox11.Items.Clear(); if ( OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9!= null && OBJ.L9 != "" ) { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox11.Items.Add(li.L1); } } this.repositoryItemComboBox12.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "" && OBJ.L15 != null && OBJ.L15 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; ps.L2 = OBJ.L15; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue1", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox12.Items.Add(li.L1); } } } if (OBJ.Flag == 1)//线路信息 { this.repositoryItemComboBox11.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox11.Items.Add(li.L1); } } this.repositoryItemComboBox12.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "" && OBJ.L15 != null && OBJ.L15 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; ps.L2 = OBJ.L15; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue1", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox12.Items.Add(li.L1); } } } if (OBJ.Flag == 1) { OBJ.L1 = ""; OBJ.L2 = ""; OBJ.L13 = ""; OBJ.L14 = ""; this.categoryRow1.Visible = true; this.建设形式.Enabled = false; this.单台容量.Enabled = false; this.主变台数.Enabled = false; this.出线规模.Enabled = false; this.接线形式.Enabled = false; this.无功配置.Enabled = false; this.主变台数及容量.Enabled = false; } if (OBJ.Flag == 2) { this.categoryRow1.Visible = true; this.建设形式.Enabled = true; this.单台容量.Enabled = true; this.主变台数.Enabled = true; this.出线规模.Enabled = true; this.接线形式.Enabled = true; this.无功配置.Enabled = true; this.主变台数及容量.Enabled = true; } }
private void vGridControl1_CellValueChanged(object sender, DevExpress.XtraVerticalGrid.Events.CellValueChangedEventArgs e) { repositoryItemComboBox3.Items.Clear(); this.repositoryItemComboBox10.Items.Clear(); if (e.Row.Properties.FieldName.ToString() == "Flag" || e.Row.Properties.FieldName.ToString() == "L4" || e.Row.Properties.FieldName.ToString() == "L7") { if (OBJ.L4 == "220") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "220"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "220"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "110") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "110"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "110"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "35") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "35"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "35"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "66") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "66"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "66"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "500") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "500"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "500"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } } if (e.Row.Properties.FieldName.ToString() == "Flag") { OBJ.Flag =int.Parse(e.Value.ToString()); if (OBJ.Flag == 1) { OBJ.L1 = ""; OBJ.L2 = ""; OBJ.L13 = ""; OBJ.L14 = ""; this.categoryRow1.Visible = true; this.建设形式.Enabled = false; this.单台容量.Enabled = false; this.主变台数.Enabled = false; this.出线规模.Enabled = false; this.接线形式.Enabled = false; this.无功配置.Enabled = false; this.主变台数及容量.Enabled = false; } if (OBJ.Flag == 2) { this.categoryRow1.Visible = true; this.建设形式.Enabled = true; this.单台容量.Enabled = true; this.主变台数.Enabled = true; this.出线规模.Enabled = true; this.接线形式.Enabled = true; this.无功配置.Enabled = true; this.主变台数及容量.Enabled = true; } } if (e.Row.Properties.FieldName.ToString() == "L6") { if (OBJ.Flag == 2) { this.repositoryItemComboBox5.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { string str = "S5=" + OBJ.Flag + "and S1=" + OBJ.L4 + "and T1 like '" + OBJ.L5 + "%'" + "and T5 =" + OBJ.L6 + "and Type =" + OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByValues", str); if (OBJ.L11 == null || OBJ.L11 == "") OBJ.L11 = "0"; if (sum.Count == 0) { OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } if (sum.Count == 1) { foreach (Project_Sum pp in sum) OBJ.L11 = Convert.ToString(pp.Num + int.Parse(OBJ.L11)); OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } foreach (Project_Sum li in sum) { this.repositoryItemComboBox5.Items.Add(li.T1); } } } } if (e.Row.Properties.FieldName.ToString() == "L1") { if (OBJ.Flag == 2) { this.repositoryItemComboBox6.Items.Clear(); if (OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != ""&& OBJ.L7 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type=OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue", ps); if (OBJ.L11 == null || OBJ.L11 == "") OBJ.L11 = "0"; if (sum.Count == 0) { OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } //if (sum.Count == 1) //{ // foreach (Project_Sum pp in sum) // OBJ.L11 = Convert.ToString(pp.Num + int.Parse(OBJ.L11)); // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); //} foreach (Project_Sum li in sum) { this.repositoryItemComboBox6.Items.Add(li.T2); } } } return; } if (e.Row.Properties.FieldName.ToString() == "L2") { if (OBJ.Flag == 2) { this.repositoryItemComboBox7.Items.Clear(); if (OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.T2 = OBJ.L2; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type=OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue1", ps); if (OBJ.L11 == null || OBJ.L11 == "") OBJ.L11 = "0"; if (sum.Count == 0) { OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } //if (sum.Count == 1) //{ // foreach (Project_Sum pp in sum) // OBJ.L11 = Convert.ToString(pp.Num + int.Parse(OBJ.L11)); // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); //} foreach (Project_Sum li in sum) { this.repositoryItemComboBox7.Items.Add(li.T3); } } } return; } if (e.Row.Properties.FieldName.ToString() == "L13") { if (OBJ.Flag == 2) { this.repositoryItemComboBox8.Items.Clear(); if (OBJ.L13 != null && OBJ.L13 != "" && OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.T2 = OBJ.L2; ps.T3 = OBJ.L13; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type=OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue2", ps); if (OBJ.L11 == null || OBJ.L11 == "") OBJ.L11 = "0"; if (sum.Count == 0) { OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } //if (sum.Count == 1) //{ // foreach (Project_Sum pp in sum) // OBJ.L11 = Convert.ToString(pp.Num + int.Parse(OBJ.L11)); // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); //} foreach (Project_Sum li in sum) { this.repositoryItemComboBox8.Items.Add(li.T4);//暂时没有确定字段 } } } return; } if (e.Row.Properties.FieldName.ToString() == "L7")//建设形式 { if (OBJ.Flag == 2) { this.repositoryItemComboBox3.Items.Clear(); if (OBJ.L13 != null && OBJ.L13 != "" && OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.Type=OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalueL7", ps); if (OBJ.L11 == null || OBJ.L11 == "") OBJ.L11 = "0"; if (sum.Count == 0) { OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } //if (sum.Count == 1) //{ // foreach (Project_Sum pp in sum) // OBJ.L11 = Convert.ToString(pp.Num + int.Parse(OBJ.L11)); // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); //} foreach (Project_Sum li in sum) { this.repositoryItemComboBox3.Items.Add(li.T4);//暂时没有确定字段 } } } return; } if (e.Row.Properties.FieldName.ToString() == "L9") { this.repositoryItemComboBox11.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox11.Items.Add(li.L1); } } } if (e.Row.Properties.FieldName.ToString() == "L15") { this.repositoryItemComboBox12.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "" && OBJ.L15 != null && OBJ.L15 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; ps.L2 = OBJ.L15; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue1", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox12.Items.Add(li.L1); } } } if (e.Row.Properties.FieldName.ToString() == "Flag" || e.Row.Properties.FieldName.ToString() == "L4" || e.Row.Properties.FieldName.ToString() == "L8" || e.Row.Properties.FieldName.ToString() == "L9" || e.Row.Properties.FieldName.ToString() == "L15" || e.Row.Properties.FieldName.ToString() == "L16") { if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "" && OBJ.L15 != null && OBJ.L15 != "")//变电站下的线路,线路信息 { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; ps.L2 = OBJ.L15; ps.L3 = OBJ.L16; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue2", ps); if (sum.Count == 1) { if (OBJ.L8 == null || OBJ.L8 == "") OBJ.L8 = "0"; foreach (Project_Sum pp in sum) { if (pp.Num.ToString() == null || pp.Num.ToString() == "") pp.Num = 0; sumvalueLine = pp.Num * double.Parse(OBJ.L8); } OBJ.L11 = Convert.ToString(sumvalueLine + sumvaluedata); OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } } } if (e.Row.Properties.FieldName.ToString() == "Flag" || e.Row.Properties.FieldName.ToString() == "L4" || e.Row.Properties.FieldName.ToString() == "L5" || e.Row.Properties.FieldName.ToString() == "L6" || e.Row.Properties.FieldName.ToString() == "L7" || e.Row.Properties.FieldName.ToString() == "L1" || e.Row.Properties.FieldName.ToString() == "L2" || e.Row.Properties.FieldName.ToString() == "L13" || e.Row.Properties.FieldName.ToString() == "L14") { if (OBJ.Flag == 2)//计算最终造价 { if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.T2 = OBJ.L2; //ps.T3 = OBJ.L13; //ps.T4 = OBJ.L14; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type = OBJ.L7; Project_Sum sum = (Project_Sum)Common.Services.BaseService.GetObject("SelectProject_SumByvalue3", ps); if (OBJ.L11 == null || OBJ.L11 == "") OBJ.L11 = "0"; if (sum == null) { OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } if (sum != null) { sumvaluedata = sum.Num; OBJ.L11 = Convert.ToString(sum.Num + sumvalueLine); OBJ.L10 =double.Parse(OBJ.L11) * OBJ.L12; } } } } if (e.Row.Properties.FieldName.ToString() == "L11") { OBJ.L11 = e.Value.ToString(); if (OBJ.L11 != null && OBJ.L11 != "" && OBJ.L12 != null && OBJ.L12.ToString() != "") OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } if (e.Row.Properties.FieldName.ToString() == "L12") { OBJ.L12 =double.Parse(e.Value.ToString()); if (OBJ.L11 != null && OBJ.L11 != "" && OBJ.L12 != null && OBJ.L12.ToString() != "") OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } this.vGridControl1.Refresh(); return; }
private void CreateInit() { double sumvalue = 0; OBJ.L11 = "0"; if (OBJ.L4 == "220") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "220"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5!="") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } if (this.repositoryItemComboBox3.Items.Count > 0) { OBJ.L6 = this.repositoryItemComboBox3.Items[0].ToString(); } } pjt.S1 = "220"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } if (this.repositoryItemComboBox10.Items.Count > 0) { OBJ.L9 = this.repositoryItemComboBox10.Items[0].ToString(); } } if (OBJ.L4 == "110") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "110"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } if (this.repositoryItemComboBox3.Items.Count > 0) { OBJ.L6 = this.repositoryItemComboBox3.Items[0].ToString(); } } pjt.S1 = "110"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } if (this.repositoryItemComboBox10.Items.Count > 0) { OBJ.L9 = this.repositoryItemComboBox10.Items[0].ToString(); } } if (OBJ.L4 == "35") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "35"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } if (this.repositoryItemComboBox3.Items.Count > 0) { OBJ.L6 = this.repositoryItemComboBox3.Items[0].ToString(); } } pjt.S1 = "35"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } if (this.repositoryItemComboBox10.Items.Count > 0) { OBJ.L9 = this.repositoryItemComboBox10.Items[0].ToString(); } } if (OBJ.L4 == "66") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "66"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } if (this.repositoryItemComboBox3.Items.Count > 0) { OBJ.L6 = this.repositoryItemComboBox3.Items[0].ToString(); } } pjt.S1 = "66"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } if (this.repositoryItemComboBox10.Items.Count > 0) { OBJ.L9 = this.repositoryItemComboBox10.Items[0].ToString(); } } if (OBJ.L4 == "500") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "500"; pjt.S5 = "2"; pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5andType", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } if (this.repositoryItemComboBox3.Items.Count > 0) { OBJ.L6 = this.repositoryItemComboBox3.Items[0].ToString(); } } pjt.S1 = "500"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } if (this.repositoryItemComboBox10.Items.Count > 0) { OBJ.L9 = this.repositoryItemComboBox10.Items[0].ToString(); } } if (OBJ.Flag == 2)//主变台数 { this.repositoryItemComboBox5.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { string str = "S5='" + OBJ.Flag + "' and S1 = '" + OBJ.L4 + "' and T5 = '" + OBJ.L6 + "' and Type = '" + OBJ.L7 + "' and T1 like '" + OBJ.L5 + "%" +"'"; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByValues", str); if (sum.Count == 0) { if (isupdate == false) OBJ.L11 = "0"; OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } foreach (Project_Sum li in sum) { this.repositoryItemComboBox5.Items.Add(li.T1); } if (sum.Count > 0) { OBJ.L1 = this.repositoryItemComboBox5.Items[0].ToString(); } } } if (OBJ.Flag == 2) { this.repositoryItemComboBox6.Items.Clear(); if (OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type = OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue", ps); if (sum.Count == 0) { OBJ.L11 = "0"; if (OBJ.L11 != null && OBJ.L11 != "") OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } if (sum.Count == 1) { foreach (Project_Sum pp in sum) OBJ.L11 = pp.Num.ToString(); if (OBJ.L11 != null && OBJ.L11 != "") OBJ.L10 =double.Parse(OBJ.L11) * OBJ.L12; else { OBJ.L11 = "0"; OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } } foreach (Project_Sum li in sum) { this.repositoryItemComboBox6.Items.Add(li.T2); } if (sum.Count > 0) { OBJ.L2 = this.repositoryItemComboBox6.Items[0].ToString(); } } } if (OBJ.Flag == 2) { this.repositoryItemComboBox7.Items.Clear(); if (OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.T2 = OBJ.L2; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type = OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue1", ps); if (sum.Count == 0) { OBJ.L11 = "0"; if (OBJ.L11 != null && OBJ.L11 != "") OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } if (sum.Count == 1) { foreach (Project_Sum pp in sum) OBJ.L11 = pp.Num.ToString(); if (OBJ.L11 != null && OBJ.L11 != "") OBJ.L10 =double.Parse(OBJ.L11) * OBJ.L12; else { OBJ.L11 = "0"; OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } } foreach (Project_Sum li in sum) { this.repositoryItemComboBox7.Items.Add(li.T3); } if (sum.Count > 0) { OBJ.L13 = this.repositoryItemComboBox7.Items[0].ToString(); } } } if (OBJ.Flag == 2) { this.repositoryItemComboBox8.Items.Clear(); if (OBJ.L13 != null && OBJ.L13 != "" && OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.T2 = OBJ.L2; ps.T3 = OBJ.L13; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type = OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue2", ps); if (sum.Count == 0) { OBJ.L11 = "0"; if (OBJ.L11 != null && OBJ.L11 != "") OBJ.L10 =double.Parse(OBJ.L11) * OBJ.L12; } if (sum.Count == 1) { foreach (Project_Sum pp in sum) OBJ.L11 = pp.Num.ToString(); if (OBJ.L11 != null && OBJ.L11 != "") OBJ.L10 =double.Parse(OBJ.L11) * OBJ.L12; else { OBJ.L11 = "0"; OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } } foreach (Project_Sum li in sum) { this.repositoryItemComboBox8.Items.Add(li.T4); } if (sum.Count > 0) { OBJ.L14 = this.repositoryItemComboBox8.Items[0].ToString(); } } } if (OBJ.L14 != null && OBJ.L14 != "" && OBJ.L13 != null && OBJ.L13 != "" && OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L1; ps.T2 = OBJ.L2; ps.T3 = OBJ.L13; ps.T4 = OBJ.L14; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; ps.Type = OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue3", ps); if (sum.Count == 0) { OBJ.L11 = "0"; if (OBJ.L11 != null && OBJ.L11 != "") OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } if (sum.Count == 1) { foreach (Project_Sum pp in sum) { OBJ.L11 = pp.Num.ToString(); sumvaluedata = pp.Num; } if (OBJ.L11 != null && OBJ.L11 != "") OBJ.L10 =double.Parse(OBJ.L11) * OBJ.L12; else { OBJ.L11 = "0"; OBJ.L10 =double.Parse(OBJ.L11) * OBJ.L12; } } } if (OBJ.Flag == 2)//变电站下的线路 { this.repositoryItemComboBox11.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox11.Items.Add(li.L2); } if (sum.Count > 0) { OBJ.L15 = this.repositoryItemComboBox11.Items[0].ToString(); } } this.repositoryItemComboBox12.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "" && OBJ.L15 != null && OBJ.L15 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; ps.L2 = OBJ.L15; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue1", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox12.Items.Add(li.L3); } if (sum.Count > 0) { OBJ.L16 = this.repositoryItemComboBox12.Items[0].ToString(); } } if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "" && OBJ.L15 != null && OBJ.L15 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; ps.L2 = OBJ.L15; ps.L3 = OBJ.L16; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue2", ps); if (OBJ.L8 == null || OBJ.L8 == "") OBJ.L8 = "0"; if (sum.Count == 1) { foreach (Project_Sum pp in sum) { if (pp.Num.ToString() == null || pp.Num.ToString() == "") pp.Num = 0; sumvalue = pp.Num * double.Parse(OBJ.L8); } OBJ.L11 = Convert.ToString(sumvalue + double.Parse(OBJ.L11)); OBJ.L10 = double.Parse(OBJ.L11) * OBJ.L12; } } } if (OBJ.Flag == 1)//线路信息 { this.repositoryItemComboBox11.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue", ps); //if (sum.Count == 0) //{ // OBJ.L11 = "0"; // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); //} //if (sum.Count == 1) //{ // foreach (Project_Sum pp in sum) // OBJ.L11 = pp.Num.ToString(); // if (OBJ.L11 != null && OBJ.L11 != "") // { // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); // } // else // { // OBJ.L11 = "0"; // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); // } // } foreach (Project_Sum li in sum) { this.repositoryItemComboBox11.Items.Add(li.L2); } if (sum.Count > 0) { OBJ.L15 = this.repositoryItemComboBox11.Items[0].ToString(); } } this.repositoryItemComboBox12.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "" && OBJ.L15 != null && OBJ.L15 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; ps.L2 = OBJ.L15; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue1", ps); //if (sum.Count == 0) //{ // OBJ.L11 = "0"; // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); //} //if (sum.Count == 1) //{ // foreach (Project_Sum pp in sum) // OBJ.L11 = pp.Num.ToString(); // if (OBJ.L11 != null && OBJ.L11 != "") // { // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); // } // else // { // OBJ.L11 = "0"; // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); // } //} foreach (Project_Sum li in sum) { this.repositoryItemComboBox12.Items.Add(li.L3); } if (sum.Count > 0) { OBJ.L16 = this.repositoryItemComboBox12.Items[0].ToString(); } } OBJ.L8 = "0"; OBJ.L11 = "0"; OBJ.L10 = 0; //if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "" && OBJ.L15 != null && OBJ.L15 != "") //{ // Project_Sum ps = new Project_Sum(); // ps.S5 = "1"; // ps.S1 = OBJ.L4; // ps.L1 = OBJ.L9; // ps.L2 = OBJ.L15; // ps.L3 = OBJ.L16; // IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue2", ps); // if (sum.Count == 0) // { // OBJ.L11 = "0"; // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); // } // if (sum.Count == 1) // { // foreach (Project_Sum pp in sum) // OBJ.L11 = pp.Num.ToString(); // if (OBJ.L11 != null && OBJ.L11 != "") // { // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); // } // else // { // OBJ.L11 = "0"; // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * OBJ.L12); // } // } //} } if (OBJ.Flag == 1) { OBJ.L1 = ""; OBJ.L2 = ""; OBJ.L13 = ""; OBJ.L14 = ""; this.categoryRow1.Visible = true; this.建设形式.Enabled = false; this.单台容量.Enabled = false; this.主变台数.Enabled = false; this.出线规模.Enabled = false; this.接线形式.Enabled = false; this.无功配置.Enabled = false; this.主变台数及容量.Enabled = false; } if (OBJ.Flag == 2) { this.categoryRow1.Visible = true; this.建设形式.Enabled = true; this.单台容量.Enabled = true; this.主变台数.Enabled = true; this.出线规模.Enabled = true; this.接线形式.Enabled = true; this.无功配置.Enabled = true; this.主变台数及容量.Enabled = true; } }
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 vGridControl1_CellValueChanged(object sender, DevExpress.XtraVerticalGrid.Events.CellValueChangedEventArgs e) { if (e.Row.Properties.FieldName.ToString() == "L19" || e.Row.Properties.FieldName.ToString() == "L4" ) { repositoryItemComboBox3.Items.Clear(); this.repositoryItemComboBox10.Items.Clear(); if (OBJ.L4 == "220") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "220"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "220"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "110") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "110"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "110"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "35") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "35"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "35"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "66") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "66"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "66"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "500") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "500"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "500"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } } if (e.Row.Properties.FieldName.ToString() == "L19") { Project_Sum pjt = new Project_Sum(); if (e.Value.ToString() == "变电站") { this.repositoryItemComboBox3.Items.Clear(); OBJ.Flag = 2; pjt.S1 = OBJ.L4; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } else { this.repositoryItemComboBox3.Items.Clear(); OBJ.Flag = 1; pjt.S1 = OBJ.L4; pjt.S5 = "1"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox10.Items.Contains(ps.T5)) { this.repositoryItemComboBox10.Items.Add(ps.T5); } } } if (OBJ.Flag == 1) { OBJ.L5 = ""; OBJ.L6 = ""; OBJ.L7 = ""; this.单台容量.Enabled = false; this.主变台数.Enabled = false; } if (OBJ.Flag == 2) { this.单台容量.Enabled = true; this.主变台数.Enabled = true; } } this.vGridControl1.Refresh(); return; }
/// <summary> /// �Ľ������ /// </summary> public void UpdateObject() { //��ȡ������� Project_Sum obj = FocusedObject; if (obj == null) { return; } //���������һ������ Project_Sum objCopy = new Project_Sum(); DataConverter.CopyTo<Project_Sum>(obj, objCopy); //ִ���IJ��� using (FrmProject_SumDialog dlg = new FrmProject_SumDialog()) { dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //�ø������½������ DataConverter.CopyTo<Project_Sum>(objCopy, obj); //ˢ�±�� gridControl.RefreshDataSource(); }
/// <summary> /// ��Ӷ��� /// </summary> public void AddObject() { //�����������Ƿ��Ѿ����� if (ObjectList == null) { return; } //�½����� Project_Sum obj = new Project_Sum(); obj.UID = Guid.NewGuid().ToString(); obj.S5 = type; //ִ����Ӳ��� using (FrmProject_SumDialog dlg = new FrmProject_SumDialog()) { dlg.IsCreate = true; //�����½���־ dlg.Object = obj; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //���¶�����뵽������ ObjectList.Add(obj); //ˢ�±���������ж�λ���¶����ϡ� gridControl.RefreshDataSource(); GridHelper.FocuseRow(this.gridView, obj); }
private void vGridControl1_CellValueChanged(object sender, DevExpress.XtraVerticalGrid.Events.CellValueChangedEventArgs e) { if (e.Row.Properties.FieldName.ToString() == "L19" || e.Row.Properties.FieldName.ToString() == "L4" ) { repositoryItemComboBox3.Items.Clear(); this.repositoryItemComboBox10.Items.Clear(); if (OBJ.L4 == "220") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "220"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "220"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "110") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "110"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "110"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "35") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "35"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "35"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "66") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "66"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "66"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "500") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "500"; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "500"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } } if (e.Row.Properties.FieldName.ToString() == "L19") { Project_Sum pjt = new Project_Sum(); if (e.Value.ToString() == "变电站") { this.repositoryItemComboBox3.Items.Clear(); OBJ.Flag = 2; pjt.S1 = OBJ.L4; pjt.S5 = "2"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } else { this.repositoryItemComboBox3.Items.Clear(); pjt.S1 = OBJ.L4; pjt.S5 = "1"; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox10.Items.Contains(ps.T5)) { this.repositoryItemComboBox10.Items.Add(ps.T5); } } OBJ.Flag = 1; } if (OBJ.Flag == 1) { OBJ.L5 = ""; OBJ.L6 = ""; OBJ.L7 = ""; // OBJ.L14 = ""; this.categoryRow1.Visible = true; this.建设形式.Enabled = false; this.单台容量.Enabled = false; this.主变台数.Enabled = false; this.出线规模.Enabled = false; this.接线形式.Enabled = false; this.无功配置.Enabled = false; this.主变台数及容量.Enabled = false; } if (OBJ.Flag == 2) { this.categoryRow1.Visible = true; this.建设形式.Enabled = true; this.单台容量.Enabled = true; this.主变台数.Enabled = true; this.出线规模.Enabled = true; this.接线形式.Enabled = true; this.无功配置.Enabled = true; this.主变台数及容量.Enabled = true; } } if (e.Row.Properties.FieldName.ToString() == "L5") { //////if (OBJ.Flag == 2) //////{ ////// OBJ.L5 = e.Value.ToString(); ////// ////double moneyvalue = FileClass.ComputerPowerMoney(int.Parse(OBJ.L4), int.Parse(OBJ.L5), double.Parse(OBJ.L6), 0, "", false); ////// ////OBJ.L10 = Convert.ToString(moneyvalue); ////// //if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") ////// //{ ////// string str = "S5='" + OBJ.Flag + "'and S1='" + OBJ.L4 + "'and T5 ='" + OBJ.L6 + "'"; ////// IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByValues", str); ////// if (OBJ.L11 == null || OBJ.L11 == "") ////// OBJ.L11 = "0"; ////// if (sum.Count == 0) ////// { ////// OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); ////// } ////// if (sum.Count == 1) ////// { ////// foreach (Project_Sum pp in sum) ////// // OBJ.L11 = Convert.ToString(pp.Num + int.Parse(OBJ.L11)); ////// //OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); ////// sumvaluedata =pp.Num * int.Parse(OBJ.L5); ////// } ////// //} //////} } if (e.Row.Properties.FieldName.ToString() == "L6") { //////if (OBJ.Flag == 2) //////{ ////// OBJ.L6 = e.Value.ToString(); ////// this.repositoryItemComboBox5.Items.Clear(); ////// ////double moneyvalue = FileClass.ComputerPowerMoney(int.Parse(OBJ.L4), int.Parse(OBJ.L5), double.Parse(OBJ.L6), 0, "", false); ////// ////OBJ.L10 = Convert.ToString(moneyvalue); ////// if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "" && OBJ.L7 != "") ////// { ////// string str = "S5='" + OBJ.Flag + "'and S1='" + OBJ.L4 + "'and T5 ='" + OBJ.L6 + "'"; ////// IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByValues", str); ////// if (OBJ.L11 == null || OBJ.L11 == "") ////// OBJ.L11 = "0"; ////// if (sum.Count == 0) ////// { ////// OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); ////// } ////// if (sum.Count == 1) ////// { ////// foreach (Project_Sum pp in sum) ////// //// OBJ.L11 = Convert.ToString(pp.Num + int.Parse(OBJ.L11)); ////// ////OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); ////// sumvaluedata = pp.Num * int.Parse(OBJ.L5); ////// } ////// foreach (Project_Sum li in sum) ////// { ////// this.repositoryItemComboBox5.Items.Add(li.T1); ////// } ////// } //////} } ////if (e.Row.Properties.FieldName.ToString() == "L7")//建设形式 //// { //// if (OBJ.Flag == 2) //// { //// this.repositoryItemComboBox3.Items.Clear(); //// if (OBJ.L13 != null && OBJ.L13 != "" && OBJ.L2 != null && OBJ.L2 != "" && OBJ.L1 != null && OBJ.L1 != "" && OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "") //// { //// Project_Sum ps = new Project_Sum(); //// ps.S5 = OBJ.Flag.ToString(); //// ps.S1 = OBJ.L4; //// ps.Type=OBJ.L7; //// IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalueL7", ps); //// if (OBJ.L11 == null || OBJ.L11 == "") //// OBJ.L11 = "0"; //// if (sum.Count == 0) //// { //// OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); //// } //// //if (sum.Count == 1) //// //{ //// // foreach (Project_Sum pp in sum) //// // OBJ.L11 = Convert.ToString(pp.Num + int.Parse(OBJ.L11)); //// // OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); //// //} //// foreach (Project_Sum li in sum) //// { //// this.repositoryItemComboBox3.Items.Add(li.T4);//暂时没有确定字段 //// } //// } //// } //// return; //// } if (e.Row.Properties.FieldName.ToString() == "L9") { this.repositoryItemComboBox11.Items.Clear(); if (OBJ.L4 != null && OBJ.L4 != "" && OBJ.L9 != null && OBJ.L9 != "") { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue", ps); foreach (Project_Sum li in sum) { this.repositoryItemComboBox11.Items.Add(li.L1); } } } if (e.Row.Properties.FieldName.ToString() == "L19" || e.Row.Properties.FieldName.ToString() == "L4" || e.Row.Properties.FieldName.ToString() == "L8" || e.Row.Properties.FieldName.ToString() == "L9" || e.Row.Properties.FieldName.ToString() == "L15" || e.Row.Properties.FieldName.ToString() == "L16") { if (OBJ.L4 != null)//变电站下的线路,线路信息 { Project_Sum ps = new Project_Sum(); ps.S5 = "1"; ps.S1 = OBJ.L4; ps.L1 = OBJ.L9; ////ps.L2 = OBJ.L15; ////ps.L3 = OBJ.L16; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue2", ps); if (sum.Count == 1) { if (OBJ.L8 == null || OBJ.L8 == "") OBJ.L8 = "0"; foreach (Project_Sum pp in sum) { if (pp.Num.ToString() == null || pp.Num.ToString() == "") pp.Num = 0; sumvalueLine = pp.Num * double.Parse(OBJ.L8); } //OBJ.L11 = Convert.ToString(sumvalueLine + sumvaluedata); //OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); } if (sum.Count == 0) { sumvalueLine = 0; } OBJ.L10 =sumvalueLine + sumvaluedata; } } if (e.Row.Properties.FieldName.ToString() == "L19" || e.Row.Properties.FieldName.ToString() == "L4" || e.Row.Properties.FieldName.ToString() == "L5" || e.Row.Properties.FieldName.ToString() == "L6") { if (OBJ.Flag == 2)//计算最终造价 { if ( OBJ.L4 != null && OBJ.L4 != "" && OBJ.L5 != null && OBJ.L5 != "" && OBJ.L6 != null && OBJ.L6 != "") { Project_Sum ps = new Project_Sum(); ps.T1 = OBJ.L5; //ps.T2 = OBJ.L2; //ps.T3 = OBJ.L13; //ps.T4 = OBJ.L14; ps.S5 = OBJ.Flag.ToString(); ps.S1 = OBJ.L4; ps.T5 = OBJ.L6; //ps.Type = OBJ.L7; Project_Sum sum = (Project_Sum)Common.Services.BaseService.GetObject("SelectProject_SumByvalue3", ps); //if (OBJ.L11 == null || OBJ.L11 == "") // OBJ.L11 = "0"; if (sum == null) { sumvaluedata = 0; //OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); } if (sum != null) { sumvaluedata = sum.Num; //OBJ.L11 = Convert.ToString(sumvaluedata + sumvalueLine); //OBJ.L10 = Convert.ToString(double.Parse(OBJ.L11) * double.Parse(OBJ.L12)); } OBJ.L10 =sumvaluedata + sumvalueLine; } } } //if (e.Row.Properties.FieldName.ToString() == "L10") //{ // OBJ.L11 = e.Value.ToString(); // if (OBJ.L11 != null && OBJ.L11 != "" && OBJ.L12 != null && OBJ.L12 != "") // OBJ.L10 = double.Parse(OBJ.L11) * double.Parse(OBJ.L12); //} if (e.Row.Properties.FieldName.ToString() == "L11") { OBJ.L11 = e.Value.ToString(); } if (OBJ.L11 == null || OBJ.L11 == "") OBJ.L11 = "0"; OBJ.L12 =double.Parse(OBJ.L11) + OBJ.L10; this.vGridControl1.Refresh(); return; }
/// <summary> /// ������վ����� /// </summary> /// <param name="DY">��ѹ</param> /// <param name="Number">����̨��</param> /// <param name="MVA">��̨����</param> /// <param name="LineLong">��·���ȣ�KM��</param> /// <param name="LineType">�����ͺ�</param> /// <param name="Flag">�Ƿ���·�����Ϣ����true����false</param> /// <returns>���ر��վ���</returns> public static double ComputerPowerMoney(int DY, double MVA, double LineLong, string LineType, bool Flag) { double sumvalue = 0; double sumvaluedata = 0; double sumvalueLine = 0; Project_Sum ps = new Project_Sum(); //ps.T2 = OBJ.L2; //ps.T3 = OBJ.L13; //ps.T4 = OBJ.L14; ps.S5 = "2"; ps.S1 = DY.ToString(); Hashtable ha = new Hashtable(); int t = 0; //ps.Type = OBJ.L7; IList<Project_Sum> sum = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", ps); foreach(Project_Sum ps1 in sum) { try { int mva = (int)MVA; int t5 = Convert.ToInt32(ps1.T5); int ta = Convert.ToInt32(ps1.T1); if (mva % (t5 * ta) == 0) { ha.Add(t5, ps1.Num); if (t5 > t) t = t5; //sumvaluedata = ps1.Num; //break; } } catch { } } try { if (ha.Count > 0) sumvaluedata = (double)ha[t]; } catch { } if (Flag == true)//���վ�µ���·����·��Ϣ { Project_Sum pps = new Project_Sum(); pps.S5 = "1"; pps.S1 = DY.ToString(); pps.L1 = LineType; ////ps.L2 = OBJ.L15; ////ps.L3 = OBJ.L16; IList<Project_Sum> summ = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue2", pps); if (summ.Count == 1) { foreach (Project_Sum pp in summ) { if (pp.Num.ToString() == null || pp.Num.ToString() == "") pp.Num = 0; sumvalueLine = pp.Num * LineLong; } } } return sumvalue = sumvaluedata + sumvalueLine; }
/// <summary> /// ������վ����� /// </summary> /// <param name="DY">��ѹ</param> /// <param name="Number">����̨��</param> /// <param name="MVA">��̨����</param> /// <param name="LineLong">��·���ȣ�KM��</param> /// <param name="LineType">�����ͺ�</param> /// <param name="Flag">�Ƿ���·�����Ϣ����true����false</param> /// <returns>���ر��վ���</returns> public static double ComputerPowerMoney(int DY, int Number, string MVA, double LineLong, string LineType, bool Flag) { double sumvalue = 0; double sumvaluedata = 0; double sumvalueLine = 0; Project_Sum ps = new Project_Sum(); //ps.T2 = OBJ.L2; //ps.T3 = OBJ.L13; //ps.T4 = OBJ.L14; ps.S5 = "2"; ps.S1 = DY.ToString(); ps.T5 = MVA.ToString(); ps.T1 = Number.ToString(); //ps.Type = OBJ.L7; Project_Sum sum = (Project_Sum)Common.Services.BaseService.GetObject("SelectProject_SumByvalue3", ps); if (sum != null) { // sumvaluedata = sum.Num*Number/int.Parse(sum.T1); sumvaluedata = sum.Num; } if (Flag==true)//���վ�µ���·����·��Ϣ { Project_Sum pps = new Project_Sum(); pps.S5 = "1"; pps.S1 = DY.ToString(); pps.L1 = LineType; ////ps.L2 = OBJ.L15; ////ps.L3 = OBJ.L16; IList<Project_Sum> summ = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue2", pps); if (summ.Count == 1) { foreach (Project_Sum pp in summ) { if (pp.Num.ToString() == null || pp.Num.ToString() == "") pp.Num = 0; sumvalueLine = pp.Num * LineLong; } } } return sumvalue = sumvaluedata + sumvalueLine; }
protected bool InputCheck() { if (_obj.S1 == "") { MsgBox.Show("��ѹ�ȼ�����Ϊ�գ�"); return false; } if (_obj.Name == "") { MsgBox.Show("��Ŀ���Ʋ���Ϊ�գ�"); return false; } if (Object.S5 == "1") //xianlu { //if (_obj.L1 == "") //{ // MsgBox.Show("�����ͺŲ���Ϊ�գ�"); // return false; //} } else { //if (_obj.T1 == "") //{ // MsgBox.Show("����̨������Ϊ�գ�"); // return false; //} if (_obj.T5 == "") { MsgBox.Show("��ģ����Ϊ�գ�"); return false; } //��̨���� } //if (_obj.Num== 0) //{ // MsgBox.Show("��̬Ͷ�ʲ���Ϊ�գ�"); // return false; //} Project_Sum str = new Project_Sum(); str.Name = _obj.Name; str.S5= _obj.S5; IList<Project_Sum> list = new List<Project_Sum>(); //////////IList<Project_Sum> list = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByNameandS5", str); //////////if (IsCreate) //////////{ ////////// if (list.Count > 0) ////////// { ////////// MsgBox.Show("�Ѵ���ͬ���ĵ��ͷ�����"); ////////// list.Clear(); ////////// return false; ////////// } //////////} //////////else //////////{ ////////// if (list.Count == 1) ////////// { ////////// //IList<Project_Sum> listtemp = list as IList<Project_Sum>; ////////// ////////// if (list[0].UID != _obj.UID) ////////// ////////// { ////////// ////////// MsgBox.Show("�Ѵ���ͬ���ĵ��ͷ�����"); ////////// ////////// list.Clear(); ////////// ////////// return false; ////////// ////////// } ////////// //////////} ////////// //////////else if (list.Count > 1) ////////// //////////{ ////////// ////////// MsgBox.Show("�Ѵ���ͬ���ĵ��ͷ�����"); ////////// ////////// list.Clear(); ////////// ////////// return false; ////////// } //////////} // if (_obj.S5 == "1") // { str.S1= _obj.S1; str.Type = _obj.Type; str.T5 = _obj.T5; str.Name = _obj.Name; list = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumBySxt", str); if (IsCreate) { if (list.Count > 0) { MsgBox.Show("�Ѵ�����ͬ�ķ���(��ѹ����Ŀ���ơ����ģ��ȫ��ͬ)��"); list.Clear(); return false; } } else { if (list.Count== 1) { //IList<Project_Sum> listtemp = list as IList<Project_Sum>; if (list[0].UID != _obj.UID) { MsgBox.Show("�Ѵ�����ͬ�ķ���(��ѹ����Ŀ���ơ����ģ��ȫ��ͬ)��"); list.Clear(); return false; } } else if (list.Count > 1) { MsgBox.Show("�Ѵ�����ͬ�ķ���(��ѹ����Ŀ���ơ����ģ��ȫ��ͬ)��"); list.Clear(); return false; } } // } //else // if (_obj.S5 == "2") // { // str.S1 = _obj.S1; // str.T1 = _obj.T1; // str.T5 = _obj.T5; // str.S5 = _obj.S5; // list = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue3", str); // if (IsCreate) // { // if (list.Count > 0) // { // MsgBox.Show("�Ѵ�����ͬ�ķ���(��ѹ������̨������̨������ȫ��ͬ)��"); // list.Clear(); // return false; // } // } // else // { // if (list.Count == 1) // { // //IList<Project_Sum> listtemp = list as IList<Project_Sum>; // if (list[0].UID != _obj.UID) // { // MsgBox.Show("�Ѵ�����ͬ�ķ���(��ѹ������̨������̨������ȫ��ͬ)��"); // list.Clear(); // return false; // } // } // else if (list.Count > 1) // { // MsgBox.Show("�Ѵ�����ͬ�ķ���(��ѹ������̨������̨������ȫ��ͬ)��"); // list.Clear(); // return false; // } // } // } return true; }
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 FrmEditProject_Load(object sender, EventArgs e) { SetData(); string q1 = ""; string q2 = ""; string q3 = ""; string q4 = ""; string q5 = ""; string q6 = ""; string q7 = ""; string q8 = ""; string q9 = ""; string q10 = ""; string q11 = ""; string q12 = ""; int t1 = 0; PSP_PowerProValues_LangFang ppt = new PSP_PowerProValues_LangFang(); ppt.ID = poweruid; ppt.Flag2 = flag; PSP_PowerProValues_LangFang ps = Common.Services.BaseService.GetOneByKey<PSP_PowerProValues_LangFang>(ppt); if (ps != null) { groupBox1.Text = ps.Title; powerid = ps.Code; t1 = ps.Flag; // q1 = ps.L1; // q2 = ps.L2; q3 = ps.L3; q4 = ps.L4; q5 = ps.L5; q6 = ps.L6; q7 = ps.L7; q8 = ps.L8; q9 = ps.L9; q10 = ps.L10.ToString(); q11 = ps.L11; q12 = ps.L12.ToString(); } LineInfo li22 = Common.Services.BaseService.GetOneByKey<LineInfo>(powerid); if (li22 != null || t1==1) { isline = true; } substation sb = Common.Services.BaseService.GetOneByKey<substation>(powerid); if (sb != null || t1 == 2) { isPower = true; } PowerProValues ppv = new PowerProValues(); ppv.TypeID = poweruid; ppv.TypeID1 = flag; IList<PowerProValues> listValues = Common.Services.BaseService.GetList<PowerProValues>("SelectPowerProValuesList", ppv); PowerProYears pps = new PowerProYears(); pps.Flag = flag; IList<PowerProYears> li = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", pps); lb=new Label[li.Count]; te=new TextEdit[li.Count]; int i=0; //if (!isPower) // { ////lt1.Text = "�豸����:"; ////lt1.Location = new Point(52, 27 + 33 * i); ////groupBox1.Controls.Add(lt1); ////tt1 = new TextEdit(); ////tt1.Location = new Point(157, 26 + 33 * i); ////tt1.Size = new Size(231, 21); ////tt1.TextChanged += new EventHandler(tt1_TextChanged); ////tt1.Properties.DisplayFormat.FormatString = "n4"; ////tt1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ////tt1.Properties.EditFormat.FormatString = "n4"; ////tt1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; ////tt1.Properties.Mask.EditMask = "#####0.####"; ////tt1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; ////groupBox1.Controls.Add(tt1); ////i++; ////lt2.Text = "̨��:"; ////lt2.Location = new Point(52, 27 + 33 * i); ////groupBox1.Controls.Add(lt2); ////tt2 = new TextEdit(); ////tt2.Location = new Point(157, 26 + 33 * i); ////tt2.Size = new Size(231, 21); ////groupBox1.Controls.Add(tt2); ////i++; // } //if (!isline) { lt3.Text = "�� �� �� �� :"; lt3.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt3); // tt3 = new TextEdit(); cb0.Location = new Point(157, 26 + 33 * i); cb0.Size = new Size(231, 21); cb0.Properties.DisplayFormat.FormatString = "n0"; cb0.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb0.Properties.EditFormat.FormatString = "n0"; cb0.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb0.Properties.Mask.EditMask = "########"; cb0.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb0); i++; lt4.Text = "�� ѹ �� �� :"; lt4.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt4); // tt4 = new TextEdit(); cb1.Location = new Point(157, 26 + 33 * i); cb1.Size = new Size(231, 21); cb1.Properties.DisplayFormat.FormatString = "n4"; cb1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb1.Properties.EditFormat.FormatString = "n4"; cb1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb1.Properties.Mask.EditMask = "#####0.####"; cb1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb1); i++; lt5.Text = "�� �� ̨ �� :"; lt5.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt5); // tt5 = new TextEdit(); cb2.Location = new Point(157, 26 + 33 * i); cb2.Size = new Size(231, 21); cb2.Properties.DisplayFormat.FormatString = "####.##"; cb2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; cb2.Properties.EditFormat.FormatString = "####.##"; cb2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; // cb2.Properties.Mask.EditMask = "P2"; cb2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(cb2); i++; lt6.Text = "��̨������MVA��:"; lt6.Location = new Point(50, 27 + 33 * i); lt6.Width = 105; groupBox1.Controls.Add(lt6); //tt6 = new TextEdit(); cb3.Location = new Point(157, 26 + 33 * i); cb3.Size = new Size(231, 21); cb3.Properties.DisplayFormat.FormatString = "n4"; cb3.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb3.Properties.EditFormat.FormatString = "n4"; cb3.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb3.Properties.Mask.EditMask = "#####0.####"; cb3.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb3); i++; lt7.Text = "�� �� �� ʽ :"; lt7.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt7); //tt6 = new TextEdit(); cb4.Location = new Point(157, 26 + 33 * i); cb4.Size = new Size(231, 21); cb4.Properties.DisplayFormat.FormatString = "n4"; cb4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb4.Properties.EditFormat.FormatString = "n4"; cb4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb4.Properties.Mask.EditMask = "#####0.####"; cb4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb4); i++; lt8.Text = "��·���ȣ�KM��:"; lt8.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt8); //tt6 = new TextEdit(); tt4.Location = new Point(157, 26 + 33 * i); tt4.Size = new Size(231, 21); tt4.Properties.DisplayFormat.FormatString = "n4"; tt4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; tt4.Properties.EditFormat.FormatString = "n4"; tt4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // tt4.Properties.Mask.EditMask = "#####0.####"; tt4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(tt4); i++; lt9.Text = "�� �� �� �� :"; lt9.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt9); //tt6 = new TextEdit(); cb5.Location = new Point(157, 26 + 33 * i); cb5.Size = new Size(231, 21); cb5.Properties.DisplayFormat.FormatString = "n4"; cb5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.None; cb5.Properties.EditFormat.FormatString = "n4"; cb5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.None; // cb5.Properties.Mask.EditMask = "#####0.####"; cb5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None; groupBox1.Controls.Add(cb5); i++; Project_Sum sum = new Project_Sum(); sum.S5 = islineflag; sum.S1 = q4; IList<Project_Sum> list = Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5",sum); upedit.Properties.DataSource = list; LookUpColumnInfo a = new LookUpColumnInfo(); a.FieldName = "T3"; a.Caption = "������ʽ"; LookUpColumnInfo c = new LookUpColumnInfo(); c.FieldName = "T2"; c.Caption = "���߹�ģ"; LookUpColumnInfo b = new LookUpColumnInfo(); b.FieldName = "T1"; b.Caption = "����̨��������"; LookUpColumnInfo d = new LookUpColumnInfo(); d.Caption = "��̬Ͷ��"; d.FieldName = "Num"; LookUpColumnInfo nn = new LookUpColumnInfo(); nn.FieldName = "Name"; nn.Caption = "���"; LookUpColumnInfo f = new LookUpColumnInfo(); f.FieldName = "Type"; f.Caption = "����"; upedit.Properties.Columns.Add(f); upedit.Properties.Columns.Add(nn); upedit.Properties.Columns.Add(b); upedit.Properties.Columns.Add(c); upedit.Properties.Columns.Add(a); upedit.Properties.Columns.Add(d); upedit.Properties.DisplayMember = "Num"; //upedit.Properties.SearchMode = SearchMode.AutoComplete; //upedit.Properties.AutoSearchColumnIndex = 5; upedit.Properties.DropDownRows =5; upedit.Properties.PopupWidth = 500; upedit.Properties.ShowHeader = true; lt10.Text = "Ͷ �� �� �� :"; lt10.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt10); upedit.Location = new Point(157, 26 + 33 * i); upedit.Size = new Size(231, 21); upedit.Properties.DisplayFormat.FormatString = "n4"; upedit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; upedit.Properties.EditFormat.FormatString = "n4"; upedit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; upedit.Properties.Mask.EditMask = "###############0.####"; upedit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; upedit.Properties.AllowNullInput=DevExpress.Utils.DefaultBoolean.True; upedit.TextChanged += new EventHandler(upedit_TextChanged); groupBox1.Controls.Add(upedit); i++; lt11.Text = "�� �� �� �� :"; lt11.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt11); //tt6 = new TextEdit(); tt6.Location = new Point(157, 26 + 33 * i); tt6.Size = new Size(231, 21); tt6.Properties.DisplayFormat.FormatString = "n4"; tt6.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.EditFormat.FormatString = "n4"; tt6.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.Mask.EditMask = "###############0.####"; tt6.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; tt6.TextChanged += new EventHandler(tt6_TextChanged); groupBox1.Controls.Add(tt6); i++; lt12.Text = "�� �� �� �� :"; lt12.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt12); //tt6 = new TextEdit(); tt5.Location = new Point(157, 26 + 33 * i); tt5.Size = new Size(231, 21); tt5.Properties.DisplayFormat.FormatString = "n4"; tt5.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt5.Properties.EditFormat.FormatString = "n4"; tt5.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt5.Properties.Mask.EditMask = "###############0.####"; tt5.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt5); i++; } int j = 0; foreach (PowerProYears ppy in li) { lb[j] = new Label(); lb[j].Name = "Label" + ppy.Year; lb[j].Text = ppy.Year + ":"; lb[j].Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lb[j]); te[j] = new TextEdit(); te[j].Name = "Text" + ppy.Year; te[j].Location = new Point(157, 26 + 33 * i); te[j].Size = new Size(231, 21); groupBox1.Controls.Add(te[j]); foreach (PowerProValues ppy1 in listValues) { if (ppy.Year == ppy1.Year) te[j].Text = ppy1.Value; } j++; i++; } if (isline) { try { // cb5.Properties.Items.Contains(q9.ToString()); //tt1.Text = q3.ToString(); //tt2.Text = q4.ToString(); //if (li22 != null) //{ // tt1.Text = li22.Length; // tt2.Text = li22.LineType; //} } catch { } } if (isPower) { try { ////tt3.Text = q1.ToString(); //tt4.Text = q4.ToString(); //tt5.Text = q5.ToString(); //tt6.Text = q6.ToString(); //if (sb != null) //{ // tt5.Text = sb.Number.ToString(); // tt4.Text = sb.ObligateField2; // tt6.Text = sb.Burthen.ToString(); //} } catch { } } PSP_PowerProValues_LangFang pplf = new PSP_PowerProValues_LangFang(); pplf.Flag2 = flag; IList<PSP_PowerProValues_LangFang> plfs = Common.Services.BaseService.GetList<PSP_PowerProValues_LangFang>("SelectPSP_PowerProValues_LangFangByFlag2OrderL3", pplf); tt4.Text = q8.ToString(); tt5.Text = q10.ToString(); tt6.Text = q12.ToString(); if (plfs.Count == 0) { cb0.Text = ""; } foreach (PSP_PowerProValues_LangFang pv in plfs) { if(pv.L3!=""&&pv.L3.Length>0) cb0.Properties.Items.Add(pv.L3); } cb0.Text = q3.ToString(); cb1.Text = q4.ToString(); cb2.Text = q5.ToString(); cb3.Text = q6.ToString(); cb4.Text = q7.ToString(); cb5.Text = q9.ToString(); lookupedit = q11; upedit.Properties.NullText = q11; groupBox1.Size = new Size(434, 40+ 33 * i); simpleButton1.Location = new Point(296, 60 + 33 * i); simpleButton2.Location = new Point(389, 60 + 33 * i); this.Size = new Size(490, 130 + 33 * i); }
private void InsertSubstation_Info() { 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<Project_Sum> lii = new List<Project_Sum>(); DateTime s8 = DateTime.Now; for (int i = 0; i < dts.Rows.Count; i++) { Project_Sum l1 = new Project_Sum(); 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 "Num": 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.S5 = type; //l1.CreateDate = s8.AddSeconds(i); lii.Add(l1); } foreach (Project_Sum lll in lii) { ////////if (lll.Name == "") //////// continue; Project_Sum l1 = new Project_Sum(); ////////l1.Name = lll.Name; ////////l1.S5 = type; ////////object obj = Services.BaseService.GetObject("SelectProject_SumByNameandS5", l1); IList<Project_Sum> list = new List<Project_Sum>(); if (type == "1") { l1.S1 = lll.S1; l1.L1 = lll.L1; l1.S5 = type; list = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByLinevalue2", l1); } else if (type == "2") { l1.S1 = lll.S1; l1.T1 = lll.T1; l1.T5 = lll.T5; l1.S5 = type; list = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByvalue3", l1); } if (list.Count>0) { lll.UID = list[0].UID; Services.BaseService.Update<Project_Sum>(lll); } else { lll.UID = Guid.NewGuid().ToString(); Services.BaseService.Create<Project_Sum>(lll); } } this.ctrlProject_Sum1.RefreshData(); } } catch (Exception ex) { MsgBox.Show(columnname + ex.Message); MsgBox.Show("�����ʽ����ȷ��"); } }
private void UpDateInit() { double sumvalue = 0; if (OBJ.L4 == "220") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "220"; pjt.S5 = "2"; //pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "220"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "110") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "110"; pjt.S5 = "2"; //pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "110"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "35") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "35"; pjt.S5 = "2"; //pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "35"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "66") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "66"; pjt.S5 = "2"; //pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "66"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.L4 == "500") { Project_Sum pjt = new Project_Sum(); if (OBJ.Flag == 2) { pjt.S1 = "500"; pjt.S5 = "2"; //pjt.Type = OBJ.L7; IList<Project_Sum> lt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum ps in lt) { if (ps.T5 != null && ps.T5 != "") if (!this.repositoryItemComboBox3.Items.Contains(ps.T5)) { this.repositoryItemComboBox3.Items.Add(ps.T5); } } } pjt.S1 = "500"; pjt.S5 = "1"; IList<Project_Sum> ltt = Common.Services.BaseService.GetList<Project_Sum>("SelectProject_SumByS1andS5", pjt); foreach (Project_Sum pss in ltt) { if (pss.L1 != null && pss.L1 != "") if (!this.repositoryItemComboBox10.Items.Contains(pss.L1)) { this.repositoryItemComboBox10.Items.Add(pss.L1); } } } if (OBJ.Flag == 1) { this.单台容量.Enabled = false; this.主变台数.Enabled = false; } if (OBJ.Flag == 2) { this.单台容量.Enabled = true; this.主变台数.Enabled = true; } PSP_Project_List sf = (PSP_Project_List)Services.BaseService.GetObject("SelectPSP_Project_ListByMaxCreateTime", null); IList sf1 = Services.BaseService.GetList("selectPag2", null); foreach (PSP_Project_List kk in sf1) { if (kk.L1 != "" && kk.L1 != null) this.repositoryItemComboBox5.Items.Add(kk.L1); } //if (sf != null) // if (sf.L1 != "" && sf.L1 != null) // OBJ.L1 = sf.L1; // else if (this.repositoryItemComboBox5.Items.Count > 0) // OBJ.L1 = this.repositoryItemComboBox5.Items[0].ToString(); // else if (this.repositoryItemComboBox5.Items.Count > 0) // OBJ.L1 = this.repositoryItemComboBox5.Items[0].ToString(); }