class Nhanvien

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Data;

using System.Data.SqlClient;

namespace Qlxe

{

class Nhanvien

{

public Nhanvien()

{

KetNoi.MoKetNoi();

}

public bool ktmatkhau(string manv, string matkhau)

{

string st = string.Format("select count (*) from nhanvien where manv = '{0}' and matkhau = '{1}'", manv, matkhau);

SqlCommand cmd = new SqlCommand(st,KetNoi.cn);

if ((int)cmd.ExecuteScalar()!= 0)

return true;

else

return false;

}

public int doimatkhau(string manv, string mkcu, string mkmoi)

{

string st = string.Format("update nhanvien set matkhau = '{0}' where manv = '{1}' and matkhau='{2}'", mkmoi, manv, mkcu);

SqlCommand cmd = new SqlCommand(st, KetNoi.cn);

return (int)cmd.ExecuteNonQuery();

}

public DataSet ThongKeNam(int nam)

{

string st = string.Format("select * from view1 where year(ngaymua)='{0}'",nam);

SqlCommand cmd = new SqlCommand(st, KetNoi.cn);

SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

da.Fill(ds, "TKN");

return ds;

}

}

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: