Beispiel #1
0
 void ganDuLieu(KhenThuongObjTH Obj)
 {
     Obj.makt     = txt_makt.Text.Trim();;
     Obj.tenkt    = txt_tenkt.Text.Trim();
     Obj.hinhthuc = txt_hinhthuc.Text.Trim();
     Obj.noidung  = txt_noidung.Text.Trim();
     Obj.quydoi   = txt_quydoi.Text.Trim();
 }
        public bool AddData(KhenThuongObjTH Obj)
        {
            cmd.CommandText = " insert into KhenThuong (MaKT,TenKT,HinhThuc,NoiDung,QuyDoiRaTienMat) values('" + Obj.makt + "',N'" + Obj.tenkt + "',N'" + Obj.hinhthuc + "' ,N'" + Obj.noidung + "',N'" + Obj.quydoi + "')";
            cmd.CommandType = CommandType.Text;
            cmd.Connection  = con.Connection;

            try
            {
                con.OpenConn();
                cmd.ExecuteNonQuery();

                return(true);
            }
            catch (Exception ex)
            {
                string mex = ex.Message;
                cmd.Dispose();
                con.CloseConn();
            }

            return(false);
        }
        public bool UpDate(KhenThuongObjTH Obj)
        {
            cmd.CommandText = " update KhenThuong set TenKT = N'" + Obj.tenkt + "' , HinhThuc = N'" + Obj.hinhthuc + "' , NoiDung = N'" + Obj.noidung + "' , QuyDoiRaTienMat = N'" + Obj.quydoi + "' where MaKT = '" + Obj.makt + "'";
            cmd.CommandType = CommandType.Text;
            cmd.Connection  = con.Connection;


            try
            {
                con.OpenConn();
                cmd.ExecuteNonQuery();

                return(true);
            }
            catch (Exception ex)
            {
                string mex = ex.Message;
                cmd.Dispose();
                con.CloseConn();
            }

            return(false);
        }
 public bool upData(KhenThuongObjTH ktObj)
 {
     return(ktMod.UpDate(ktObj));
 }
 public bool addData(KhenThuongObjTH ktObj)
 {
     return(ktMod.AddData(ktObj));
 }