private void simpleButton1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("名称不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); return; } try{ int y = Convert.ToInt32(textBox1.Text.Substring(0, 4)); } catch (Exception e2) { MessageBox.Show("名称前4位应包含年份信息。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); return; } //else //{ PSPDIR pspDIR = new PSPDIR(); pspDIR.FileName = textBox1.Text; IList list = Services.BaseService.GetList("SelectPSPDIRByFileName", pspDIR); if (list.Count > 1 || (list.Count == 1 && UID == "")) { MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { this.DialogResult = DialogResult.OK; } //} }
public void InitData() { PSPDIR dir = new PSPDIR(); //if (simpleButton2.Visible == false) //simpleButton2.Visible if (fkk == false) { dir.FileType = "潮流"; IList list = Services.BaseService.GetList("SelectPSPDIRByFileType", dir); DataTable dataSvg = Itop.Common.DataConverter.ToDataTable(list, typeof(PSPDIR)); dataGridView1.DataSource = dataSvg; }//this.textBox7.TextChanged += new System.EventHandler(this.textBox7_TextChanged); else { //dir.FileType = "潮流"; //IList list = Services.BaseService.GetList("SelectPSPDIRByFileType", dir); //DataTable datasvg = Itop.Common.DataConverter.ToDataTable(list, typeof(PSPDIR)); //datasvg. dir.FileType = "短路"; IList list2 = Services.BaseService.GetList("SelectPSPDIRByFileType", dir); DataTable datasvg2 = Itop.Common.DataConverter.ToDataTable(list2, typeof(PSPDIR)); //datasvg.Merge(datasvg2); dataGridView1.DataSource = datasvg2; } }
private void simpleButton4_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { string guid = dataGridView1.SelectedRows[0].Cells["Column2"].Value.ToString(); PSPDIR pspDIR = new PSPDIR(); pspDIR.FileGUID = guid; pspDIR = Services.BaseService.GetOneByKey <PSPDIR>(pspDIR); SVGFILE svgFile = new SVGFILE(); svgFile.SUID = guid; svgFile = Services.BaseService.GetOneByKey <SVGFILE>(svgFile); if (pspDIR != null && svgFile != null) { frmSvgFile frmFile = new frmSvgFile(pspDIR); if (frmFile.ShowDialog() == DialogResult.OK) { pspDIR.FileName = frmFile.SvgFileName; svgFile.FILENAME = frmFile.SvgFileName; Services.BaseService.Update <PSPDIR>(pspDIR); Services.BaseService.Update <SVGFILE>(svgFile); InitData(); } } } }
private void simpleButton1_MouseDown(object sender, MouseEventArgs e) { if (textBox1.Text == "") { MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); return; } else { PSPDIR pspDIR = new PSPDIR(); pspDIR.FileName = textBox1.Text; IList list = Services.BaseService.GetList("SelectPSPDIRByFileName", pspDIR); if (list.Count > 1 || (list.Count == 1 && UID != ((PSPDIR)list[0]).FileGUID)) { MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); return; } else { simpleButton1.DialogResult = DialogResult.OK; } } }
private void InitData(PSPDIR pspDIR) { if (pspDIR.FileName != null) { textBox1.Text = pspDIR.FileName; } if (pspDIR.FileType != null) { textBox2.Text = pspDIR.FileType; } UID = pspDIR.FileGUID; }
public frmSvgFile(PSPDIR pspDIR) { InitializeComponent(); InitData(pspDIR); textBox1.Focus(); }