Example #1
0
        private void btn_AddNew_Click(object sender, EventArgs e)
        {
            if (txt_Name.Text == "")
            {
                messeage.error("Bạn chưa nhập tên đơn vị !");
            }
            else
            {
                ST_unit unit = new ST_unit()
                {
                    unit_name = txt_Name.Text
                };

                bool bInsert = _unitBus.insertVendor(unit);

                if (bInsert)
                {
                    messeage.success("Thêm mới thành công !");
                    this.Close();
                }
                else
                {
                    messeage.error("Không thể thêm mới!");
                }
            }
        }
        private void btn_Update_Click(object sender, EventArgs e)
        {
            if (txt_Name.Text == "")
            {
                messeage.error("Bạn Chưa Nhập Tên Đơn Vị !");
            }
            else
            {
                ST_unit unit = new ST_unit( )
                {
                    unit_name = txt_Name.Text,
                    unit_id   = idUnit
                };

                bool bUpdate = _unit.updateUnit(unit);
                if (bUpdate)
                {
                    messeage.success("Cập Nhật Thành Công !");
                }
                else
                {
                    messeage.error("Cập nhật thất bại !");
                }
            }
        }