private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     Model.dao.CustomerDao CD = new Model.dao.CustomerDao();
     if (CD.CheckCus(tbIDCard.Text))
     {
         MessageBox.Show("Customer is already exists!");
     }
     else
     {
         if (CheckEmpty())
         {
             Model.entity.CUSTOMER c = new Model.entity.CUSTOMER();
             c.IDCARD = tbIDCard.Text;
             c.NAME = tbCusName.Text;
             c.AGE = int.Parse(tbCusAge.Text);
             c.PHONENUMBER = tbCusPhone.Text;
             c.ADDRESS = tbCusAddress.Text;
             if (CD.Add(c))
             {
                 MessageBox.Show("Customer Added !");
                 this.Close();
             }
         }
         }
     }
Ejemplo n.º 2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (CheckEmpty())
            {
                Model.entity.CUSTOMER c = new Model.entity.CUSTOMER();
                c.ID          = cusid;
                c.AGE         = int.Parse(tbCusAge.Text);
                c.PHONENUMBER = tbCusPhone.Text;
                c.ADDRESS     = tbCusAddress.Text;

                Model.dao.CustomerDao CD = new Model.dao.CustomerDao();
                CD.Edit(c);
                this.Close();
            }
        }
Ejemplo n.º 3
0
        public EditCustomer(Model.entity.CUSTOMER c)
        {
            InitializeComponent();
            cusid               = c.ID;
            tbIDCard.Text       = c.IDCARD;
            tbIDCard.IsReadOnly = true;
            tbIDCard.IsEnabled  = false;

            tbCusName.Text       = c.NAME;
            tbCusName.IsReadOnly = true;
            tbCusName.IsEnabled  = false;

            tbCusAge.Text     = c.AGE.ToString();
            tbCusPhone.Text   = c.PHONENUMBER;
            tbCusAddress.Text = c.ADDRESS;
        }
Ejemplo n.º 4
0
        public bool Add(Model.entity.CUSTOMER c)
        {
            HOTELMANAGEMENTEntities hm = new HOTELMANAGEMENTEntities();

            try
            {
                hm.CUSTOMERs.Add(c);
                hm.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }
Ejemplo n.º 5
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Model.dao.CustomerDao CD = new Model.dao.CustomerDao();
     if (CD.CheckCus(tbIDCard.Text))
     {
         Model.entity.CUSTOMER c = CD.GetCustomerInfo(tbIDCard.Text);
         tbCusName.Text    = c.NAME;
         tbCusAge.Text     = c.AGE.ToString();
         tbCusPhone.Text   = c.PHONENUMBER;
         tbCusAddress.Text = c.ADDRESS;
         MessageBox.Show("Customer Found!");
     }
     else
     {
         MessageBox.Show("No Customer Found!");
     }
 }
        private void EditCustomer(object sender, RoutedEventArgs e)
        {
            if (dataCustomer.SelectedItems.Count > 0)
            {
                Model.view.CustomerView row = (Model.view.CustomerView)dataCustomer.SelectedItem;
                Model.entity.CUSTOMER   c   = new Model.entity.CUSTOMER();
                c.ID          = row.ID;
                c.IDCARD      = row.IDCARD;
                c.NAME        = row.NAME;
                c.AGE         = row.AGE;
                c.PHONENUMBER = row.PHONENUMBER;
                c.ADDRESS     = row.ADDRESS;

                Frm.EditCustomer ES = new Frm.EditCustomer(c);

                ES.ShowDialog();
                GetCustomerView();
            }
        }
Ejemplo n.º 7
0
 public CheckIn(String Name, String status, int id)
 {
     empid = id;
     InitializeComponent();
     RoomName = Name;
     Status   = status;
     if (Status == "Booked")
     {
         Model.dao.RoomDao     RD   = new Model.dao.RoomDao();
         Model.dao.CustomerDao CD   = new Model.dao.CustomerDao();
         String []             info = RD.GetIDCardWithCheckOut(RoomName);
         tbIDCard.Text = info[0];
         Model.entity.CUSTOMER c = CD.GetCustomerInfo(tbIDCard.Text);
         tbCusName.Text      = c.NAME;
         tbCusAge.Text       = c.AGE.ToString();
         tbCusPhone.Text     = c.PHONENUMBER;
         tbCusAddress.Text   = c.ADDRESS;
         dpCheckOut.Text     = info[1];
         tbIDCard.IsReadOnly = true;
         tbIDCard.IsEnabled  = false;
     }
 }
Ejemplo n.º 8
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     Model.dao.RoomDao     RD = new Model.dao.RoomDao();
     Model.dao.CustomerDao CD = new Model.dao.CustomerDao();
     Model.dao.BookingDao  BD = new Model.dao.BookingDao();
     if (CD.CheckCus(tbIDCard.Text))
     {
         if (CheckEmpty())
         {
             Model.entity.BOOKING b = new Model.entity.BOOKING();
             b.CUSID        = CD.GetID(tbIDCard.Text);
             b.EMPID        = empid;
             b.ROOMID       = RD.GetID(RoomName);
             b.CHECKINTIME  = dpCheckIn.Text;
             b.CHECKOUTTIME = dpCheckOut.Text;
             DateTime now = DateTime.Now;
             b.BOOKINGDATE = now.ToString("dd/MM/yyyy HH:mm:ss");
             b.STATUS      = true;
             if (BD.Add(b))
             {
                 MessageBox.Show("Booking Succesfully !");
                 RD.DisableRoom(3, RoomName);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Failed To Book");
             }
         }
     }
     else
     {
         if (CheckEmpty())
         {
             Model.entity.CUSTOMER c = new Model.entity.CUSTOMER();
             c.IDCARD      = tbIDCard.Text;
             c.NAME        = tbCusName.Text;
             c.AGE         = int.Parse(tbCusAge.Text);
             c.PHONENUMBER = tbCusPhone.Text;
             c.ADDRESS     = tbCusAddress.Text;
             if (CD.Add(c))
             {
                 Model.entity.BOOKING b = new Model.entity.BOOKING();
                 b.CUSID        = CD.GetID(tbIDCard.Text);
                 b.EMPID        = empid;
                 b.ROOMID       = RD.GetID(RoomName);
                 b.CHECKINTIME  = dpCheckIn.Text;
                 b.CHECKOUTTIME = dpCheckOut.Text;
                 DateTime now = DateTime.Now;
                 b.BOOKINGDATE = now.ToString("dd/MM/yyyy HH:mm:ss");
                 b.STATUS      = false;
                 if (BD.Add(b))
                 {
                     MessageBox.Show("Booking Succesfully !");
                     RD.DisableRoom(3, RoomName);
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("Failed To Book");
                 }
             }
             else
             {
                 MessageBox.Show("Not Saved!");
             }
         }
     }
 }
Ejemplo n.º 9
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     Model.dao.ServiceDao     sd  = new Model.dao.ServiceDao();
     Model.dao.RoomDao        RD  = new Model.dao.RoomDao();
     Model.dao.CustomerDao    CD  = new Model.dao.CustomerDao();
     Model.dao.OrderDetailDao odd = new Model.dao.OrderDetailDao();
     Model.dao.SrvOrderDao    sod = new Model.dao.SrvOrderDao();
     if (CD.CheckCus(tbIDCard.Text))
     {
         if (CheckEmpty())
         {
             Model.entity.SRVORDER order = new Model.entity.SRVORDER();
             order.CUSID  = CD.GetID(tbIDCard.Text);
             order.ROOMID = RD.GetID(RoomName);
             if (sd.CheckServiceName(2, RoomName))
             {
                 order.SRVID = sd.GetServiceId(RoomName);
             }
             else
             {
                 Model.entity.SERVICE s = new Model.entity.SERVICE();
                 s.NAME   = RD.GetSrvName(RoomName);
                 s.TYPE   = "Room";
                 s.PRICE  = RD.GetPrice(RoomName);
                 s.STATUS = "Active";
                 if (sd.Add(s))
                 {
                     order.SRVID = sd.GetServiceId(RoomName);
                 }
             }
             order.QUANTITY      = 1;
             order.PAYMENTSTATUS = false;
             if (sod.Add(order))
             {
                 DateTime now = DateTime.Now;
                 Model.entity.ORDERDETAIL orderdetail = new Model.entity.ORDERDETAIL();
                 orderdetail.date     = now.ToString("dd/MM/yyyy HH:mm:ss");
                 orderdetail.DISCOUNT = 0;
                 orderdetail.EMPID    = empid;
                 orderdetail.PRICE    = RD.GetPrice(RoomName);
                 orderdetail.ORDERID  = sod.GetInsertedSrvOrderId();
                 if (odd.Add(orderdetail))
                 {
                     if (Status == "Booked")
                     {
                         Model.dao.BookingDao BD = new Model.dao.BookingDao();
                         BD.ChangeBookingStatus(CD.GetID(tbIDCard.Text), RD.GetID(RoomName));
                     }
                     RD.DisableRoom(4, RoomName);
                     MessageBox.Show("Check In Successfully!");
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("Failed To Check In!");
                 }
             }
             else
             {
                 MessageBox.Show("Failed To Check In!");
             }
         }
     }
     else
     {
         if (CheckEmpty())
         {
             Model.entity.CUSTOMER c = new Model.entity.CUSTOMER();
             c.IDCARD      = tbIDCard.Text;
             c.NAME        = tbCusName.Text;
             c.AGE         = int.Parse(tbCusAge.Text);
             c.PHONENUMBER = tbCusPhone.Text;
             c.ADDRESS     = tbCusAddress.Text;
             if (CD.Add(c))
             {
                 Model.entity.SRVORDER order = new Model.entity.SRVORDER();
                 order.CUSID  = CD.GetID(tbIDCard.Text);
                 order.ROOMID = RD.GetID(RoomName);
                 if (sd.CheckServiceName(2, RoomName))
                 {
                     order.SRVID = sd.GetServiceId(RoomName);
                 }
                 else
                 {
                     Model.entity.SERVICE s = new Model.entity.SERVICE();
                     s.NAME   = RD.GetSrvName(RoomName);
                     s.TYPE   = "Room";
                     s.PRICE  = RD.GetPrice(RoomName);
                     s.STATUS = "Active";
                     if (sd.Add(s))
                     {
                         order.SRVID = sd.GetServiceId(RoomName);
                     }
                 }
                 order.QUANTITY      = 1;
                 order.PAYMENTSTATUS = false;
                 if (sod.Add(order))
                 {
                     DateTime now = DateTime.Now;
                     Model.entity.ORDERDETAIL orderdetail = new Model.entity.ORDERDETAIL();
                     orderdetail.date     = now.ToString("dd/MM/yyyy HH:mm:ss");
                     orderdetail.DISCOUNT = 0;
                     orderdetail.EMPID    = empid;
                     orderdetail.PRICE    = RD.GetPrice(RoomName);
                     orderdetail.ORDERID  = sod.GetInsertedSrvOrderId();
                     if (odd.Add(orderdetail))
                     {
                         RD.DisableRoom(4, RoomName);
                         MessageBox.Show("Check In Successfully!");
                         this.Close();
                     }
                     else
                     {
                         MessageBox.Show("Failed To Check In!");
                     }
                 }
                 else
                 {
                     MessageBox.Show("Failed To Check In!");
                 }
             }
             else
             {
                 MessageBox.Show("Failed To Add Customer!");
             }
         }
     }
 }