Ejemplo n.º 1
0
    protected void bntThem_Click(object sender, EventArgs e)
    {
        {
            if ((txtMaNguyenLieu.Text != "") && (txtTenNguyenLieu.Text != "") && (txtDonVi.Text != "") && (txtHamLuong.Text != "") && (txtTong.Text != ""))
            {
                try
                {
                    ThemNguyenLieu(txtMaNguyenLieu.Text, txtTenNguyenLieu.Text, txtHamLuong.Text, txtDonVi.Text, txtTong.Text);

                    DgNhapNguyenLieu.DataSource = dsNguyenLieu();
                    DgNhapNguyenLieu.DataBind();
                    DgNhapNguyenLieu.HeaderRow.Cells[0].Text = "Mã Nguyên Liệu  ";
                    DgNhapNguyenLieu.HeaderRow.Cells[1].Text = "Tên Nguyên Liệu   ";
                    DgNhapNguyenLieu.HeaderRow.Cells[2].Text = "Hàm Lượng  ";
                    DgNhapNguyenLieu.HeaderRow.Cells[3].Text = "Đơn Vị    ";
                    DgNhapNguyenLieu.HeaderRow.Cells[4].Text = "Tổng   ";
                    txtMaNguyenLieu.Text  = "";
                    txtTenNguyenLieu.Text = "";
                    txtHamLuong.Text      = "";
                    txtDonVi.Text         = "";
                    txtTong.Text          = "";

                    lblTB.Text = "Đã thêm vào thành công.";
                }
                catch
                {
                    lblTB.Text = "Không thể thêm thông tin này. Vui lòng kiểm tra lại.";
                }
            }
            else
            {
                lblTB.Text = "Không thể thêm thông tin này. Vui lòng kiểm tra lại.";
            }
        }
    }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DgNhapNguyenLieu.DataSource = dsNguyenLieu();
     DgNhapNguyenLieu.DataBind();
     DgNhapNguyenLieu.HeaderRow.Cells[0].Text = "Mã Nguyên Liệu  ";
     DgNhapNguyenLieu.HeaderRow.Cells[1].Text = "Tên Nguyên Liệu   ";
     DgNhapNguyenLieu.HeaderRow.Cells[2].Text = "Hàm Lượng  ";
     DgNhapNguyenLieu.HeaderRow.Cells[3].Text = "Đơn Vị    ";
     DgNhapNguyenLieu.HeaderRow.Cells[4].Text = "Tổng   ";
 }
Ejemplo n.º 3
0
 protected void bntXoa_Click(object sender, EventArgs e)
 {
     if (txtMaNguyenLieu.Text == "")
     {
         lblTB.Text = "Không thể xóa thông tin này. Vui lòng kiểm tra lại.";
     }
     else
     {
         Xoa_NguyenLieu(txtMaNguyenLieu.Text);
         DgNhapNguyenLieu.DataSource = dsNguyenLieu();
         DgNhapNguyenLieu.DataBind();
         DgNhapNguyenLieu.HeaderRow.Cells[0].Text = "Mã Nguyên Liệu  ";
         DgNhapNguyenLieu.HeaderRow.Cells[1].Text = "Tên Nguyên Liệu   ";
         DgNhapNguyenLieu.HeaderRow.Cells[2].Text = "Hàm Lượng  ";
         DgNhapNguyenLieu.HeaderRow.Cells[3].Text = "Đơn Vị    ";
         DgNhapNguyenLieu.HeaderRow.Cells[4].Text = "Tổng   ";
         txtMaNguyenLieu.Text  = "";
         txtTenNguyenLieu.Text = "";
         txtHamLuong.Text      = "";
         txtDonVi.Text         = "";
         txtTong.Text          = "";
         lblTB.Text            = "Xóa thành công !";
     }
 }