Ejemplo n.º 1
0
        private void btn_ds_x_Click(object sender, EventArgs e)
        {
            dausach_DTO ds = new dausach_DTO();

            ds.mads = txb_ds_mds.Text;
            int check = ds_bus.xoa(ds);

            try
            {
                if (check == 0)
                {
                    MessageBox.Show("Mời nhập mã đầu sách muốn xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (check == -1)
                {
                    MessageBox.Show("Mã đầu sách không tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (check == 1)
                {
                    Urc_dausach_Load(sender, e);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        public bool xoads(dausach_DTO ds)
        {
            if (getdata("select * from Dau_Sach where MaDS=N'" + ds.mads + "'").Rows.Count == 0)
            {
                return(false);
            }
            string sql = string.Format("dbo.delete_dausach N'{0}'", ds.mads);

            Execute(sql);
            return(true);
        }
Ejemplo n.º 3
0
        public bool suads(dausach_DTO ds)
        {
            if (getdata("select * from Dau_Sach where MaDS=N'" + ds.mads + "'").Rows.Count == 0)
            {
                return(false);
            }
            string sql = string.Format("dbo.update_dausach N'{0}',N'{1}',N'{2}',N'{3}',N'{4}',N'{5}'", ds.mads, ds.tends, ds.linhvuc, ds.nxb, ds.tg, ds.ngxb);

            Execute(sql);
            return(true);
        }
Ejemplo n.º 4
0
 public int xoa(dausach_DTO ds)
 {
     if (string.IsNullOrEmpty(ds.mads))
     {
         return(0);
     }
     if (ds_dal.xoads(ds) == false)
     {
         return(-1);
     }
     return(1);
 }
Ejemplo n.º 5
0
 public int sua(dausach_DTO ds)
 {
     if (string.IsNullOrEmpty(ds.mads) || string.IsNullOrEmpty(ds.tends) || string.IsNullOrEmpty(ds.linhvuc) || string.IsNullOrEmpty(ds.nxb) || string.IsNullOrEmpty(ds.tg) || string.IsNullOrEmpty(ds.ngxb))
     {
         return(0);
     }
     if (ds_dal.suads(ds) == false)
     {
         return(-1);
     }
     return(1);
 }
Ejemplo n.º 6
0
        private void btn_ds_t_Click(object sender, EventArgs e)
        {
            dausach_DTO ds = new dausach_DTO();

            ds.mads    = txb_ds_mds.Text;
            ds.tends   = txb_ds_tds.Text;
            ds.linhvuc = txb_ds_lv.Text;
            ds.nxb     = txb_ds_nxb.Text;
            ds.tg      = txb_ds_tg.Text;
            ds.ngxb    = txb_ds_ngxb.Text;
            int check = ds_bus.them(ds);

            try
            {
                if (check == 0)
                {
                    MessageBox.Show("Mời nhập đầy đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (check == -1)
                {
                    MessageBox.Show("Mã đầu sách đã tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (check == 1)
                {
                    Urc_dausach_Load(sender, e);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            txb_ds_mds.Text  = "";
            txb_ds_tds.Text  = "";
            txb_ds_lv.Text   = "";
            txb_ds_tg.Text   = "";
            txb_ds_nxb.Text  = "";
            txb_ds_ngxb.Text = "";
        }