public static void reqDelRide(int id, string name, string desc, string htw, string kindR, string safety)
        {
            RequestRide newRr = new RequestRide();

            newRr.EmployeeId               = LoginHandler.idEmp;
            newRr.RideId                   = id;
            newRr.ReqRideName              = name;
            newRr.ReqRideDescription       = desc;
            newRr.ReqRideHowToWork         = htw;
            newRr.ReqRideKind              = kindR;
            newRr.ReqRideSafetyInformation = safety;
            newRr.ReqRideStatus            = "Removing.. Waiting Approvement";

            DatabaseConnectionHandler.GetInstance().RequestRide.Add(newRr);
            DatabaseConnectionHandler.GetInstance().SaveChanges();
        }
        public static void sendConstruction(int id)
        {
            var rslt = DatabaseConnectionHandler.GetInstance().Ride.Where(x => x.RideId == id).FirstOrDefault();

            if (rslt.RideStatus.Contains("Add"))
            {
                rslt.RideStatus = "Adding.. Waiting for constructing";
            }
            else if (rslt.RideStatus.Contains("Upd"))
            {
                rslt.RideStatus = "Update.. Waiting for constructing";
            }
            else if (rslt.RideStatus.Contains("Rem"))
            {
                rslt.RideStatus = "Removing.. Waiting for constructing";
            }
            DatabaseConnectionHandler.GetInstance().SaveChanges();
        }
        public static string generateTicketId()
        {
            Ticket tc = DatabaseConnectionHandler.GetInstance().Ticket.ToArray().LastOrDefault();

            ticketId = tc.TicketId.Substring(8);
            string id  = "" + (Int32.Parse(ticketId) + 1);
            string nol = "";

            if (id.Length == 1)
            {
                nol = "00";
            }
            else if (id.Length == 2)
            {
                nol = "0";
            }
            else if (id.Length == 3)
            {
                nol = "";
            }
            ticketId = DateTime.Now.ToString("yyyyMMdd") + nol + id;
            return(ticketId);
        }
        public static string getEmployeeDepartment(int id)
        {
            var rslt = DatabaseConnectionHandler.GetInstance().Employee.Where(x => x.EmployeeId.Equals(id)).FirstOrDefault();

            return(rslt.EmployeeDepartment.EmployeeDepartmentName);
        }
        public static DateTime getEmployeeDOB(int id)
        {
            var rslt = DatabaseConnectionHandler.GetInstance().Employee.Where(x => x.EmployeeId.Equals(id)).FirstOrDefault();

            return(rslt.EmployeeDOB);
        }
        public static int getTransactionId()
        {
            TicketTransaction tct = DatabaseConnectionHandler.GetInstance().TicketTransaction.ToArray().LastOrDefault();

            return(tct.TicketTransactionId);
        }
        private void dataRoom_Loaded(object sender, RoutedEventArgs e)
        {
            var rslt = DatabaseConnectionHandler.GetInstance().RoomHotel.ToList();

            dataRoom.ItemsSource = rslt;
        }
예제 #8
0
        public static void CheckLogin(String username, String password)
        {
            Employee emp = DatabaseConnectionHandler.GetInstance().Employee.Where(x => x.EmployeeUsername.Equals(username) && x.EmployeePassword.Equals(password)).ToList().FirstOrDefault();

            if (emp == null)
            {
                MessageBox.Show("Invalid Username and Password");
            }
            else
            {
                idEmp = emp.EmployeeId;
                if (emp.EmployeeDepartmentId == 1)
                {
                    ManagementDepartment md = new ManagementDepartment();
                    md.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 2)
                {
                    AttractionDepartment ad = new AttractionDepartment();
                    if (emp.EmployeeRole.Equals("Selling Ticket"))
                    {
                        ad.viewSellingEmployee();
                        ad.Show();
                        login = 1;
                    }
                    else
                    {
                        ad.viewEntranceGateEmployee();
                        ad.Show();
                        login = 1;
                    }
                }
                else if (emp.EmployeeDepartmentId == 3)
                {
                    MaintenanceDepartment md = new MaintenanceDepartment();
                    md.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 4)
                {
                    RideandAttarctionCreativeDepartment rad = new RideandAttarctionCreativeDepartment();
                    rad.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 5)
                {
                    ConstructionDepartment cd = new ConstructionDepartment();
                    cd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 6)
                {
                    RestaurantDepartment rd = new RestaurantDepartment();
                    if (emp.EmployeeRole.Equals("Waiter"))
                    {
                        rd.Show();
                        login = 1;
                    }
                    else
                    {
                        rd.Show();
                        login = 1;
                    }
                }
                else if (emp.EmployeeDepartmentId == 7)
                {
                    PurchaseDepartment pd = new PurchaseDepartment();
                    pd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 8)
                {
                    FundDepartment fd = new FundDepartment();
                    fd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 9)
                {
                    HotelDepartment hd = new HotelDepartment();
                    hd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 10)
                {
                    SalesAndMarketingDepartment smd = new SalesAndMarketingDepartment();
                    smd.Show();
                    login = 1;
                }
                else if (emp.EmployeeDepartmentId == 11)
                {
                    HumanResourceDepartment hrd = new HumanResourceDepartment();
                    hrd.Show();
                    login = 1;
                }
            }
        }