示例#1
0
        public LoaiDT GetOneLoai(string id)
        {
            DataTable dt = db.GetData("SELECT * FROM loaiDT WHERE maLoaiDT='" + id + "'");
            LoaiDT    l  = new LoaiDT();

            l.maLoaiDT     = dt.Rows[0][0].ToString();
            l.maHoaDonNhap = dt.Rows[0][1].ToString();
            l.tenLoaiDT    = dt.Rows[0][2].ToString();
            l.soLuong      = int.Parse(dt.Rows[0][3].ToString());
            l.ngaySanXuat  = dt.Rows[0][4].ToString();
            return(l);
        }
示例#2
0
        public List <LoaiDT> GetAllLoai()
        {
            DataTable     dt = db.GetData("SELECT * FROM loaiDT");
            List <LoaiDT> li = new List <LoaiDT>();

            foreach (DataRow dr in dt.Rows)
            {
                LoaiDT l = new LoaiDT();
                l.maLoaiDT     = dr[0].ToString();
                l.maHoaDonNhap = dr[1].ToString();
                l.tenLoaiDT    = dr[2].ToString();
                l.soLuong      = int.Parse(dr[3].ToString());
                l.ngaySanXuat  = dr[4].ToString();
                li.Add(l);
            }
            return(li);
        }
示例#3
0
        public void suaLdt(LoaiDT x)
        {
            string sql = "UPDATE loaiDT SET maHoaDonNhap = N'" + x.maHoaDonNhap + "', tenLoaiDT = N'" + x.tenLoaiDT + "', soLuong = '" + x.soLuong + "', ngaySanXuat = '" + getDate(x.ngaySanXuat) + "' WHERE maLoaiDT = '" + x.maLoaiDT + "'";

            db.WriteData(sql);
        }
示例#4
0
        public void themLdt(LoaiDT x)
        {
            string sql = "INSERT INTO loaiDT VALUES('" + x.maLoaiDT + "','" + x.maHoaDonNhap + "',N'" + x.tenLoaiDT + "','" + x.soLuong + "','" + getDate(x.ngaySanXuat) + "')";

            db.WriteData(sql);
        }