private void simpleButton1_Click(object sender, EventArgs e) { for (int i = 0; i < te.Length; i++) { SaveCellValue(te[i].Name.Replace("Text", ""), poweruid, te[i].Text.Trim()); } for (int i = 0; i < te.Length; i++) { ac1[i]=se[i].Text.Trim(); } try { PSP_PowerTypes_Liao ppts = new PSP_PowerTypes_Liao(); ppts.ID =int.Parse( poweruid); ppts.Flag2 = flag; PSP_PowerTypes_Liao ps = Common.Services.BaseService.GetOneByKey<PSP_PowerTypes_Liao>(ppts); try { if(tt1.Text!="") ps.ChangDu = tt1.Text; if (tt2.Text != "") ps.JianSheXingZhi = tt2.Text; if (tt4.Text != "") ps.RongLiang = tt4.Text; if (tt6.Text != "") ps.TouZiZongEr = tt6.Text; if (ac1[0]!= null && ac1[0].ToString() != "") { ps.S1 = ac1[0].ToString(); } if (ac1[1]!= null && ac1[1].ToString() != "") { ps.S2 = ac1[1].ToString(); } if (ac1[2] != null && ac1[2].ToString()!= "") { ps.S3 = ac1[2].ToString(); } if (ac1[3] != null && ac1[3].ToString() != "") { ps.S4 = ac1[3].ToString(); } if (ac1[4] != null && ac1[4].ToString() != "") { ps.S5 = ac1[4].ToString(); } if (ac1[5] != null && ac1[5].ToString() != "") { ps.S6 = ac1[5].ToString(); } if (ac1[6] != null && ac1[6].ToString() != "") { ps.S7 = ac1[6].ToString(); } if (ac1[7] != null && ac1[7].ToString() != "") { ps.S8 = ac1[7].ToString(); } if (ac1[8] != null && ac1[8].ToString() != "") { ps.S9 = ac1[8].ToString(); } if (ac1[9] != null && ac1[9].ToString() != "") { ps.S10 = ac1[9].ToString(); } if (ac1[10] != null && ac1[10].ToString() != "") { ps.S11 = ac1[10].ToString(); } if (ac1[11] != null && ac1[11].ToString() != "") { ps.S12 = ac1[11].ToString(); } if (ac1[12] != null && ac1[12].ToString() != "") { ps.S13 = ac1[12].ToString(); } if (ac1[13] != null && ac1[13].ToString() != "") { ps.S14 = ac1[13].ToString(); } if (ac1[14]!= null && ac1[14].ToString() != "") { ps.S15 = ac1[14].ToString(); } if (ac1[15] != null && ac1[15].ToString() != "") { ps.S16 = ac1[15].ToString(); } if (ac1[16] != null && ac1[16].ToString() != "") { ps.S17 = ac1[16].ToString(); } if (ac1[17] != null && ac1[17].ToString() != "") { ps.S18 = ac1[17].ToString(); } if (ac1[18] != null && ac1[18].ToString() != "") { ps.S19 = ac1[18].ToString(); } if (ac1[19] != null && ac1[19].ToString() != "") { ps.S20 = ac1[19].ToString(); } } catch { } Common.Services.BaseService.Update("UpdatePSP_PowerTypes_LiaoByIDflag", ps); } catch { } this.DialogResult = DialogResult.OK; }
private void FrmEditProject_Load(object sender, EventArgs e) { string q1 = ""; string q2 = ""; string q3 = ""; double? q4 = null; string q5 = ""; string q6 = ""; string q7 = ""; string q8 = ""; string q9 = ""; string q10 = ""; string q11 = ""; string q12 = ""; string q13 = ""; string q14 = ""; string q15 = ""; string q16 = ""; string q17 = ""; string q18 = ""; string q19 = ""; string q20 = ""; string q21 = ""; string q22 = ""; string q23 = ""; string q24 = ""; int t1 = 0; PSP_PowerTypes_Liao ppt = new PSP_PowerTypes_Liao(); try { ppt.ID = int.Parse(poweruid); } catch { } ppt.Flag2 = flag; PSP_PowerTypes_Liao ps = Common.Services.BaseService.GetOneByKey<PSP_PowerTypes_Liao>(ppt); if (ps != null) { groupBox1.Text = ps.Title; t1 = ps.Flag; q1 = ps.JianSheXingZhi; q2 = ps.RongLiang; q3 = ps.ChangDu; if (ps.TouZiZongEr.ToString()!="") { q4=double.Parse(ps.TouZiZongEr); } if (ps.S1 == "" || ps.S1 == null) { q5 = ""; } else { q5 = ps.S1; } ac1.Add(q5); if (ps.S2 != "" && ps.S2!=null) { q6 = ps.S2; } ac1.Add(q6); if (ps.S3 != "" && ps.S3 != null) { q7 = ps.S3; } ac1.Add(q7); if (ps.S4 != "" && ps.S4 != null) { q8 = ps.S4; } ac1.Add(ps.S4); if (ps.S5 != "" && ps.S5 != null) { q9 = ps.S5; } ac1.Add(ps.S5); if (ps.S6 != "" && ps.S6 != null) { q10 = ps.S6; } ac1.Add(ps.S6); if (ps.S7 != "" && ps.S7 != null) { q11 = ps.S7; } ac1.Add(ps.S7); if (ps.S8 != "" && ps.S8 != null) { q12 = ps.S8; } ac1.Add(ps.S8); if (ps.S9 != "" && ps.S9 != null) { q13 = ps.S9; } ac1.Add(ps.S9); if (ps.S10 != "" && ps.S10 != null) { q14 = ps.S10; } ac1.Add(ps.S10); if (ps.S11 != "" && ps.S11 != null) { q15 = ps.S11; } ac1.Add(ps.S11); if (ps.S12 != "" && ps.S12 != null) { q16 = ps.S12; } ac1.Add(ps.S12); if (ps.S13 != "" && ps.S13 != null) { q17 = ps.S13; } ac1.Add(ps.S13); if (ps.S14 != "" && ps.S14 != null) { q18 = ps.S14; } ac1.Add(ps.S14); if (ps.S15 != "" && ps.S15 != null) { q19 = ps.S15; } ac1.Add(ps.S15); if (ps.S16 != "" && ps.S16 != null) { q20 = ps.S16; } ac1.Add(ps.S16); if (ps.S17 != "" && ps.S17 != null) { q21 = ps.S17; } ac1.Add(ps.S17); if (ps.S18 != "" && ps.S18 != null) { q22 = ps.S18; } ac1.Add(ps.S18); if (ps.S19 != "" && ps.S19 != null) { q23 = ps.S19; } ac1.Add(ps.S19); if (ps.S20 != "" && ps.S20 != null) { q24 = ps.S20; } ac1.Add(ps.S20); } PowerValues ppv = new PowerValues(); try { ppv.TypeID = int.Parse(poweruid); } catch { } //ppv.TypeID1 = flag; IList<PowerValues> listValues = Common.Services.BaseService.GetList<PowerValues>("SelectPowerValuesList", ppv); PowerYears pps = new PowerYears(); pps.Flag = flag; IList<PowerYears> li = Common.Services.BaseService.GetList<PowerYears>("SelectPowerYearsListByFlag", pps); lb=new Label[li.Count]; te=new TextEdit[li.Count]; int i=0; lt2.Text = "��������:"; lt2.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt2); tt2 = new TextEdit(); tt2.Location = new Point(157, 26 + 33 * i); tt2.Size = new Size(231, 21); groupBox1.Controls.Add(tt2); i++; lt4.Text = "�������:"; lt4.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt4); tt4 = new TextEdit(); tt4.Location = new Point(157, 26 + 33 * i); tt4.Size = new Size(231, 21); tt4.Properties.DisplayFormat.FormatString = "n4"; tt4.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt4.Properties.EditFormat.FormatString = "n4"; tt4.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt4.Properties.Mask.EditMask = "#####0.####"; tt4.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt4); i++; lt1.Text = "��·����:"; lt1.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt1); tt1 = new TextEdit(); tt1.Location = new Point(157, 26 + 33 * i); tt1.Size = new Size(231, 21); tt1.Properties.DisplayFormat.FormatString = "n4"; tt1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt1.Properties.EditFormat.FormatString = "n4"; tt1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt1.Properties.Mask.EditMask = "#####0.####"; tt1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt1); i++; lt6.Text = "��Ͷ�ʣ���Ԫ��:"; lt6.Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(lt6); tt6 = new TextEdit(); tt6.Location = new Point(157, 26 + 33 * i); tt6.Size = new Size(231, 21); tt6.Properties.DisplayFormat.FormatString = "n4"; tt6.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.EditFormat.FormatString = "n4"; tt6.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric; tt6.Properties.Mask.EditMask = "#####0.####"; tt6.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; groupBox1.Controls.Add(tt6); i++; int j = 0; foreach (PowerYears 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 (PowerValues ppy1 in listValues) { if (ppy.Year == ppy1.Year) te[j].Text = ppy1.Value.ToString(); } j++; i++; } PowerSubstationLine psl = new PowerSubstationLine(); psl.Flag = "1"; psl.Type =flag ; psl.Type2 = type; IList<PowerSubstationLine> lli = Itop.Client.Common.Services.BaseService.GetList<PowerSubstationLine>("SelectPowerSubstationLineByFlagType", psl); sb = new Label[lli.Count]; se = new TextEdit[lli.Count]; j = 0; foreach (PowerSubstationLine pss in lli) { sb[j] = new Label(); sb[j].Name = "Label" + pss.Title; sb[j].Text = pss.Title + ":"; sb[j].Location = new Point(52, 27 + 33 * i); groupBox1.Controls.Add(sb[j]); se[j] = new TextEdit(); se[j].Name = "Text" + pss.Title; se[j].Location = new Point(157, 26 + 33 * i); se[j].Size = new Size(231, 21); groupBox1.Controls.Add(se[j]); try { if (ac1[j].ToString() != DBNull.Value.ToString() && ac1[j].ToString() != "") { se[j].Text = ac1[j].ToString(); } else { se[j].Text = ""; } } catch (Exception ex) { MsgBox.Show(ex.Message); } j++; i++; } try { tt1.Text = q3.ToString(); tt2.Text = q1.ToString(); tt4.Text = q2.ToString(); tt6.Text = q4.ToString(); } catch { } groupBox1.Size = new Size(434, 30 + 33 * i); simpleButton1.Location = new Point(296, 50 + 33 * i); simpleButton2.Location = new Point(389, 50 + 33 * i); this.Size = new Size(490, 130 + 33 * i); }
private void barButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNode focusedNode = treeList1.FocusedNode; if (focusedNode == null) { return; } FormTypeTitle frm = new FormTypeTitle(); frm.Text = "增加" + focusedNode.GetValue("Title") + "的子项目"; if (frm.ShowDialog() == DialogResult.OK) { PSP_PowerTypes_Liao psp_Type = new PSP_PowerTypes_Liao(); psp_Type.Title = frm.TypeTitle; psp_Type.Flag = (int)focusedNode.GetValue("Flag"); psp_Type.Flag2 = (string)focusedNode.GetValue("Flag2"); psp_Type.ParentID = (int)focusedNode.GetValue("ID"); try { psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_PowerTypes_Liao", psp_Type); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow())); } catch (Exception ex) { MsgBox.Show("增加子项目出错:" + ex.Message); } } }
private void LoadData() { try { if (dataTable != null) { dataTable.Columns.Clear(); treeList1.Columns.Clear(); } PSP_PowerTypes_Liao psp_Type = new PSP_PowerTypes_Liao(); psp_Type.Flag2 = typeFlag2; IList listTypes = new ArrayList(); try { listTypes = Common.Services.BaseService.GetList("SelectPSP_PowerTypes_LiaoByFlag2", psp_Type); } catch (Exception ex) { MsgBox.Show(ex.Message); } dataTable = Itop.Common.DataConverter.ToDataTable(listTypes, typeof(PSP_PowerTypes_Liao)); treeList1.DataSource = dataTable; treeList1.Columns["Title"].Caption = "项目名称"; treeList1.Columns["Title"].Width = 180; treeList1.Columns["Title"].OptionsColumn.AllowEdit = false; treeList1.Columns["Title"].OptionsColumn.AllowSort = false; treeList1.Columns["Flag"].VisibleIndex = -1; treeList1.Columns["Flag"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["Flag2"].VisibleIndex = -1; treeList1.Columns["Flag2"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreatTime"].VisibleIndex = -1; treeList1.Columns["CreatTime"].OptionsColumn.ShowInCustomizationForm = false; treeList1.Columns["CreatTime"].SortOrder = System.Windows.Forms.SortOrder.Ascending; PowerYears psp_Year = new PowerYears(); psp_Year.Flag = typeFlag2; IList<PowerYears> listYears = Common.Services.BaseService.GetList<PowerYears>("SelectPowerYearsListByFlag", psp_Year); foreach (PowerYears item in listYears) { AddColumn(item.Year); } AddColumn1(); AddColumn2(); AddColumn3(); AddColumn4(); ////PowerProYears psp_Years = new PowerProYears(); ////psp_Years.Flag = typeFlag2; ////IList<PowerProYears> listYear = Common.Services.BaseService.GetList<PowerProYears>("SelectPowerProYearsListByFlag", psp_Years); ////foreach (PowerProYears item in listYear) ////{ //// ReAddColumn(item.Year); ////} Application.DoEvents(); LoadValues(); } catch (Exception ex) { MsgBox.Show(ex.Message); } }
private void InsertLineData1() { string columnname = ""; IList<PSP_PowerTypes_Liao> psplist = new List<PSP_PowerTypes_Liao>(); psplist.Clear(); IList<PowerValues> pvlist=new List<PowerValues>(); pvlist.Clear(); PowerYears z1 = new PowerYears(); z1.Flag=this.ctrlPowerEachList1.FocusedObject.UID; ArrayList al = new ArrayList(); int pycount = 0; IList<PowerYears> py = Common.Services.BaseService.GetList<PowerYears>("SelectPowerYearsListByFlag", z1); pycount = py.Count; for (int i = 0; i < 20; i++) { al.Add(""); } int j = 0; try { DataTable dts = new DataTable(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Excel文件(*.xls)|*.xls"; if (op.ShowDialog() == DialogResult.OK) { dts = GetExcel(op.FileName); //if (treeList1.Columns.Count != dts.Columns.Count) // { // MsgBox.Show("导入的格式不正确!"); // return; // } DateTime dt = DateTime.Now; for (int i =0; i < dts.Rows.Count; i++) { PSP_PowerTypes_Liao m2 = new PSP_PowerTypes_Liao(); m2.Flag2 = this.ctrlPowerEachList1.FocusedObject.UID; //if (dts.Rows[i][1].ToString().IndexOf("合计") >= 0) // continue; m2.CreatTime = dt.AddSeconds(i); foreach (DataColumn dc in dts.Columns) { columnname = dc.ColumnName; if (dts.Rows[i][dc.ColumnName].ToString() == "") continue; try { if (dc.ColumnName.ToString().Substring(4,1)=="年" &&dc.ColumnName.ToString().Length == 5) continue; } catch { } string LL2 = ""; try { LL2 = dts.Rows[i][dc.ColumnName].ToString(); } catch { } m2.GetType().GetProperty(dc.ColumnName).SetValue(m2, LL2, null); } //try //{ // m2.Title = dts.Rows[i][0].ToString(); //} //catch { } //try //{ // m2.JianSheXingZhi =dts.Rows[i][1].ToString(); //} //catch { } //try //{ // m2.RongLiang =dts.Rows[i][2].ToString(); //} //catch { } //try //{ // m2.ChangDu = dts.Rows[i][3].ToString(); //} //catch { } //try //{ // m2.TouZiZongEr =dts.Rows[i][4].ToString(); //} //catch { } //try //{ // m2.S1 = dts.Rows[i][pycount+5].ToString(); //} //catch { } //try //{ // m2.S2 = dts.Rows[i][pycount + 6].ToString(); //} //catch { } //try //{ // m2.S3 = dts.Rows[i][pycount + 7].ToString(); //} //catch { } //try //{ // m2.S4 = dts.Rows[i][pycount + 8].ToString(); //} //catch { } //try //{ // m2.S5 = dts.Rows[i][pycount + 9].ToString(); //} //catch { } //try //{ // m2.S6 = dts.Rows[i][pycount +10].ToString(); //} //catch { } //try //{ // m2.S7 = dts.Rows[i][pycount + 11].ToString(); //} //catch { } //try //{ // m2.S8 = dts.Rows[i][pycount + 12].ToString(); //} //catch { } //try //{ // m2.S9 = dts.Rows[i][pycount + 13].ToString(); //} //catch { } //try //{ // m2.S10 = dts.Rows[i][pycount + 14].ToString(); //} //catch { } //try //{ // m2.S11 = dts.Rows[i][pycount + 15].ToString(); //} //catch { } //try //{ // m2.S12 = dts.Rows[i][pycount + 16].ToString(); //} //catch { } //try //{ // m2.S13 = dts.Rows[i][pycount + 17].ToString(); //} //catch { } //try //{ // m2.S14 = dts.Rows[i][pycount + 18].ToString(); //} //catch { } //try //{ // m2.S15 = dts.Rows[i][pycount + 19].ToString(); //} //catch { } //try //{ // m2.S16 = dts.Rows[i][pycount + 10].ToString(); //} //catch { } //try //{ // m2.S17 = dts.Rows[i][pycount + 21].ToString(); //} //catch { } //try //{ // m2.S18 = dts.Rows[i][pycount + 22].ToString(); //} //catch { } //try //{ // m2.S19 = dts.Rows[i][pycount + 23].ToString(); //} //catch { } //try //{ // m2.S20 = dts.Rows[i][pycount + 24].ToString(); //} //catch { } psplist.Add(m2); } for (int i = 0; i < dts.Rows.Count; i++) { //for (int k = 1; k <= pycount; k++) //{ // PowerValues m1 = new PowerValues(); // m1.Value = double.Parse(dts.Rows[i][4 + k].ToString()); // //m1.TypeID = m2.ID; // m1.Year = int.Parse(dts.Columns[4 + k].ColumnName.Substring(0, 4)); // pvlist.Add(m1); //} foreach (DataColumn dc in dts.Columns) { columnname = dc.ColumnName; PowerValues m1 = new PowerValues(); try { if (dc.ColumnName.ToString().Substring(4,1)=="年" &&dc.ColumnName.ToString().Length == 5) { if (dts.Rows[i][dc.ColumnName].ToString() == null || dts.Rows[i][dc.ColumnName].ToString() == "") { m1.Year = int.Parse(dc.ColumnName.ToString().Substring(0, 4)); } else { m1.Value = double.Parse(dts.Rows[i][dc.ColumnName].ToString()); m1.Year = int.Parse(dc.ColumnName.ToString().Substring(0, 4)); } pvlist.Add(m1); } else { continue; } } catch { } } } int index = 0; foreach (PSP_PowerTypes_Liao ptl in psplist) { int z_typeID = (int)Common.Services.BaseService.Create("InsertPSP_PowerTypes_Liao", ptl); for (int L = 1; L <= pycount; L++) { pvlist[index].TypeID = z_typeID; PowerValues pv = (PowerValues)pvlist[index]; index++; Common.Services.BaseService.Create("InsertPowerValues", pv); } } } ReLoad(); } catch { MsgBox.Show("导入格式不正确!"); } }
private void simpleButton1_Click(object sender, EventArgs e) { // ac1.Clear(); for (int i = 0; i < se.Length; i++) { int num = 0; if (se[i].Tag.ToString().Length <= 6) num = int.Parse(se[i].Tag.ToString().Substring(se[i].Tag.ToString().Length - 1, 1)) - 1; else num = int.Parse(se[i].Tag.ToString().Substring(se[i].Tag.ToString().Length - 2, 2)) - 1; ac1[num] = se[i].Text.Trim(); } ////for (int i = 0; i < se.Length; i++) ////{ //// ac1.Add(se[i].Text.Trim()); ////} ////for (int i = se.Length; i < 20; i++) ////{ //// ac1.Add(""); ////} try { PSP_PowerTypes_Liao ps = new PSP_PowerTypes_Liao(); ps.ParentID = 0; ps.Flag2 = flag; try { if(tt1.Text!="") ps.ChangDu = tt1.Text; if (tt2.Text != "") ps.JianSheXingZhi = tt2.Text; if (tt3.Text != "") ps.Title = tt3.Text; if (tt4.Text != "") ps.RongLiang = tt4.Text; if (tt6.Text != "") ps.TouZiZongEr = tt6.Text; if (ac1[0]!= null && ac1[0].ToString() != "") { ps.S1 = ac1[0].ToString(); } if (ac1[1]!= null && ac1[1].ToString() != "") { ps.S2 = ac1[1].ToString(); } if (ac1[2] != null && ac1[2].ToString()!= "") { ps.S3 = ac1[2].ToString(); } if (ac1[3] != null && ac1[3].ToString() != "") { ps.S4 = ac1[3].ToString(); } if (ac1[4] != null && ac1[4].ToString() != "") { ps.S5 = ac1[4].ToString(); } if (ac1[5] != null && ac1[5].ToString() != "") { ps.S6 = ac1[5].ToString(); } if (ac1[6] != null && ac1[6].ToString() != "") { ps.S7 = ac1[6].ToString(); } if (ac1[7] != null && ac1[7].ToString() != "") { ps.S8 = ac1[7].ToString(); } if (ac1[8] != null && ac1[8].ToString() != "") { ps.S9 = ac1[8].ToString(); } if (ac1[9] != null && ac1[9].ToString() != "") { ps.S10 = ac1[9].ToString(); } if (ac1[10] != null && ac1[10].ToString() != "") { ps.S11 = ac1[10].ToString(); } if (ac1[11] != null && ac1[11].ToString() != "") { ps.S12 = ac1[11].ToString(); } if (ac1[12] != null && ac1[12].ToString() != "") { ps.S13 = ac1[12].ToString(); } if (ac1[13] != null && ac1[13].ToString() != "") { ps.S14 = ac1[13].ToString(); } if (ac1[14]!= null && ac1[14].ToString() != "") { ps.S15 = ac1[14].ToString(); } if (ac1[15] != null && ac1[15].ToString() != "") { ps.S16 = ac1[15].ToString(); } if (ac1[16] != null && ac1[16].ToString() != "") { ps.S17 = ac1[16].ToString(); } if (ac1[17] != null && ac1[17].ToString() != "") { ps.S18 = ac1[17].ToString(); } if (ac1[18] != null && ac1[18].ToString() != "") { ps.S19 = ac1[18].ToString(); } if (ac1[19] != null && ac1[19].ToString() != "") { ps.S20 = ac1[19].ToString(); } } catch { } if (Isupdate) { ps.ID = int.Parse(poweruid); ps.Flag2 = flag; if (dt.Year < 1900||dt==null||dt.ToString()=="") { dt = DateTime.Now; } ps.CreatTime = dt; Common.Services.BaseService.Update("UpdatePSP_PowerTypes_LiaoByIDflag", ps); } else { PSP_PowerTypes_Liao pptl = (PSP_PowerTypes_Liao)Common.Services.BaseService.GetObject("SelectPSP_PowerTypes_LiaoByTitleFlag2", ps); if (pptl == null) { ps.CreatTime = DateTime.Now; Common.Services.BaseService.Create("InsertPSP_PowerTypes_Liao", ps); } else { MsgBox.Show("����Ŀ�����Ѿ����ڣ�"); return; } } PSP_PowerTypes_Liao pp_tl = (PSP_PowerTypes_Liao)Common.Services.BaseService.GetObject("SelectPSP_PowerTypes_LiaoByTitleFlag2", ps); for (int i = 0; i < te.Length; i++) { SaveCellValue(te[i].Name.Replace("Text", ""), Convert.ToString(pp_tl.ID), te[i].Text.Trim()); } } catch (Exception ex) { MsgBox.Show(ex.Message); } this.DialogResult = DialogResult.OK; }