using System; 
 | 
using System.Collections.Generic; 
 | 
using System.ComponentModel; 
 | 
using System.Data; 
 | 
using System.Drawing; 
 | 
using System.Text; 
 | 
using System.Windows.Forms; 
 | 
  
 | 
namespace APSM 
 | 
{ 
 | 
    public partial class Gy_WorkTimesDlg : Form 
 | 
    { 
 | 
        public Gy_WorkTimesDlg() 
 | 
        { 
 | 
            InitializeComponent(); 
 | 
        } 
 | 
  
 | 
        private void cmdHBSource_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); 
 | 
            oSource.WherePart = txtHBSource.Text.Trim(); 
 | 
            if (oSource.RefreshView()) 
 | 
            { 
 | 
                txtHBSource.Text = oSource.oModel.HNumber; 
 | 
                txtHBSource.Tag = oSource.oModel.HItemID; 
 | 
                txtHESource.Text = oSource.oModel.HNumber; 
 | 
                txtHESource.Tag = oSource.oModel.HItemID; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                txtHBSource.Text = ""; 
 | 
                txtHBSource.Tag = "0"; 
 | 
                txtHESource.Text = ""; 
 | 
                txtHESource.Tag = "0"; 
 | 
            } 
 | 
        } 
 | 
  
 | 
        private void cmdHESource_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View(); 
 | 
            oSource.WherePart = txtHESource.Text.Trim(); 
 | 
            if (oSource.RefreshView()) 
 | 
            { 
 | 
                txtHESource.Text = oSource.oModel.HNumber; 
 | 
                txtHESource.Tag = oSource.oModel.HItemID; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                txtHESource.Text = ""; 
 | 
                txtHESource.Tag = "0"; 
 | 
            } 
 | 
        } 
 | 
  
 | 
        private void txtHBSource_TextChanged(object sender, EventArgs e) 
 | 
        { 
 | 
            if (txtHBSource.Text.Trim() == "") 
 | 
                txtHBSource.Tag = "0"; 
 | 
                txtHESource.Text = ""; 
 | 
                txtHESource.Tag = "0"; 
 | 
        } 
 | 
  
 | 
        private void txtHESource_TextChanged(object sender, EventArgs e) 
 | 
        { 
 | 
            if (txtHESource.Text.Trim() == "") 
 | 
                txtHESource.Tag = "0"; 
 | 
        } 
 | 
  
 | 
        private void cmdOK_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); 
 | 
            //¹ýÂËÌõ¼þDlg 
 | 
            string sDlgWhere = "";; 
 | 
            sDlgWhere = sDlgWhere + ",'" + txtHBSource.Text.Trim() + "'"; 
 | 
            sDlgWhere = sDlgWhere + ",'" + txtHESource.Text.Trim() + "'"; 
 | 
            sDlgWhere = sDlgWhere + ",'" + dtpHBDate.Value.ToShortDateString() + "'"; 
 | 
            sDlgWhere = sDlgWhere + ",'" + dtpHEDate.Value.ToShortDateString() + "'"; 
 | 
            sDlgWhere = sDlgWhere + "," +DBUtility.ClsPub.isSingle(txtWorktimes.Text).ToString() + ""; 
 | 
            if (sDlgWhere.Trim().Length > 0) 
 | 
            { 
 | 
                sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1); 
 | 
            } 
 | 
            //²»ÄÜ´óÓÚ255 
 | 
            if (dtpHBDate.Value.AddDays(255) < dtpHEDate.Value) 
 | 
            { 
 | 
                MessageBox.Show("ÈÕÆÚ²î²»ÄÜ´óÓÚ255Ì죡"); 
 | 
                return; 
 | 
            } 
 | 
            // 
 | 
            string sErr = ""; 
 | 
            SubCn.RunProcReturn("exec h_p_Gy_InsertPlanShifts " + sDlgWhere, "Gy_Czygl", ref sErr); 
 | 
            if (sErr.Trim() == "") 
 | 
            { 
 | 
                MessageBox.Show("Ö´Ðгɹ¦£¡"); 
 | 
  
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                MessageBox.Show("Ö´ÐÐʧ°Ü£¡"+sErr); 
 | 
            } 
 | 
        } 
 | 
  
 | 
        private void cmdCanal_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            this.Close(); 
 | 
        } 
 | 
    } 
 | 
} 
 |