Ejemplo n.º 1
0
        public bool Delete_S(Entities.tblSach s)
        {
            bool   kt  = false;
            string sql = "Prd_Sach_Delete";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@Id", SqlDbType.Int).Value = s.Id1;
                cmd.ExecuteNonQuery();
                kt = true;
            }
            catch (Exception)
            {
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(kt);
        }
Ejemplo n.º 2
0
        private void btnhoantat_Click(object sender, EventArgs e)
        {
            ss = new Entities.tblSach();

            if (checkmenu_s == "xoa")
            {
                ss.Id1 = int.Parse(txtId.Text);
                bool kt = bll_ls.Delete_S(ss);
                if (kt)
                {
                    MessageBox.Show("Bạn vừa xóa thành công !", "xóa thành công", MessageBoxButtons.OK);
                    Reset();
                    Load_sach();
                    binding_s();
                    return;
                }
                else
                {
                    MessageBox.Show("Lỗi, Không thể xóa được!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (checkObject_s())
            {
                if (checkmenu_s == "add")
                {
                    ss.MaL1 = txtMaL.Text;
                    ss.MaS1 = txtMaS.Text;
                    bool kt = bll_ls.Insert_Sach(ss);
                    if (kt)
                    {
                        MessageBox.Show("Bạn vừa lưu thành công !", "Thêm thành công", MessageBoxButtons.OK);
                        Reset();
                        Load_sach();
                    }
                    else
                    {
                        MessageBox.Show("Không thành công, xin vui lòng thực hiện lại !", "Thêm không thành công", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                if (checkmenu_s == "sua")
                {
                    ss.Id1  = int.Parse(txtId.Text);
                    ss.MaL1 = txtMaL.Text;
                    ss.MaS1 = txtMaS.Text;
                    bool kt = bll_ls.Update_S(ss);
                    if (kt)
                    {
                        MessageBox.Show("Bạn vừa sửa thành công !", "sửa thành công", MessageBoxButtons.OK);
                        Reset();
                        Load_sach();
                        binding_s();
                    }
                    else
                    {
                        MessageBox.Show("Lỗi, Không thể sửa được! có thể trùng mã nhân viên", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public bool Update_S(Entities.tblSach s)
 {
     return(dal.Update_S(s));
 }
Ejemplo n.º 4
0
 public bool Delete_S(Entities.tblSach s)
 {
     return(dal.Delete_S(s));
 }
Ejemplo n.º 5
0
 public bool Insert_Sach(Entities.tblSach s)
 {
     return(dal.Insert_Sach(s));
 }