DbManage_UserInfo.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:6k
- using System;
- using System.Data ;
- using System.Data .SqlClient ;
- using System.Configuration;
- namespace qminoa.DA
- {
- /// <summary>
- /// DbManage_UserInfo 的摘要说明。
- /// </summary>
- public class DbManage_UserInfo
- {
-
- String STRCON = ConfigurationSettings.AppSettings["ConnectionString"];
- SqlCommand mycm;
- DataSet myds;
- SqlDataAdapter myda;
- public DbManage_UserInfo()
- {
- mycm=new SqlCommand ();
- mycm.Connection =new SqlConnection (STRCON);
- mycm.CommandType =CommandType.StoredProcedure ;
- mycm.Connection .Open ();
- myds=new DataSet ();
- myda =new SqlDataAdapter ();
- myda.SelectCommand =mycm;
- }
- public DataTable Getuser(string strIsactive,string strUserkind)
- {
- //CREATE PROCEDURE GetManageUserinfo ( @IsActive varchar (50),@UserKind varchar (50)) AS
- mycm.CommandText ="GetManageUserinfo";
- mycm.Parameters .Add (new SqlParameter ("@IsActive",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@UserKind",SqlDbType.VarChar ,50));
- mycm.Parameters [0].Value =strIsactive;
- mycm.Parameters [1].Value =strUserkind;
- myda.Fill (myds,"userinfo");
- return myds.Tables ["userinfo"];
- }
- public DataTable GetuserByLoginName(string strLoginName)
- {
- //CREATE PROCEDURE GetManageUserinfo ( @IsActive varchar (50),@UserKind varchar (50)) AS
- mycm.CommandText ="GetManageUserByLoginName";
- mycm.Parameters .Add (new SqlParameter ("@LoginName",SqlDbType.VarChar ,20));
- mycm.Parameters [0].Value =strLoginName;
- myda.Fill (myds,"ManageUser");
- return myds.Tables ["ManageUser"];
- }
- //验证登录
- // public String[] checklogin(string strLoginID,string strPassword)
- // {
- // // CREATE PROCEDURE Managechecklogin @LoginName varchar (50),@Password varchar (50) AS
- // mycm.CommandText ="Managechecklogin";
- // mycm.Parameters .Add (new SqlParameter ("@LoginID",SqlDbType.VarChar ,50));
- // mycm.Parameters .Add (new SqlParameter ("@Password",SqlDbType.VarChar ,50));
- // mycm.Parameters [0].Value =strLoginID;
- // mycm.Parameters [1].Value =strPassword;
- // myda.Fill (myds,"checklogin");
- // return myds.Tables ["checklogin"];
- // }
- public void insertUser(string []NewUser)
- {//insert_Manager_Userinfo_1
- // (@Name_1 [varchar](20),
- // @LoginName_2 [varchar](20),
- // @Password_3 [varchar](20),
- // @Email_4 [varchar](50),
- // @Question_5 [varchar](50),
- // @Answer_6 [varchar](50),
- // @UserKind_7 [varchar](50),
- // @Description_8 [varchar](256),
- // @IsActive_9 [varchar](50))
- mycm.CommandText ="insert_Manager_Userinfo_1";
- mycm.Parameters .Add (new SqlParameter ("@Name_1",SqlDbType.VarChar ,20));
- mycm.Parameters .Add (new SqlParameter ("@LoginName_2",SqlDbType.VarChar ,20));
- mycm.Parameters .Add (new SqlParameter ("@Password_3",SqlDbType.VarChar ,20));
- mycm.Parameters .Add (new SqlParameter ("@Email_4",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@Question_5",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@Answer_6",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@UserKind_7",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@Description_8",SqlDbType.VarChar ,256));
- mycm.Parameters .Add (new SqlParameter ("@IsActive_9",SqlDbType.VarChar ,50));
- for(int i=0;i<NewUser.Length;i++)
- {
- mycm.Parameters [i].Value =NewUser[i];
- }
- int j=mycm.ExecuteNonQuery ();
-
- }
- public void updateManager_Userinfo(string []NewUser )
- {
- // CREATE PROCEDURE [update_Manager_Userinfo_1]
- // (@UserID_1 [int],
- // @Name_2 [varchar](20),
- // @LoginName_3 [varchar](20),
- // @Password_4 [varchar](20),
- // @Email_5 [varchar](50),
- // @Question_6 [varchar](50),
- // @Answer_7 [varchar](50),
- // @UserKind_8 [varchar](50),
- // @Description_9 [varchar](256),
- // @IsActive_10 [varchar](50))
- mycm.CommandText ="update_Manager_Userinfo_1";
- mycm.Parameters .Add (new SqlParameter ("@UserID_1",SqlDbType.VarChar ,20));
- mycm.Parameters .Add (new SqlParameter ("@Name_2",SqlDbType.VarChar ,20));
- mycm.Parameters .Add (new SqlParameter ("@LoginName_3",SqlDbType.VarChar ,20));
- //mycm.Parameters .Add (new SqlParameter ("@Password_4",SqlDbType.VarChar ,20));
- mycm.Parameters .Add (new SqlParameter ("@Email_5",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@Question_6",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@Answer_7",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@UserKind_8",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@Description_9",SqlDbType.VarChar ,256));
- mycm.Parameters .Add (new SqlParameter ("@IsActive_10",SqlDbType.VarChar ,50));
- for(int i=0;i<NewUser.Length;i++)
- {
- mycm.Parameters [i].Value =NewUser[i];
- }
- int j=mycm.ExecuteNonQuery ();
-
- }
- public void update_Manager_UserinfoByUser( string[] ChangeUser)
- {
- // USE [qmin]
- // GO
- // CREATE PROCEDURE [update_Manager_Userinfo_2]
- // (@LoginName_1 [varchar],
- // @Password_2 [varchar](20),
- // @Email_3 [varchar](50),
- // @Question_4 [varchar](50),
- // @Answer_5 [varchar](50))
- mycm.CommandText ="update_Manager_Userinfo_2";
-
-
- mycm.Parameters .Add (new SqlParameter ("@LoginName_1",SqlDbType.VarChar ,20));
- mycm.Parameters .Add (new SqlParameter ("@Password_2",SqlDbType.VarChar ,20));
- mycm.Parameters .Add (new SqlParameter ("@Email_3",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@Question_4",SqlDbType.VarChar ,50));
- mycm.Parameters .Add (new SqlParameter ("@Answer_5",SqlDbType.VarChar ,50));
-
- for(int i=0;i<ChangeUser.Length;i++)
- {
- mycm.Parameters [i].Value =ChangeUser[i];
- }
- int j=mycm.ExecuteNonQuery ();
- }
- public void delete_Manager_Userinfo(string UserID)
- {
- // USE [qmin]
- // GO
- // CREATE PROCEDURE [delete_Manager_Userinfo_1]
- // (@UserID_1 [int])
- mycm.CommandText ="delete_Manager_Userinfo_1";
- mycm.Parameters .Add (new SqlParameter ("@UserID_1",SqlDbType.VarChar ,20));
- mycm.Parameters[0].Value =UserID;
- int j=mycm.ExecuteNonQuery ();
- }
- }
- }