private static void HRf() { try { string u, p; int eidf; Admin e = new Admin(); ManagerDAL m = new ManagerDAL(); logindelegate ld = new logindelegate(e.Login); Console.WriteLine("Username: "******"Password: "******"HR Functions"); } else { Console.WriteLine("Login Failed. Try Again :("); } } catch (Exception e) { Console.WriteLine(e); } //throw new NotImplementedException(); }
private void LoadData() { listRoom = ManagerDAL.ShowRoomInfo(); dtRoom = ManagerDAL.ToDataTable <Room>(listRoom); dtRoom.Columns.Remove("BookingID"); dgvRooms.DataSource = dtRoom; }
public frmStaffHome(String name) { InitializeComponent(); this.StaffID = name; lbWelcome.Text = "Welcome, " + ManagerDAL.ShowNameFromId(name); LoadData(); }
public ActionResult Delete(string id) { ManagerDAL objDal = new ManagerDAL(); objDal.DeleteById(id); return(RedirectToAction("Get")); }
public ActionResult Create(ManagerListDTO obj) { ManagerDAL objDal = new ManagerDAL(); objDal.Insert(obj); return(RedirectToAction("Get")); }
public ActionResult Edit(ManagerListDTO obj) { ManagerDAL objDal = new ManagerDAL(); objDal.UpdateById(obj); return(RedirectToAction("Detail", new { id = obj._id.ToString() })); }
private bool AddPayment(DateTime TimeNow, Booking book) { bool rs = false; try { //string was not reconize as a datetime??? float fullcost = CalcuDays(DateTime.Parse(txtCheckIn.Text), DateTime.Parse(txtCheckOut.Text), book.Breakfirst, book.Nights); // MessageBox.Show("Full cost để add được vào payment mới là: " + fullcost); Payment pay = new Payment() { Amount = fullcost, Cancelled = false, Paid = fullcost * 0.3f, BookingID = book.BookingID, CustomerID = txtCusID.Text }; rs = ManagerDAL.AddNewPayment(pay); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(rs); }
private void btnPayment_Click(object sender, EventArgs e) { try { //update payment paid, Paytime DateTime Now = DateTime.Now; bool rs = ManagerDAL.UpdatePayment(txtBookingId.Text.Trim(), Now, false); if (rs) { ManagerDAL.UpdateRoomStatus(CurrentRoom.RoomNumber, "Available"); MessageBox.Show("Done the pay successful!"); ManagerDAL.AddNewLog(new Log() { StaffID = StaffID, ActionTime = Now, Main = "Update full payment for: " + txtBookingId.Text }); txtBookingId.Clear(); GoBackToMain(); } else { MessageBox.Show("Done the pay failed!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private bool AddLastBooking(Booking LastBooking) { //get last BookingID add them booking_room & + them payment! bool rs1 = ManagerDAL.AddNewRoomBooking(LastBooking.BookingID, CurrentRoom.RoomNumber); float newCost = CalcuDays(LastBooking.CheckIn, LastBooking.CheckOut, LastBooking.Breakfirst, LastBooking.Nights) + LastBooking.Amount; float newPaid = newCost * 0.3f; //lay fromDay & toDay cu, lay 2 gia cu de update bool rs2 = ManagerDAL.UpdatePaymentCost(LastBooking.BookingID, newCost, newPaid); if (rs1 && rs2) { ManagerDAL.AddNewLog(new Log() { StaffID = StaffID, ActionTime = DateTime.Now, Main = "Booking the room: " + CurrentRoom.RoomNumber.ToString() + "to: " + LastBooking.BookingID }); return(true); } else { return(false); } }
private Booking AddBooking(DateTime TimeNow) { String rs = null; Booking b = null; try { int nights = 0; int breakfirst = 0; TimeSpan SubTime = DateTime.Parse(txtCheckOut.Text) - DateTime.Parse(txtCheckIn.Text); if (rbBreakYes.Checked) { if (SubTime.TotalHours % 24 != 0) { breakfirst = (int)SubTime.TotalHours / 24 + 1; } else { breakfirst = (int)SubTime.TotalHours / 24; } } if (rbNightsYes.Checked) { nights = (int)SubTime.TotalHours / 24; } Booking booking = new Booking() { RoomNumber = CurrentRoom.RoomNumber, CheckIn = DateTime.Parse(txtCheckIn.Text), CheckOut = DateTime.Parse(txtCheckOut.Text), Comment = txtComment.Text, Breakfirst = breakfirst, Nights = nights, BookTime = TimeNow, CustomerID = txtCusID.Text }; rs = ManagerDAL.AddNewBooking(booking); if (rs != null) { b = new Booking() { BookingID = rs, Breakfirst = breakfirst, Nights = nights }; } } catch (Exception ex) { MessageBox.Show(ex.Message); } return(b); }
public static Manager ManagerKontrol(Manager m) { try { return(ManagerDAL.ManagerKontrol(m)); } catch (Exception) { throw; } }
public static bool Ekle(Manager m) { try { return(ManagerDAL.Ekle(m)); } catch (Exception) { throw; } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (CheckValid() && !addNew) { Receptionist r = new Receptionist() { StaffID = txtReceptID.Text, FirstName = txtFirstname.Text, LastName = txtLastname.Text, Address = txtAdress.Text, Country = cbCountry.Text, Email = txtEmail.Text, Phone = txtPhone.Text, Password = txtPass.Text, Username = txtUsername.Text, Status = cbStatus.Text }; if (ManagerDAL.UpdateRecept(r)) { ManagerDAL.AddNewLog(new Log() { StaffID = StaffID, ActionTime = DateTime.Now, Main = "Update Receptionist: " + txtReceptID.Text }); BindingStatus = false; LoadData(); MessageBox.Show("Update successful!"); } else { if (cbStatus.SelectedIndex == 1) { cbStatus.SelectedIndex = 0; } MessageBox.Show("Update failed!"); } } else { if (cbStatus.SelectedIndex == 1) { cbStatus.SelectedIndex = 0; } MessageBox.Show("Invalid to Update!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private bool CheckCusIdValid(String id) { List <Customer> list = ManagerDAL.ShowCustomerInfo(); for (int i = 0; i < list.Count; i++) { if (id.Equals(list.ElementAt(i).CustomerID.Trim()) && ManagerDAL.checkCustomer(id)) { return(true); } } return(false); }
private void txtSearchRoom_TextChanged_1(object sender, EventArgs e) { if (txtSearchRoom.Text.Trim().Equals("")) { LoadData(); } else { listRoom = ManagerDAL.FindRoom(txtSearchRoom.Text); dtRoom = ManagerDAL.ToDataTable <Room>(listRoom); dgvRooms.DataSource = dtRoom; } }
public ActionResult Create() { EmployeeListDTO employee = new EmployeeListDTO(); ManagerDAL objManagerDAL = new ManagerDAL(); employee.Managers = objManagerDAL.Get().Select(x => new Manager { ManagerId = x._id.ToString(), ManagerName = x.ManagerName }).ToList(); return(View(employee)); }
private static void HRf() { try { string u, p; int eidf; Admin e = new Admin(); ManagerDAL m = new ManagerDAL(); logindelegate ld = new logindelegate(e.Login); Console.WriteLine("Username: "******"Password: "******"Password: "******""; ConsoleKeyInfo kk; do { kk = Console.ReadKey(true); if (kk.Key != ConsoleKey.Backspace && kk.Key != ConsoleKey.Enter) { p += kk.KeyChar; //p2.Append(kk.KeyChar); Console.Write("*"); } else if (kk.Key != ConsoleKey.Backspace && p.Length > 0) { p = p.Substring(0, p.Length - 1); Console.Write("\b \b"); } } while (kk.Key != ConsoleKey.Enter); //p = Console.ReadLine(); if (ld.Invoke(u, p, out eidf)) { Console.WriteLine("HR Functions"); } else { Console.WriteLine("Login Failed. Try Again :("); } } catch (Exception e) { Console.WriteLine(e); } //throw new NotImplementedException(); }
private void btnAdd_Click(object sender, EventArgs e) { try { if (CheckValid()) { if (cbContinueBooking.Checked) { Booking LastBooking = ManagerDAL.GetLastBooking(); if ((LastBooking.BookTime - DateTime.Now).TotalHours < 1) { var confirmResult = MessageBox.Show("Continue to book this room for last booking?", "Confirm booking action", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { if (AddLastBooking(LastBooking)) { MessageBox.Show("Booking continue successful!"); } else { MessageBox.Show("Booking continue failed!"); } this.Hide(); Thread t = new Thread(new ThreadStart(() => ShowForm())); t.Start(); this.Close(); } } else { MessageBox.Show("Sorry, you can't continue to add room to old booking anymore"); cbContinueBooking.Checked = false; } } else { AddNewBooking(); } } else { MessageBox.Show("Invalid Booking Input!"); } }catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void txtSearchLog_TextChanged(object sender, EventArgs e) { if (txtSearchLog.Text.Trim().Equals("")) { LoadData(); } else { // DataTable dt = ManagerDAL.FindBook(txtSearch.Text.Trim()); listLog = ManagerDAL.FindLog(txtSearchLog.Text); dtLog = ManagerDAL.ToDataTable <Log>(listLog); dgvLog.DataSource = dtLog; // dgvRecepts.DataSource = dt; } }
private void LoadData() { try { listLog = ManagerDAL.ShowLog(); dtLog = ManagerDAL.ToDataTable <Log>(listLog); dgvLog.DataSource = dtLog; dgvLog.Rows[0].Selected = true; } catch (Exception e) { Console.WriteLine(e.Message); } }
private void txtSearchHistory_TextChanged(object sender, EventArgs e) { if (txtSearchHistory.Text.Trim().Equals("")) { LoadData(); } else { // DataTable dt = ManagerDAL.FindBook(txtSearch.Text.Trim()); list = ManagerDAL.FindHistory(txtSearchHistory.Text); dtHistory = ManagerDAL.ToDataTable <Booking>(list); dgvHistory.DataSource = dtHistory; // dgvRecepts.DataSource = dt; } }
private void LoadData() { try { list = ManagerDAL.ShowBookingHistory(); dtHistory = ManagerDAL.ToDataTable <Booking>(list); dgvHistory.DataSource = dtHistory; dgvHistory.Rows[0].Selected = true; } catch (Exception e) { Console.WriteLine(e.Message); } }
public ActionResult Edit(string id) { EmployeeDAL objDal = new EmployeeDAL(); EmployeeListDTO employee = objDal.GetById(id); ManagerDAL objManagerDAL = new ManagerDAL(); employee.Managers = objManagerDAL.Get().Select(x => new Manager { ManagerId = x._id.ToString(), ManagerName = x.ManagerName }).ToList(); return(View(employee)); }
private void LoadData() { try { listRecept = ManagerDAL.ShowReceptionistInfo(); dtRecept = ManagerDAL.ToDataTable <Receptionist>(listRecept); BindingData(); dgvRecepts.DataSource = dtRecept; dgvRecepts.Rows[0].Selected = true; } catch (Exception e) { Console.WriteLine(e.Message); } }
private void LoadData() { try { listCustomer = ManagerDAL.ShowCustomerInfo(); dtCustomer = ManagerDAL.ToDataTable <Customer>(listCustomer); BindingData(); dgvCustomers.DataSource = dtCustomer; dgvCustomers.Rows[0].Selected = true; } catch (Exception e) { MessageBox.Show(e.Message); } }
public ActionResult Edit(EmployeeListDTO obj) { EmployeeDAL objDal = new EmployeeDAL(); ManagerDAL objManagerDAL = new ManagerDAL(); obj.Manager = objManagerDAL.Get(). Where(x => x._id.ToString() == obj.ManagerId). Select(x => new Manager { ManagerId = x._id.ToString(), ManagerName = x.ManagerName }).First(); objDal.UpdateById(obj); return(RedirectToAction("Detail", new { id = obj._id.ToString() })); }
public frmRoom(bool Staff, bool Booked, bool Maintain, Room r, String Name) { InitializeComponent(); IsStaff = Staff; CurrentRoom = r; this.Booked = Booked; this.Maintain = Maintain; txtBookingId.Text = ManagerDAL.getBookingIDFromRoom(CurrentRoom.RoomNumber); /* if(CurrentRoom.BookingID != null) * { * txtBookingId.Text = CurrentRoom.BookingID; * } */ StaffID = Name; SetEnableButtons(); LoadDataToTexts(); }
public ActionResult Create(EmployeeListDTO obj) { ManagerDAL objManagerDAL = new ManagerDAL(); obj.Manager = objManagerDAL.Get(). Where(x => x._id.ToString() == obj.ManagerId). Select(x => new Manager { ManagerId = x._id.ToString(), ManagerName = x.ManagerName }).First(); EmployeeDAL objDal = new EmployeeDAL(); objDal.Insert(obj); return(RedirectToAction("Get")); }
private void txtSearchCustomer_TextChanged(object sender, EventArgs e) { if (txtSearchCustomer.Text.Trim().Equals("")) { BindingStatus = false; LoadData(); } else { // DataTable dt = ManagerDAL.FindBook(txtSearch.Text.Trim()); listCustomer = ManagerDAL.FindCustomer(txtSearchCustomer.Text); dtCustomer = ManagerDAL.ToDataTable <Customer>(listCustomer); dgvCustomers.DataSource = dtCustomer; BindingStatus = false; BindingData(); dgvCustomers.Rows[0].Selected = true; // dgvRecepts.DataSource = dt; } }
private void btnAdd_Click(object sender, EventArgs e) { try { if (CheckValid() && addNew) { Customer re = new Customer() { FirstName = txtFirstname.Text, LastName = txtLastname.Text, Address = txtAdress.Text, Country = cbCountry.SelectedItem.ToString(), Email = txtEmail.Text, Phone = txtPhone.Text, RegisTime = DateTime.Now, StaffID = StaffID, }; if (ManagerDAL.AddNewCustomer(re)) { ManagerDAL.AddNewLog(new Log() { StaffID = StaffID, ActionTime = DateTime.Now, Main = "Add new Customer: " + txtCusID.Text }); MessageBox.Show("Add successful!"); BindingStatus = false; LoadData(); addNew = false; } else { MessageBox.Show("Add failed!"); } } else { MessageBox.Show("Invalid to Add!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }