public bool sua(muonTra m)
 {
     if (string.IsNullOrEmpty(m.maMuon))
     {
         return(false);
     }
     muon.update(m);
     return(true);
 }
Exemplo n.º 2
0
        public bool insertp(muonTra muon)
        {
            if (dataTable("select * from CTMT where MaMuon ='" + muon.maMuon + "' and MaSach = '" + muon.maSach + "'").Rows.Count > 0)
            {
                return(false);
            }
            string sqlCommand = string.Format("insert into CTMT (MaMuon, MaSach, TrangThai, GhiChu) values ('{0}','{1}','{2}',N'{3}')", muon.maMuon, muon.maSach, muon.trangThai, muon.ghiChu);

            Excute(sqlCommand);
            return(true);
        }
Exemplo n.º 3
0
        public bool insert(muonTra muon)
        {
            if (dataTable("select * from MUONTRA where MaMuon ='" + muon.maMuon + "'").Rows.Count > 0)
            {
                return(false);
            }
            string sqlCommand = string.Format("insert into MUONTRA values ('{0}','{1}','{2}','{3}','{4}')", muon.maMuon, muon.maThe, muon.maNV, muon.ngayMuon, muon.ngayHan);

            Excute(sqlCommand);
            return(true);
        }
        private void Insert(object sender, EventArgs e)
        {
            try
            {
                muonTra mt = new muonTra();
                mt.maMuon   = ID.Text;
                mt.ngayMuon = BorrowingDate.Value.ToString();
                mt.ngayHan  = DueDate.Value.ToString();
                mt.maThe    = IDCard.SelectedValue.ToString();
                mt.maNV     = IDManager.Text;
                if (mt.isNull() || checkedListBoxControl1.CheckedItems.Count <= 0)
                {
                    toolTip1.ToolTipTitle = "Warning";
                    toolTip1.Show("Please enter full information", windowsUIButtonPanel1, windowsUIButtonPanel1.Location, 5000);
                    return;
                }
                else
                {
                    if (muonTra.them(mt))
                    {
                        foreach (int itemIndex in checkedListBoxControl1.CheckedIndices)
                        {
                            mt.maSach = checkedListBoxControl1.GetItemValue(itemIndex).ToString();
                            if (muonTra.themp(mt))
                            {
                                sach.capNhatTrangThai(mt.maSach, "Đã mượn");
                            }
                        }

                        BookManagement_Load(sender, e);
                        resetText();
                    }
                    else
                    {
                        if (muonTra.sua(mt))
                        {
                            BookManagement_Load(sender, e);
                            resetText();
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Oops", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public bool themp(muonTra m)
 {
     return(muon.insertp(m));
 }
Exemplo n.º 6
0
        public void update(muonTra muon)
        {
            string sqlCommand = string.Format("update MUONTRA  MaNV = '{0}', NgayMuon = '{1}', NgayHan = '{2}'  where MaMuon = '{3}' ", muon.maNV, muon.ngayMuon, muon.ngayHan, muon.maMuon);

            Excute(sqlCommand);
        }