Ejemplo n.º 1
0
        public static classDocGia TimDocGia(string id)
        {
            classDocGia res = null;

            res = connect.FindDocgia(id);
            return(res);
        }
Ejemplo n.º 2
0
        public static bool SuaDocGia(classDocGia new_dg, string ID)
        {
            bool res = connect.editDocgia(new_dg, ID);

            //truy van csdl theo id roi sua,sua khong thanh cong return 0
            return(res);
        }
Ejemplo n.º 3
0
        public void sua_docgia(object sender, EventArgs e)
        {
            // MessageBox.Show("sua doc gia");
            classDocGia new_dg = new classDocGia(qldg_boxTen.Text, qldg_dtBD.Value, qldg_dtKT.Value, qldg_boxDV.Text);

            classSua.SuaDocGia(new_dg, qldg_boxID.Text);
        }
Ejemplo n.º 4
0
        public static classDocGia FindDocgia(string Ma)
        {
            classDocGia s     = new classDocGia();
            DataTable   table = null;

            if (isConnect())
            {
                SqlCommand com = new SqlCommand();
                com.CommandText = "select * from docgia where Madocgia= '" + Ma + "'";
                com.CommandType = CommandType.Text;
                com.Connection  = con;
                SqlDataAdapter adap = new SqlDataAdapter(com);
                table = new DataTable();
                adap.Fill(table);
                SqlDataReader dr = com.ExecuteReader();
                if (dr.Read())
                {
                    s.ten   = dr[1].ToString().Trim();
                    s.tgbd  = Convert.ToDateTime(dr[2]);
                    s.tgkt  = Convert.ToDateTime(dr[3]);
                    s.donvi = dr[4].ToString();
                }
            }
            return(s);
        }
Ejemplo n.º 5
0
        public void them_docgia(object sender, EventArgs e)
        {
            // MessageBox.Show("them doc gia");
            classDocGia new_dg = new classDocGia(qldg_boxTen.Text, qldg_dtBD.Value, qldg_dtKT.Value, qldg_boxDV.Text);

            classThem.ThemDocGia(new_dg);
        }
Ejemplo n.º 6
0
 public static bool ThemDocGia(classDocGia doc_gia)
 {
     bool res ;
     res = connect.insertDocGia(doc_gia);
     //truy van csdl them doc gia, thanh cong return 1, khong thanh cong return 0
     return res ;
 }
Ejemplo n.º 7
0
        public static bool ThemDocGia(classDocGia doc_gia)
        {
            bool res;

            res = connect.insertDocGia(doc_gia);
            //truy van csdl them doc gia, thanh cong return 1, khong thanh cong return 0
            return(res);
        }
Ejemplo n.º 8
0
        public void tim_docgia(object sender, EventArgs e)
        {
            classDocGia dg = classTim.TimDocGia(qldg_boxID.Text);

            qldg_boxID.Text  = dg.id;
            qldg_boxTen.Text = dg.ten;
            qldg_dtBD.Value  = Convert.ToDateTime(dg.tgbd);
            qldg_dtKT.Value  = Convert.ToDateTime(dg.tgkt);
            qldg_boxDV.Text  = dg.donvi;
            // MessageBox.Show("tim doc gia");
        }
Ejemplo n.º 9
0
        private void qlmt_linkDG_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            classDocGia docgia = classTim.TimDocGia(qlmt_boxDG.Text);

            if (docgia == null)
            {
                MessageBox.Show("không có độc giả này");
                return;
            }
            qlmt_labTen.Text = docgia.ten;
            qlmt_labDV.Text  = docgia.donvi;
        }
Ejemplo n.º 10
0
        private void qldg_linkTim_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            classDocGia dg = classTim.TimDocGia(qldg_boxID.Text);

            if (dg != null)
            {
                qldg_boxID.Text  = dg.id;
                qldg_boxTen.Text = dg.ten;
                qldg_dtBD.Value  = Convert.ToDateTime(dg.tgbd);
                qldg_dtKT.Value  = Convert.ToDateTime(dg.tgkt);
                qldg_boxDV.Text  = dg.donvi;
            }
            else
            {
                MessageBox.Show("Không tìm thấy");
            }
        }
Ejemplo n.º 11
0
        public static bool insertDocGia(classDocGia s)
        {
            bool isInsert = false;

            if (isConnect())
            {
                SqlCommand com = new SqlCommand();
                com.CommandText = "Add_DocGia";
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.AddWithValue("@ten", s.ten);
                com.Parameters.AddWithValue("@tgbd", s.tgbd);
                com.Parameters.AddWithValue("@tgkt", s.tgkt);
                com.Parameters.AddWithValue("@dv", s.donvi);
                com.Connection = con;
                int i = com.ExecuteNonQuery();
                isInsert = i > 0 ? true : false;
            }
            return(isInsert);
        }
Ejemplo n.º 12
0
 public static bool editDocgia(classDocGia s, string id)
 {
     bool isEdit = false;
     if (isConnect())
     {
         SqlCommand com = new SqlCommand();
         com.CommandText = "update DocGia set Ten=@ten,ngaybatdau=@nbd,ngayketthuc=@nkt,donvi=@dv where Madocgia=@id";
         com.CommandType = CommandType.Text;
         com.Parameters.AddWithValue("@ten", s.ten);
         com.Parameters.AddWithValue("@nbd", s.tgbd);
         com.Parameters.AddWithValue("@nkt", s.tgkt);
         com.Parameters.AddWithValue("@dv", s.donvi);
         com.Parameters.AddWithValue("@id", id);
         com.Connection = con;
         int i = com.ExecuteNonQuery();
         isEdit = i > 0 ? true : false;
     }
     return isEdit;
 }
Ejemplo n.º 13
0
        public static bool editDocgia(classDocGia s, string id)
        {
            bool isEdit = false;

            if (isConnect())
            {
                SqlCommand com = new SqlCommand();
                com.CommandText = "update DocGia set Ten=@ten,ngaybatdau=@nbd,ngayketthuc=@nkt,donvi=@dv where Madocgia=@id";
                com.CommandType = CommandType.Text;
                com.Parameters.AddWithValue("@ten", s.ten);
                com.Parameters.AddWithValue("@nbd", s.tgbd);
                com.Parameters.AddWithValue("@nkt", s.tgkt);
                com.Parameters.AddWithValue("@dv", s.donvi);
                com.Parameters.AddWithValue("@id", id);
                com.Connection = con;
                int i = com.ExecuteNonQuery();
                isEdit = i > 0 ? true : false;
            }
            return(isEdit);
        }
Ejemplo n.º 14
0
 public static bool insertDocGia(classDocGia s)
 {
     bool isInsert = false;
     if (isConnect())
     {
         SqlCommand com = new SqlCommand();
         com.CommandText = "Add_DocGia";
         com.CommandType = CommandType.StoredProcedure;
         com.Parameters.AddWithValue("@ten", s.ten);
         com.Parameters.AddWithValue("@tgbd", s.tgbd);
         com.Parameters.AddWithValue("@tgkt", s.tgkt);
         com.Parameters.AddWithValue("@dv", s.donvi);
         com.Connection = con;
         int i = com.ExecuteNonQuery();
         isInsert = i > 0 ? true : false;
     }
     return isInsert;
 }
Ejemplo n.º 15
0
 public static int ThemDocGia(classDocGia doc_gia)
 {
     int res = 0;
     //truy van csdl them doc gia, thanh cong return 1, khong thanh cong return 0
     return res ;
 }
Ejemplo n.º 16
0
 public static int SuaDocGia(classDocGia new_dg, string ID)
 {
     //truy van csdl theo id roi sua,sua khong thanh cong return 0
     return 1;
 }
Ejemplo n.º 17
0
 public void them_docgia(object sender, EventArgs e)
 {
     // MessageBox.Show("them doc gia");
     classDocGia new_dg = new classDocGia(qldg_boxTen.Text, qldg_dtBD.Value, qldg_dtKT.Value, qldg_boxDV.Text);
     classThem.ThemDocGia(new_dg);
 }
Ejemplo n.º 18
0
 public void sua_docgia(object sender, EventArgs e)
 {
     // MessageBox.Show("sua doc gia");
     classDocGia new_dg = new classDocGia(qldg_boxTen.Text,qldg_dtBD.Value,qldg_dtKT.Value,qldg_boxDV.Text);
     classSua.SuaDocGia(new_dg, qldg_boxID.Text);
 }
Ejemplo n.º 19
0
        public static classDocGia FindDocgia(string Ma)
        {
            classDocGia s = new classDocGia();
            DataTable table = null;
            if (isConnect())
            {
                SqlCommand com = new SqlCommand();
                com.CommandText = "select * from docgia where Madocgia= '" + Ma + "'";
                com.CommandType = CommandType.Text;
                com.Connection = con;
                SqlDataAdapter adap = new SqlDataAdapter(com);
                table = new DataTable();
                adap.Fill(table);
                SqlDataReader dr = com.ExecuteReader();
                if (dr.Read())
                {
                    s.ten = dr[1].ToString().Trim();
                    s.tgbd = Convert.ToDateTime(dr[2]);
                    s.tgkt = Convert.ToDateTime(dr[3]);
                    s.donvi = dr[4].ToString();

                }
            }
            return s;
        }
Ejemplo n.º 20
0
 public static bool SuaDocGia(classDocGia new_dg, string ID)
 {
     bool res = connect.editDocgia(new_dg, ID);
     //truy van csdl theo id roi sua,sua khong thanh cong return 0
     return res;
 }