using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace BaseSet { public partial class Gy_ClassTimePrjGroup : Form { public Gy_ClassTimePrjGroup() { InitializeComponent(); } public DBUtility.ClsPub.Enum_InputMode InputMode; //¼Èë״̬±êÖ¾(0-·Ç¼Èë״̬ 1-Ôö¼Ó 2-ÐÞ¸Ä) public long HItemID; DAL.ClsGy_ClassTimePrjGroup_Ctl oUnGp = new DAL.ClsGy_ClassTimePrjGroup_Ctl(); DAL.ClsGy_ClassTimePrjGroup_View oUnGpHlp = new DAL.ClsGy_ClassTimePrjGroup_View(); private void Display() { if (HItemID == 0) { MessageBox.Show("ûÓÐÕÒµ½×飡", "Ìáʾ"); return; } if( oUnGpHlp.GetInfoByID(HItemID)) { DAL.ClsGy_Department_View oDept = new DAL.ClsGy_Department_View(); txtHName.Text = oUnGpHlp.omodel.HName; txtHNumber.Text = oUnGpHlp.omodel.HNumber; txtHRemark.Text = oUnGpHlp.omodel.HRemark; if (oDept.GetInfoByID(oUnGpHlp.omodel.HDeptID)) { txtHDeptID.Text = oDept.omodel.HName; txtHDeptID.Tag = oDept.omodel.HItemID.ToString(); } else { txtHDeptID.Text = ""; } } else { MessageBox.Show("ûÓÐÕÒµ½×飡", "Ìáʾ"); } } private void timer1_Tick(object sender, EventArgs e) { timer1.Enabled = false; if (InputMode == DBUtility.ClsPub.Enum_InputMode.InputMode_AddNew) { txtHName.Text = ""; txtHName.Focus(); } else { Display(); } } private void cmdCancel_Click(object sender, EventArgs e) { this.Close(); } private void cmdOK_Click(object sender, EventArgs e) { oUnGp.oModel.HName = txtHName.Text.Trim(); oUnGp.oModel.HNumber = txtHNumber.Text.Trim(); oUnGp.oModel.HRemark = txtHRemark.Text.Trim(); oUnGp.oModel.HDeptID = DBUtility.ClsPub.isLong(txtHDeptID.Tag); if (InputMode == DBUtility.ClsPub.Enum_InputMode.InputMode_AddNew) { if (!oUnGp.AddNew()) { MessageBox.Show("ÐÂÔöʧ°Ü£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ£¡", "Ìáʾ"); } } else { if (!oUnGp.ModifyByID(HItemID)) { MessageBox.Show("ÐÞ¸Äʧ°Ü£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ£¡", "Ìáʾ"); } } this.Close(); } private void cmdHDeptID_Click(object sender, EventArgs e) { DAL.ClsGy_Department_View oDept = new DAL.ClsGy_Department_View(); if (oDept.RefreshView()) { txtHDeptID.Tag = oDept.oModel.HItemID.ToString(); txtHDeptID.Text = oDept.oModel.HName; } else { txtHDeptID.Text = ""; } } private void txtHDeptID_TextChanged(object sender, EventArgs e) { if (txtHDeptID.Text.Trim() =="") { txtHDeptID.Tag = "0"; } } } }