You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
4.4 KiB
128 lines
4.4 KiB
using LIS.Model;
|
|
using NPinyin;
|
|
using PEIS.Base;
|
|
using PEIS.Entity;
|
|
using PEIS.Utils;
|
|
using PEIS.View.Base;
|
|
using System;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PEIS.View.Enrollment
|
|
{
|
|
public partial class NewEnrollmentOrgForm : ViewBase
|
|
{
|
|
BaseOrg _org = null;
|
|
EnrollmentOrg _enOrg = null;
|
|
public NewEnrollmentOrgForm(EnrollmentOrg enrollmentOrg)
|
|
{
|
|
InitializeComponent();
|
|
BtnCancel.Click += BtnCancel_Click;
|
|
BtnOk.Click += BtnOk_Click;
|
|
BtnFind.Click += BtnFind_Click;
|
|
TxtName.KeyDown += TxtName_KeyDown;
|
|
if (enrollmentOrg != null)
|
|
{
|
|
_enOrg = enrollmentOrg;
|
|
BtnFind.Visible = false;
|
|
TxtName.Text = enrollmentOrg.Name;
|
|
DtpExamDate.Value = (DateTime)enrollmentOrg.ExamDate;
|
|
DtpExamDate.Enabled = false;
|
|
TxtInvoiceName.Text = enrollmentOrg.InvoiceName;
|
|
if (enrollmentOrg.IsOccupational)
|
|
{
|
|
occupationFalse.Checked = false;
|
|
occupationTrue.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
occupationFalse.Checked = true;
|
|
occupationTrue.Checked = false;
|
|
}
|
|
occupationTrue.Enabled = false;
|
|
occupationFalse.Enabled = false;
|
|
TxtDescription.Text = enrollmentOrg.Description;
|
|
TxtAddress.Text = enrollmentOrg.Address;
|
|
TxtContactor1.Text = enrollmentOrg.Contactor1;
|
|
TxtTel1.Text = enrollmentOrg.Tel1;
|
|
TxtContactor2.Text = enrollmentOrg.Contactor2;
|
|
TxtTel2.Text = enrollmentOrg.Tel2;
|
|
this.Text = "编辑团体登记信息";
|
|
}
|
|
}
|
|
|
|
private void TxtName_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyData == Keys.Enter)
|
|
{
|
|
BtnFind.PerformClick();
|
|
}
|
|
}
|
|
|
|
void SelectOrg(BaseOrg item)
|
|
{
|
|
_org = item;
|
|
TxtName.Text = item.Name;
|
|
TxtAddress.Text = item.Address;
|
|
TxtContactor1.Text = item.Contactor;
|
|
TxtContactor2.Text = item.Contactor;
|
|
TxtTel1.Text = item.Tel1;
|
|
TxtTel2.Text = item.Tel2;
|
|
TxtInvoiceName.Text = item.InvoiceName;
|
|
}
|
|
|
|
private void BtnFind_Click(object sender, EventArgs e)
|
|
{
|
|
Action<BaseOrg> action = new Action<BaseOrg>(result => SelectOrg(result));
|
|
SelectOrgForm selectOrgForm = new SelectOrgForm(action);
|
|
selectOrgForm.ShowDialog();
|
|
}
|
|
|
|
private void BtnOk_Click(object sender, EventArgs e)
|
|
{
|
|
if (_org == null && _enOrg == null)
|
|
{
|
|
Global.Msg("info", "请选择团体");
|
|
return;
|
|
}
|
|
|
|
EnrollmentOrg enrollmentOrg = new EnrollmentOrg();
|
|
enrollmentOrg.Address = TxtAddress.Text.Trim();
|
|
enrollmentOrg.Contactor1 = TxtContactor1.Text.Trim();
|
|
enrollmentOrg.Contactor2 = TxtContactor2.Text.Trim();
|
|
enrollmentOrg.Tel1 = TxtTel1.Text.Trim();
|
|
enrollmentOrg.Tel2 = TxtTel2.Text.Trim();
|
|
enrollmentOrg.CreateTime = CacheDataModel.GetServerTime();
|
|
enrollmentOrg.Creator = Global.currentUser.Name;
|
|
enrollmentOrg.CreatorCode = Global.currentUser.Code;
|
|
enrollmentOrg.ExamDate = DtpExamDate.Value;
|
|
enrollmentOrg.Name = TxtName.Text.Trim();
|
|
enrollmentOrg.SpellCode = Pinyin.GetInitials(TxtName.Text.Trim(), Encoding.UTF8).ToLower();
|
|
enrollmentOrg.IsOccupational = occupationTrue.Checked;
|
|
enrollmentOrg.InvoiceName = TxtInvoiceName.Text.Trim();
|
|
if (_enOrg == null)
|
|
{
|
|
enrollmentOrg.OID = _org.ID;
|
|
enrollmentOrg.Save();
|
|
}
|
|
else
|
|
{
|
|
enrollmentOrg.OID = _enOrg.OID;
|
|
enrollmentOrg.ID = _enOrg.ID;
|
|
enrollmentOrg.Update();
|
|
}
|
|
Close();
|
|
}
|
|
|
|
private void BtnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
protected override object CreatePresenter()
|
|
{
|
|
return new Presenter<ViewBase>(this);
|
|
}
|
|
|
|
}
|
|
}
|
|
|