1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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();
        }
    }
}