Ejemplo n.º 1
0
        public static void DoDeleteRide(int id)
        {
            Ride ride = DoSearchRide(id);

            ConnectionController.GetInstance().Rides.Remove(ride);
            ConnectionController.GetInstance().SaveChanges();
        }
Ejemplo n.º 2
0
        public static void DoOrderFood(String id, String quantity)
        {
            int foodId, quantityId, tableNumberId;

            Int32.TryParse(id, out foodId);
            Int32.TryParse(quantity, out quantityId);
            Int32.TryParse(tableNumber, out tableNumberId);

            OrderRequest orderReq = new OrderRequest();

            orderReq.CustomerId       = ActiveUserController.GetActiveCustomer().Id;
            orderReq.OrderDate        = DateTime.Now;
            orderReq.EmployeeId       = 1;
            orderReq.TableNumber      = tableNumberId;
            orderReq.OrderStatus      = "Waiting";
            orderReq.FeedBackCustomer = "None";
            ConnectionController.GetInstance().OrderRequests.Add(orderReq);
            ConnectionController.GetInstance().SaveChanges();


            OrderDetail orderDetail = new OrderDetail();

            orderDetail.FoodId   = foodId;
            orderDetail.Quantity = quantityId;
            orderDetail.OrderId  = orderReq.Id;

            ConnectionController.GetInstance().OrderDetails.Add(orderDetail);
            ConnectionController.GetInstance().SaveChanges();
        }
        public static RideSafety FindRideSafetyByName(String rideSafetyName)
        {
            RideSafety rideSafety;

            rideSafety = ConnectionController.GetInstance().RideSafeties.Where(x => x.RideSafetyName.Equals(rideSafetyName)).FirstOrDefault();
            return(rideSafety);
        }
Ejemplo n.º 4
0
        public static void DoChangeResignStatus(int id, string status)
        {
            ResignRequest resignReq = ConnectionController.GetInstance().ResignRequests.Where(x => x.Id.Equals(id)).FirstOrDefault();

            resignReq.ResignResponse = status;
            ConnectionController.GetInstance().SaveChanges();
        }
Ejemplo n.º 5
0
        public static void DoChangeStatus(int id, string status)
        {
            HeaderResponse headerResponse = ConnectionController.GetInstance().HeaderResponses.Where(x => x.Id.Equals(id)).FirstOrDefault();

            headerResponse.ResponseStatus = status;
            ConnectionController.GetInstance().SaveChanges();
        }
Ejemplo n.º 6
0
        private static int DoSearchMaxHeaderId()
        {
            int i = 0;

            if (ConnectionController.GetInstance().HeaderCreations.ToList().Count() > 0)
            {
                i = ConnectionController.GetInstance().HeaderCreations.Max(x => x.Id);
            }
            return(i);
        }
Ejemplo n.º 7
0
        private static void DoInsertHeader()
        {
            HeaderCreation headerCreation = new HeaderCreation();

            headerCreation.EmployeeId  = ActiveUserController.GetActiveEmployee().Id;
            headerCreation.CreatedDate = DateTime.Now;

            ConnectionController.GetInstance().HeaderCreations.Add(headerCreation);
            ConnectionController.GetInstance().SaveChanges();
        }
Ejemplo n.º 8
0
        public static void DoGiveFeedback(String id, String feedback)
        {
            int orderId;

            Int32.TryParse(id, out orderId);

            OrderRequest orderReq = ConnectionController.GetInstance().OrderRequests.Where(x => x.Id.Equals(orderId)).FirstOrDefault();

            orderReq.FeedBackCustomer = feedback;
            ConnectionController.GetInstance().SaveChanges();
        }
Ejemplo n.º 9
0
        public static void DoChangeSalary(int id, string status)
        {
            RequestRaiseSalary reqSalary = ConnectionController.GetInstance().RequestRaiseSalaries.Where(x => x.Id.Equals(id)).FirstOrDefault();;

            reqSalary.ResponseStatus = status;
            ConnectionController.GetInstance().SaveChanges();

            if (status.Equals("Approved"))
            {
                Employee employee = ConnectionController.GetInstance().Employees.Where(x => x.Id.Equals(reqSalary.EmployeeTargetId)).FirstOrDefault();
                employee.EmployeeSalary += reqSalary.EmployeeRaisePrice;
                ConnectionController.GetInstance().SaveChanges();
            }
        }
Ejemplo n.º 10
0
        public static void InsertCustomer(String[] customerData)
        {
            Customer customer = new Customer();

            customer.CustomerFullname    = customerData[0];
            customer.CustomerEmail       = customerData[1];
            customer.CustomerPhoneNumber = customerData[2];
            customer.CustomerAddress     = customerData[3];
            customer.CustomerGender      = customerData[4];
            customer.CustomerUsername    = customerData[5];
            customer.CustomerPassword    = customerData[6];

            ConnectionController.GetInstance().Customers.Add(customer);
            ConnectionController.GetInstance().SaveChanges();
        }