private void btnCheck_Click(object sender, EventArgs e) { if (checkDataInput() == true) { eDiskRental dr = new eDiskRental(); //MessageBox.Show(cmbDiskID.Text); dr = drbll.getDiskNoRentalByDiskID(Convert.ToInt32(cmbDiskID.Text)); eRental r = new eRental(); r = rbll.getOneRental(dr.RentalID); eCustomer c = new eCustomer(); c = cbll.getOneCustomer(r.CustomerID); eDisk ed = new eDisk(); ed = dbll.getOneDisk(dr.DiskID); eTitle et = new eTitle(); et = tbll.getOneTitle(ed.TitleID); eLateCharge elc = new eLateCharge(); elc = lcbll.getOneLateCharge(c.CustomerID, ed.DiskID); lblCustomerName.Text = c.CustomerName; lblCusTomerID.Text = c.CustomerID.ToString(); lblAddress.Text = c.Address; lblPhoneNumber.Text = c.PhoneNumber; lblRentalDate.Text = r.RentalDate.ToString(); lblTitleID.Text = et.TitleName; lblLateCharge.Text = elc.LateCharge.ToString(); //MessageBox.Show(r.CustomerID.ToString()); } }
public void updateTitle(eTitle title) { tbl_Title temp = db.tbl_Titles.Where(x => x.TitleID == title.TitleID).FirstOrDefault(); temp.TitleName = title.TitleName; temp.RentalPeriod = title.RentalPeriod; temp.RentalCharge = title.RentalCharge; temp.TitleStatus = title.TitleStatus; temp.Quantity = title.Quantity; db.SubmitChanges(); }
public void insertTitle(eTitle title) { tbl_Title temp = new tbl_Title(); temp.TitleName = title.TitleName; temp.RentalPeriod = title.RentalPeriod; temp.RentalCharge = title.RentalCharge; temp.TitleStatus = title.TitleStatus; temp.Quantity = title.Quantity; db.tbl_Titles.InsertOnSubmit(temp); db.SubmitChanges(); }
public void insertTitle(eTitle item) { data = new DvdRentDbDataContext(); data.Titles.InsertOnSubmit(new Title() { PhiTre = item.PhiTre, ThoiGianThue = item.ThoiGianThue, Gia = item.GiaThue, Ten = item.TenTitle, TheLoai = item.TheLoai, TrangThai = item.TrangThai1 }); data.SubmitChanges(); }
public eTitle getTitleByID(int id) { eTitle t = new eTitle(); var temp = db.tbl_Titles.Where(x => x.TitleID == id).FirstOrDefault(); t.TitleID = temp.TitleID; t.TitleName = temp.TitleName; t.RentalPeriod = Convert.ToInt32(temp.RentalPeriod); t.RentalCharge = Convert.ToInt32(temp.RentalCharge); t.TitleStatus = temp.TitleStatus; t.Quantity = Convert.ToInt32(temp.Quantity); return(t); }
public eTitle getOneTitle(int tid) { var item = db.tbl_Titles.Where(x => x.TitleID == tid).FirstOrDefault(); eTitle temp = new eTitle(); temp.TitleID = tid; temp.TitleName = item.TitleName; temp.RentalPeriod = Convert.ToInt32(item.RentalPeriod); temp.RentalCharge = Convert.ToInt32(item.RentalCharge); temp.TitleStatus = item.TitleStatus; temp.Quantity = Convert.ToInt32(item.Quantity); return(temp); }
private void btnAdd_Click(object sender, EventArgs e) { if (checkDataInput() == true) { eTitle title = new eTitle(); title.TitleName = txtTitleName.Text; title.RentalPeriod = Convert.ToInt32(txtRentalPeriod.Text); title.RentalCharge = Convert.ToDecimal(txtRentalCharge.Text); title.TitleStatus = txtTitleStatus.Text; title.Quantity = Convert.ToInt32(txtQuantity.Text); titlebll.insertTitle(title); LoadDataGridView(dgvTitle, titlebll.getAllTitle()); } }
private void btnUpdate_Click(object sender, EventArgs e) { if (checkDataInput() == true) { eTitle temp = new eTitle(); temp.TitleID = Convert.ToInt32(lblID.Text); temp.TitleName = txtTitleName.Text; temp.RentalPeriod = Convert.ToInt32(txtRentalPeriod.Text); temp.RentalCharge = Convert.ToInt32(txtRentalCharge.Text); temp.TitleStatus = txtTitleStatus.Text; temp.Quantity = Convert.ToInt32(txtQuantity.Text); titlebll.updateTitle(temp); LoadDataGridView(dgvTitle, titlebll.getAllTitle()); } }
public List <eTitle> getAllTitle() { List <eTitle> ls = new List <eTitle>(); foreach (tbl_Title item in db.tbl_Titles.ToList()) { eTitle temp = new eTitle(); temp.TitleID = item.TitleID; temp.TitleName = item.TitleName; temp.RentalPeriod = Convert.ToInt32(item.RentalPeriod); temp.RentalCharge = Convert.ToInt32(item.RentalCharge); temp.TitleStatus = item.TitleStatus; temp.Quantity = Convert.ToInt32(item.Quantity); ls.Add(temp); } return(ls); }
//public bool checkInput() //{ // foreach(eDiskRental item in diskrentalbll.getAllDiskRentalByRentalID(Convert.ToInt32(rentalid))) // { // if (item.DiskID== Convert.ToInt32(cmbDiskID.Text)) // { // MessageBox.Show("Dia nay da duoc thue, ban hay chon dia khac"); // cmbDiskID.Clear(); // cmbDiskID.Focus(); // return false; // } // } // return true; //} private void btnAdd_Click(object sender, EventArgs e) { try { if (checkDataInput() == true) { eDiskRental d = new eDiskRental(); label1.Text = rentalid.ToString(); d.RentalID = Convert.ToInt32(label1.Text); d.DiskID = Convert.ToInt32(cmbDiskID.Text); d.Status = 0; d.ReturnDate = Convert.ToDateTime(DateTime.Now.ToString()); diskrentalbll.insertDiskRental(d); //diskrentalbll.ins(rental); // MessageBox.Show(DateTime.Now.ToString()); LoadDataGridView1(dgvDiskRental, diskrentalbll.getAllDiskRentalByRentalID(Convert.ToInt32(label1.Text))); //int tid = diskrentalbll.getTitleIDByDiskID(Convert.ToInt32(cmbDiskID.Text)); //decimal chargedisk = diskrentalbll.getRentalCharge(tid); //decimal sumrental = Convert.ToDecimal(txtSumRentCharge.Text) + chargedisk; //int tid = dbll.getTitleIDByDiskID(Convert.ToInt32(cmbDiskID.Text)); eDisk ed = new eDisk(); ed = dbll.getOneDisk(Convert.ToInt32(cmbDiskID.Text)); eTitle titletemp = tbll.getOneTitle(Convert.ToInt32(ed.TitleID)); //MessageBox.Show(titletemp.RentalCharge.ToString()); decimal chargedisk = tbll.getRentalCharge(Convert.ToInt32(titletemp.RentalCharge)); decimal sumrental = Convert.ToDecimal(txtSumRentCharge.Text) + titletemp.RentalCharge; txtSumRentCharge.Text = sumrental.ToString(); } } catch (Exception) { MessageBox.Show("ma dia nay khong ton tai tronghe thong, vui long chon lai"); cmbDiskID.Text = ""; cmbDiskID.Focus(); } }
private eTitle ReadTitle() { bool InvalidTitle = true; eTitle validTitle = eTitle.NONE; do { consoleService.WriteLine(Constants.Messages.ValidTitles); string title = ReadValueFromUser("Title").ToUpper(); if (Enum.TryParse(title, out validTitle)) { InvalidTitle = false; } else { consoleService.WriteLine(Constants.Messages.InvalidTitle); this.PressEnterToContinue(); } } while (InvalidTitle); return(validTitle); }