protected void grvloaisanpham_RowDeleting(object sender, GridViewDeleteEventArgs e) { string ma = grvloaisanpham.Rows[e.RowIndex].Cells[1].Text; ProcessDatabase.deleteData("DELETE FROM LoaiSanPham WHERE MaLoaiSp='" + ma + "'"); loadKH(); }
protected void grvkhachhang_RowDeleting(object sender, GridViewDeleteEventArgs e) { string ma = grvkhachhang.Rows[e.RowIndex].Cells[1].Text; ProcessDatabase.deleteData("DELETE FROM KhachHang WHERE CustomerID='" + ma + "'"); loadKH(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string ma = grvhoadon.Rows[e.RowIndex].Cells[1].Text; ProcessDatabase.deleteData("DELETE FROM HoaDon WHERE MaHD='" + ma + "'"); LoadHD(); }
protected void grvloaisanpham_RowUpdating(object sender, GridViewUpdateEventArgs e) { string ma = grvloaisanpham.Rows[e.RowIndex].Cells[1].Text; string tenloai = ((TextBox)grvloaisanpham.Rows[e.RowIndex].Cells[2].Controls[0]).Text; string motaloai = ((TextBox)grvloaisanpham.Rows[e.RowIndex].Cells[3].Controls[0]).Text; ProcessDatabase.UpdateData("update LoaiSanPham set TenLoaiSp=N'" + tenloai + "', MotaLoaiSp=N'" + motaloai + "' where MaLoaiSp='" + ma + "'"); grvloaisanpham.EditIndex = -1; loadKH(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string ma = grvhoadonchitiet.Rows[e.RowIndex].Cells[1].Text; string sl = ((TextBox)grvhoadonchitiet.Rows[e.RowIndex].Cells[3].Controls[0]).Text; string tt = ((TextBox)grvhoadonchitiet.Rows[e.RowIndex].Cells[4].Controls[0]).Text; string gg = ((TextBox)grvhoadonchitiet.Rows[e.RowIndex].Cells[5].Controls[0]).Text; ProcessDatabase.UpdateData("update ChiTietHoaDon set SoLuong='" + sl + "', ThanhTien='" + tt + "', MucGiamGia='" + gg + "' where MaHD='" + ma + "'"); grvhoadonchitiet.EditIndex = -1; loadHDCT(); }
public void LoadHD() { try { DataTable temp = ProcessDatabase.getData("SELECT * FROM HoaDon"); grvhoadon.DataSource = temp; grvhoadon.DataBind(); }catch (Exception ex) { Response.Write(ex.Message); } }
private void loadKH() { try { DataTable temp = ProcessDatabase.getData("SELECT * FROM KhachHang"); grvkhachhang.DataSource = temp; grvkhachhang.DataBind(); } catch (Exception ex) { Response.Write(ex.Message); } }
private void loadKH() { try { DataTable temp = ProcessDatabase.getData("SELECT * FROM LoaiSanPham"); grvloaisanpham.DataSource = temp; grvloaisanpham.DataBind(); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void grvkhachhang_RowUpdating(object sender, GridViewUpdateEventArgs e) { string ma = grvkhachhang.Rows[e.RowIndex].Cells[1].Text; string ten = ((TextBox)grvkhachhang.Rows[e.RowIndex].Cells[2].Controls[0]).Text; string phone = ((TextBox)grvkhachhang.Rows[e.RowIndex].Cells[3].Controls[0]).Text; string address = ((TextBox)grvkhachhang.Rows[e.RowIndex].Cells[4].Controls[0]).Text; string ngaysinh = ((TextBox)grvkhachhang.Rows[e.RowIndex].Cells[5].Controls[0]).Text; ProcessDatabase.UpdateData("update KhachHang set Ten=N'" + ten + "', DienThoai='" + phone + "', DiaChi=N'" + address + "', NgaySinh='" + ngaysinh + "' where CustomerID='" + ma + "'"); grvkhachhang.EditIndex = -1; loadKH(); }
public void LoadSP() { try { DataTable tem = ProcessDatabase.getData("SELECT * FROM SanPham"); grvsanpham.DataSource = tem; grvsanpham.DataBind(); } catch (Exception ex) { Response.Write(ex.Message); } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (maloaisanpham.Text == "" || tenloaisanpham.Text == "" || motaloaisanpham.Text == "") { } else { ProcessDatabase.addData("INSERT INTO LoaiSanPham (MaLoaiSp, TenLoaiSp, MotaLoaiSp) VALUES ('" + maloaisanpham.Text + "',N'" + tenloaisanpham.Text + "',N'" + motaloaisanpham.Text + "') "); loadKH(); motaloaisanpham.Text = ""; tenloaisanpham.Text = ""; maloaisanpham.Text = ""; } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (mahoadonlist.Text == "" || masanphamlist.Text == "" || soluong.Text == "" || tongtien.Text == "" || giamgia.Text == "") { } else { ProcessDatabase.addData("INSERT INTO ChiTietHoaDon (MaHD, MaSp, SoLuong, ThanhTien, MucGiamGia) VALUES ('" + mahoadonlist.Text + "','" + masanphamlist.Text + "','" + soluong.Text + "','" + tongtien.Text + "'," + giamgia.Text + ") "); loadHDCT(); soluong.Text = ""; tongtien.Text = ""; giamgia.Text = ""; } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string ma = grvhoadon.Rows[e.RowIndex].Cells[1].Text; string makh = ((TextBox)grvhoadon.Rows[e.RowIndex].Cells[2].Controls[0]).Text; string ndh = ((TextBox)grvhoadon.Rows[e.RowIndex].Cells[3].Controls[0]).Text; string mst = ((TextBox)grvhoadon.Rows[e.RowIndex].Cells[4].Controls[0]).Text; string ngh = ((TextBox)grvhoadon.Rows[e.RowIndex].Cells[5].Controls[0]).Text; string noigh = ((TextBox)grvhoadon.Rows[e.RowIndex].Cells[6].Controls[0]).Text; ProcessDatabase.UpdateData("update HoaDon set CustomerID='" + makh + "', NgayDatHang='" + ndh + "', MaSoThue='" + mst + "', NgayGiaoHang='" + ngh + "', NoiGiaoHang=N'" + noigh + "' where MaHD='" + ma + "'"); grvhoadon.EditIndex = -1; LoadHD(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string ma = grvsanpham.Rows[e.RowIndex].Cells[1].Text; string manhsx = ((TextBox)grvsanpham.Rows[e.RowIndex].Cells[2].Controls[0]).Text; string maloaisanpaham1 = ((TextBox)grvsanpham.Rows[e.RowIndex].Cells[3].Controls[0]).Text; string tensanpham1 = ((TextBox)grvsanpham.Rows[e.RowIndex].Cells[4].Controls[0]).Text; string giasanpham1 = ((TextBox)grvsanpham.Rows[e.RowIndex].Cells[5].Controls[0]).Text; string motasanpham1 = ((TextBox)grvsanpham.Rows[e.RowIndex].Cells[6].Controls[0]).Text; string xuatxusanpham1 = ((TextBox)grvsanpham.Rows[e.RowIndex].Cells[7].Controls[0]).Text; ProcessDatabase.UpdateData("update SanPham set MaNhaSX=N'" + manhsx + "', MaLoaiSp='" + maloaisanpaham1 + "', TenSp=N'" + tensanpham1 + "', GiaSp='" + giasanpham1 + "', MotaSp=N'" + motasanpham1 + "', XuatXuSp=N'" + xuatxusanpham1 + "' where MaSp='" + ma + "'"); grvsanpham.EditIndex = -1; LoadSP(); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (masanpham.Text == "" || maloaisanpham.Text == "" || tensanpham.Text == "" || giasanpham.Text == "" || motasanpham.Text == "" || manhasanxuat.Text == "" || xuatsusanpham.Text == "") { } else { ProcessDatabase.addData("INSERT INTO SanPham (MaSp, MaNhaSX, MaLoaiSp, TenSp, GiaSp, MotaSp, XuatXuSp) VALUES ('" + masanpham.Text + "','" + manhasanxuat.Text + "','" + maloaisanpham.Text + "',N'" + tensanpham.Text + "'," + giasanpham.Text + ",N'" + motasanpham.Text + "',N'" + xuatsusanpham.Text + "') "); LoadSP(); masanpham.Text = ""; manhasanxuat.Text = ""; tensanpham.Text = ""; giasanpham.Text = ""; motasanpham.Text = ""; xuatsusanpham.Text = ""; } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (makhachhang.Text == "" || tenkhachhang.Text == "" || sodienthoai.Text == "" || address.Text == "" || birthofyear.Text == "") { } else { DateTime ngaysinh1 = DateTime.Parse(birthofyear.Text); ProcessDatabase.addData("INSERT INTO KhachHang (CustomerID, Ten, DienThoai, DiaChi, NgaySinh) VALUES ('" + makhachhang.Text + "',N'" + tenkhachhang.Text + "','" + sodienthoai.Text + "',N'" + address.Text + "','" + ngaysinh1 + "') "); loadKH(); makhachhang.Text = ""; tenkhachhang.Text = ""; sodienthoai.Text = ""; address.Text = ""; birthofyear.Text = ""; } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (mahoadon.Text == "" || makhachhanglist.Text == "" || ngaydathang.Text == "" || masothue.Text == "" || ngaygiaohang.Text == "" || noigiaohang.Text == "") { } else { DateTime ngaydh1 = DateTime.Parse(ngaydathang.Text); DateTime ngaygh1 = DateTime.Parse(ngaygiaohang.Text); ProcessDatabase.addData("INSERT INTO HoaDon (MaHD, CustomerID, NgayDatHang, MaSoThue, NgayGiaoHang, NoiGiaoHang) VALUES ('" + mahoadon.Text + "','" + makhachhanglist.Text + "','" + ngaydh1 + "','" + masothue.Text + "','" + ngaygh1 + "',N'" + noigiaohang.Text + "') "); LoadHD(); mahoadon.Text = ""; ngaydathang.Text = ""; masothue.Text = ""; ngaygiaohang.Text = ""; noigiaohang.Text = ""; } }