王 垚
2022-06-27 2ffc4b7794e47bd8cf9f7b9662b0f92322406bb7
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
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using SQLHelper;
 
namespace DAL
{
    public class ClsUser
    {
        ClsCN oCn = new ClsCN();
        public  string UserCode;
        public string UserName;
        public string Psd;
        public bool AddCzymc()
        {
            oCn.RunProc("insert into Gy_Czygl(Czybm,Czymc,Czmm) values('" + this.UserCode + "','" +
                this.UserName + "','" + this.Psd + "')");
            return true;
        }
        public bool DeleteCzymc(string ID)
        {
            oCn.RunProc("delete from Gy_Czygl where Czybm='" + ID + "'");
            return true;
        }
        public DataSet GetAllUser()
        {
            return (oCn.RunProcReturn("select * from Gy_Czygl",  "Gy_Czygl"));
        }
        public bool UpdateCzymc(string ID)
        {
            oCn.RunProc("update Gy_Czygl set Czymc='" + this.UserName + "',Czmm='" + this.Psd + "' where Czybm='" + ID + "'");
            return true;
        }
        public DataSet  CheckCzymc(string sUser, string sPsd)
        {
            SqlParameter[] prams ={oCn.MakeInParam("@Czymc",SqlDbType.VarChar,100,sUser ),
                                    oCn.MakeInParam("@Czmm",SqlDbType.VarChar ,100,sPsd ),
            };
            return oCn.RunProcReturn("select * from Gy_Czygl where Czymc='" + sUser + "' and Czmm='" + sPsd + "' ", prams, "Gy_Czygl");
        }
        public DataSet CheckCzymc_AB(string sUser, string sPsd)
        {
            SqlParameter[] prams ={oCn.MakeInParam("@Czymc",SqlDbType.VarChar,100,sUser ),
                                    oCn.MakeInParam("@Czmm",SqlDbType.VarChar ,100,sPsd ),
            };
            return oCn.RunProcReturn("select * from Gy_Czygl where Czymc='" + sUser + "' and HICNumber='" + sPsd + "' ", prams, "Gy_Czygl");
        }
        public DataSet GetUserByMainID(string MainID)
        {
            SqlParameter[] prams={oCn.MakeInParam("@MainID",SqlDbType.VarChar,30,MainID)
            };
            return (oCn.RunProcReturn("select * from Gy_Czygl where Czybm=@MainID ",prams,"Gy_Czygl"));
        }
 
        public bool ChangePsd()
        {
            try
            {
                oCn.RunProc("update Gy_Czygl set Czmm='" + this.Psd + "' where Czymc='" + this.UserCode + "'");
                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
 
        public DataSet CheckMainID(string MainID, string sPsd)
        {
            DataSet DS;
            try
            {
                DS = oCn.RunProcReturn("select * from Gy_Czygl where Czybm='" + MainID + "' and Czmm='" + sPsd + "' ", "Gy_Czygl");
                if (DS.Tables[0].Rows.Count == 0)
                    return null;
                else
                {
                    return DS;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
    }
 
}