AIMS/DocumentManagement/UI/frmTitle.cs
2022-08-23 21:12:59 +08:00

79 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace DocumentManagement
{
public partial class frmTitle : Form
{
public PrintTemplate model;
public frmTitle()
{
InitializeComponent();
}
private void frmTitle_Load(object sender, EventArgs e)
{
txtFileName.Select();
if (model.XmlFileName != null)
{
txtFileName.Text = model.XmlFileName;
txtFileName.SelectAll();
txtFileName.Focus();
}
}
/// <summary>
/// 取消
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
Close();
}
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSave_Click(object sender, EventArgs e)
{
if (txtFileName.Text.Trim().Equals(string.Empty))
{
MessageBox.Show("文件名不能为空!");
return;
}
if (txtFileName.Text.IndexOf('*') > 0)
{
MessageBox.Show("文件名不能包含*");
return;
}
//if (new DCTemplateDAL().IsFileNameExisted(txtFileName.Text.Trim(),model.Id))
//{
// MessageBox.Show("已存在该模板,请重新输入!");
// txtFileName.Focus();
// txtFileName.SelectAll();
// return;
//}
model.XmlFileName = txtFileName.Text.Trim();
this.DialogResult = DialogResult.OK;
}
private void txtFileName_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
btnSave_Click(null, null);
}
}
}
}