yangle
2023-03-03 c2a9a460e38c7c196fe98a94e29e6330eac3626f
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
108
109
110
111
112
113
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Pub_Class;
 
namespace OAM
{
    
    public partial class frmOA_LY : Form
    {
        public string UserName;
        public frmOA_LY()
        {
            InitializeComponent();
        }
        public long ID;
 
        private void cmdOK_Click(object sender, EventArgs e)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            if(txtcontext.Text=="")
            {
                MessageBox.Show("ÁôÑÔ²»ÄÜΪ¿Õ");
            
            }
            else
            {
                oCn.RunProc("Insert into OA_LY " +
                       " (Operator,Fdate,context) " +
                       " Values('" + Pub_Class.ClsPub.CurUserName + "','" + DateTime.Now.ToString() + "','" + txtcontext.Text.Trim() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                MessageBox.Show("ÒÑÁôÑÔ");
                this.Close();
            }
        }
        public void Display()
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            
            try
            {
                //²éѯ±í
                DataSet Ds;
                Ds = oCn.RunProcReturn("Select * from OA_LY Where ID='" + ID  + "'", "OA_LY");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    txtOperator.Text = Pub_Class.ClsPub.CurUserName;
                    return;
                }
                //¸³Öµ
                txtID.Text = Ds.Tables[0].Rows[0]["ID"].ToString().Trim();
                txtOperator.Text = Ds.Tables[0].Rows[0]["Operator"].ToString().Trim();
                txtcontext.Text = Ds.Tables[0].Rows[0]["context"].ToString().Trim();
                return;
            }
            catch (Exception e)
            {
                return;
            }
 
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            Display();
        }
        private void cmdCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
 
        private void cmdsc_Click(object sender, EventArgs e)
        { 
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            if (txtOperator.Text == DBUtility.ClsPub.CurUserName)
            {
                if (ID  == 0)
                {
                    MessageBox.Show("ÎÞ´ËÁôÑÔ");
                }
                else
                {
                    DialogResult dr = MessageBox.Show("È·¶¨ÒªÉ¾³ý´Ëµ¥¾ÝÂð£¿", "Ìáʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (dr == DialogResult.Yes)
                    {
                        //if (!DBUtility.ClsPub.Security_Log("OA_Manager", 1, true, DBUtility.ClsPub.CurUserName))
                        //{
                        //    return;
                        //}
                        oCn.RunProc("DELETE FROM OA_LY WHERE id =" + ID + " ", ref DBUtility.ClsPub.sExeReturnInfo);
                        MessageBox.Show("ÁôÑÔÒÑɾ³ý");
                        this.Close();
                    }
                    else
                    {
                    }
                   
                }
            }
            else
            {
 
                MessageBox.Show("¶Ô²»Æð!Ö»ÓÐÁôÑÔÈ˲ÅÄÜɾ£¡");
            }
 
        }
 
       
    }
}