コード例 #1
0
        public async static Task <bool> SendGetOrdersRequest()
        {
            GetOrdersRequest getOrdersRequest = new GetOrdersRequest();
            var response = await ServiceRequestHandler.MakeServiceCall <OrdersList>(getOrdersRequest);

            if (response.Orders != null)
            {
                // Will filter out any properties that hold time_completed property as those are orders that are already finished
                List <Orders> ordersFiltered = response.Orders.Where(s => String.IsNullOrEmpty(s.time_completed)).ToList();
                //removes all orders without any menu items
                ordersFiltered.RemoveAll(s => s.menuItems.Count == 0);

                //filter out all orders which are prepared within ordersFiltered and orders that have been sent to kitchen
                foreach (Orders o in ordersFiltered)
                {
                    ordersFiltered = ordersFiltered.Where(s => s.menuItems.Any(m => !m.prepared) && s.send_to_kitchen).ToList();
                }

                RealmManager.RemoveAll <Orders>();
                RealmManager.AddOrUpdate <Orders>(ordersFiltered);

                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public async static Task <bool> SendGetAllShiftsRequest(string employeeid)
        {
            GetAllShiftsRequest getAllShiftsRequest = new GetAllShiftsRequest(employeeid);
            var response = await ServiceRequestHandler.MakeServiceCall <ShiftList>(getAllShiftsRequest);

            if (response != null)
            {
                RealmManager.RemoveAll <ShiftList>();

                ShiftList parsedList = new ShiftList();

                for (int i = 0; i < response.shifts.Count; i++)
                {
                    Shift interShift = response.shifts.ElementAt(i);
                    interShift.clock_in = interShift.clock_in.Substring(11, 8) + " " + interShift.clock_in.Substring(5, 2) + "/" + interShift.clock_in.Substring(8, 2) + "/" + interShift.clock_in.Substring(0, 4);
                    if (!String.IsNullOrEmpty(interShift.clock_out))
                    {
                        interShift.clock_out = interShift.clock_out.Substring(11, 8) + " " + interShift.clock_out.Substring(5, 2) + "/" + interShift.clock_out.Substring(8, 2) + "/" + interShift.clock_out.Substring(0, 4);;
                    }
                    parsedList.shifts.Add(interShift);
                }

                RealmManager.AddOrUpdate <ShiftList>(parsedList);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        // Posts a tip to the database
        public static async Task <bool> SendFinishOrderRequest(string tableID)
        {
            //make a new request object
            var serviceRequest = new FinishOrderRequest(tableID);
            //get a response
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteResponse>(serviceRequest);


            //No response is set so just assume it worked
            return(true);
        }
コード例 #4
0
        public async static Task <bool> SendDeleteTipRequest(string id)
        {
            DeleteTipRequest deleteTipRequest = new DeleteTipRequest(id);
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteTipResponse>(deleteTipRequest);

            if (response.deletedCount == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        public async static Task <bool> SendDeleteEmployeeRequest(string id)
        {
            DeleteEmployeeRequest deleteEmployeeRequest = new DeleteEmployeeRequest(id);
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteEmployeeRequestResponse>(deleteEmployeeRequest);

            if (response.message != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
        public async static Task <bool> SendUpdateEmployeeRequest(string id, string pay, string first_name, string last_name, string username, string position)
        {
            UpdateEmployeeRequest updateEmployeeRequest = new UpdateEmployeeRequest(id, pay, first_name, last_name, username, position);
            var response = await ServiceRequestHandler.MakeServiceCall <UpdateEmployeeResponse>(updateEmployeeRequest, updateEmployeeRequest.Body);

            if (response.nModified == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #7
0
        public async static Task <bool> SendClockInRequest(string employeeid)
        {
            ClockIn clockIn  = new ClockIn(employeeid);
            var     response = await ServiceRequestHandler.MakeServiceCall <ClockInRespoonse>(clockIn, clockIn.Body);

            if (response.shift_id != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #8
0
        public static async Task <bool> SendUpdateIngredientRequest(string id, string oldValue, string newValue)
        {
            var sendUpdateIngredientRequest = new UpdateIngredientRequest(id, oldValue, newValue);
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteResponse>(sendUpdateIngredientRequest, sendUpdateIngredientRequest.Body);

            if (response == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #9
0
        public async static Task <bool> SendSetCouponActive(string id, bool active)
        {
            SetCouponActive setCouponActive = new SetCouponActive(id, active);
            var             response        = await ServiceRequestHandler.MakeServiceCall <SetCouponActiveResponse>(setCouponActive, setCouponActive.Body);

            if (response.nModified == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #10
0
        public async static Task <bool> SendAddMenuItemRequest(List <string> ingredients, string name, string picture, string description, double price, string nutrition, string item_type, string category)
        {
            AddMenuItemRequest addMenuItemRequest = new AddMenuItemRequest(ingredients, name, picture, description, price, nutrition, item_type, category);
            var response = await ServiceRequestHandler.MakeServiceCall <AddMenuItemRequestResponse>(addMenuItemRequest, addMenuItemRequest.Body);

            if (response.message != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #11
0
ファイル: MakeNewPromo.cs プロジェクト: iotarex/ManagerApp
        public async static Task <string> SendMakeNewPromo(string couponType, string description, List <MenuItem> reqItems, List <MenuItem> appItems, string discount, string active, string repeatable)
        {
            MakeNewPromo makeNewPromo = new MakeNewPromo(couponType, description, reqItems, appItems, discount, active, repeatable);
            var          response     = await ServiceRequestHandler.MakeServiceCall <MakeNewPromoResponse>(makeNewPromo, makeNewPromo.Body);

            if (response.message == null)
            {
                return(null);
            }
            else
            {
                return(response._id);
            }
        }
コード例 #12
0
        public async static Task <bool> SendUpdateMenuItemRequest(string id, string category, double price, string name, string nutrition, string description)
        {
            UpdateMenuItemRequest updateMenuItemRequest = new UpdateMenuItemRequest(id, category, price, name, nutrition, description);
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteResponse>(updateMenuItemRequest, updateMenuItemRequest.Body);

            if (response.electionId != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #13
0
        public async static Task <bool> SendUpdateMenuItemRequest(MenuItem menuItem)
        {
            UpdateHotItemRequest updateMenuItemRequestHotItem = new UpdateHotItemRequest(menuItem);
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteResponse>(updateMenuItemRequestHotItem, updateMenuItemRequestHotItem.Body);

            if (response.electionId != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #14
0
        public async static Task <bool> SendClockOutRequest(string shiftid)
        {
            ClockOut clockOut = new ClockOut(shiftid);
            var      response = await ServiceRequestHandler.MakeServiceCall <ClockOutResponse>(clockOut, clockOut.Body);

            if (response.nModified == 0)
            {
                return(false);
            }
            else if (response.nModified == 1)
            {
                return(true);
            }
            return(false);
        }
コード例 #15
0
        public static async Task <bool> SendValidateLoginRequest(string userName, string passWord)
        {
            var sendValidateLoginRequest = new ValidateLoginRequest(userName, passWord);
            var response = await ServiceRequestHandler.MakeServiceCall <ValidateLoginRequestResponse>(sendValidateLoginRequest, sendValidateLoginRequest.Body);

            if (response.employee == null)
            {
                return(false);
            }
            else
            {
                RealmManager.AddOrUpdate <Employee>(response.employee);
                return(true);
            }
        }
コード例 #16
0
        //Send Notification to database
        public static async Task <bool> SendAddNotificationRequest(string inID, string inSend, string inType)
        {
            var sendAddNotificationRequest = new AddNotificationRequest(inID, inSend, inType);

            var response = await ServiceRequestHandler.MakeServiceCall <PostResponse>(sendAddNotificationRequest, sendAddNotificationRequest.Body);

            if (response.message == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #17
0
        public static async Task <bool> SendGetEmployeeListRequest()
        {
            var sendGetEmployeeListRequest = new GetEmployeeListRequest();
            var response = await ServiceRequestHandler.MakeServiceCall <EmployeeList>(sendGetEmployeeListRequest);

            if (response != null)
            {
                RealmManager.AddOrUpdate <EmployeeList>(response);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #18
0
        public async static Task <bool> SendAddEmployeeRequest(string fName, string lName, string userName, string passWord, int position, double pay)
        {
            AddEmployeeRequest addEmployeeRequest = new AddEmployeeRequest(fName, lName, userName, passWord, position, pay);

            var response = await ServiceRequestHandler.MakeServiceCall <AddEmployeeRequestResponse>(addEmployeeRequest, addEmployeeRequest.Body);

            if (response.employee != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #19
0
        public async static Task <bool> SendResetEmployeeShift(string employeeid)
        {
            ResetEmployeeShift resetEmployeeShift = new ResetEmployeeShift(employeeid);
            var response = await ServiceRequestHandler.MakeServiceCall <ResetEmployeeResponse>(resetEmployeeShift, resetEmployeeShift.Body);

            if (response.nModified == 0)
            {
                return(false);
            }
            else if (response.nModified == 1)
            {
                return(true);
            }
            return(false);
        }
コード例 #20
0
        public async static Task <bool> SendGetCouponsRequest()
        {
            GetCouponsRequest getCouponsRequest = new GetCouponsRequest();
            var response = await ServiceRequestHandler.MakeServiceCall <CouponList>(getCouponsRequest);

            if (response != null)
            {
                RealmManager.RemoveAll <CouponList>();
                RealmManager.AddOrUpdate <CouponList>(response);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #21
0
        public async static Task <bool> SendAllCompsNoArgs()
        {
            GetAllComps getAllComps = new GetAllComps();
            var         response    = await ServiceRequestHandler.MakeServiceCall <Comps>(getAllComps);

            if (response != null)
            {
                RealmManager.RemoveAll <Comp>();
                RealmManager.RemoveAll <Comps>();
                RealmManager.AddOrUpdate <Comps>(response);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #22
0
        public static async Task <bool> SendAddIngredientRequest(string itemName, string itemQuantity)
        {
            //call to the constructor above
            var sendAddIngredientRequest = new AddIngredientRequest(itemName, itemQuantity);
            //call to ServiceRequestHandler, arguments are the request object (like usual), but notice that we also
            //add a specific reference to the BODY property of this object as a second paramater.
            var response = await ServiceRequestHandler.MakeServiceCall <PostResponse>(sendAddIngredientRequest, sendAddIngredientRequest.Body);

            if (response.message == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #23
0
ファイル: GetEmployeeTips.cs プロジェクト: iotarex/ManagerApp
        public async static Task <bool> SendGetEmployeeTips(string id)
        {
            GetEmployeeTips getEmployeeTips = new GetEmployeeTips(id);
            var             response        = await ServiceRequestHandler.MakeServiceCall <Tips>(getEmployeeTips);

            if (response != null)
            {
                RealmManager.RemoveAll <Tips>();
                RealmManager.RemoveAll <Tip>();
                RealmManager.AddOrUpdate <Tips>(response);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #24
0
        public static async Task <bool> SendNotificationRequest(string notificationType, string employeeID, string sender)
        {
            var sendNotificationRequest = new PostNotificationsRequest(notificationType, employeeID, sender);
            var response = await ServiceRequestHandler.MakeServiceCall <NotificationResponse>(sendNotificationRequest, sendNotificationRequest.Body);

            if (response.message == null)
            {
                return(false);
            }
            else if (response.message == "Employee ID given does not match any ID")
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #25
0
        // Posts a tip to the database
        public static async Task <string> SendPostDessertCouponRequest()
        {
            //make a new request object
            var serviceRequest = new PostDessertCouponRequest();
            //get a response
            var response = await ServiceRequestHandler.MakeServiceCall <IDResponse>(serviceRequest, serviceRequest.Body);

            if (response._id == null)
            {
                //call failed
                return(null);
            }
            else
            {
                //call succeeded
                return(response._id);
            }
        }
コード例 #26
0
        public static async Task <bool> SendUpdateOrderMenuItemsRequest(string ID, IList <OrderItem> toUpdate)
        {
            //make a new request object
            var serviceRequest = new UpdateOrderMenuItemsRequest(ID, toUpdate);
            //get a response
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteResponse>(serviceRequest, serviceRequest.Body);

            if (response == null)
            {
                //call failed
                return(false);
            }
            else
            {
                //call succeeded
                return(true);
            }
        }
コード例 #27
0
        // Posts a tip to the database
        public static async Task <bool> SendPostReviewRequest(string OrderID, string EmployeeID, int rating1, string reason1, int rating2, string reason2, int rating3, string reason3)
        {
            //make a new request object
            var serviceRequest = new PostReviewRequest(OrderID, EmployeeID, rating1, reason1, rating2, reason2, rating3, reason3);
            //get a response
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteResponse>(serviceRequest, serviceRequest.Body);

            if (response == null)
            {
                //call failed
                return(false);
            }
            else
            {
                //call succeeded
                return(true);
            }
        }
コード例 #28
0
        // Posts a tip to the database
        public static async Task <bool> SendPostTipRequest(string ID, double amt)
        {
            //make a new request object
            var serviceRequest = new PostTipRequest(ID, amt);
            //get a response
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteResponse>(serviceRequest, serviceRequest.Body);

            if (response == null)
            {
                //call failed
                return(false);
            }
            else
            {
                //call succeeded
                return(true);
            }
        }
コード例 #29
0
        public static async Task <bool> SendDeleteIngredientRequest(string id)
        {
            var sendDeleteIngredientRequest = new DeleteIngredientRequest(id);
            var response = await ServiceRequestHandler.MakeServiceCall <DeleteResponse>(sendDeleteIngredientRequest);

            if (response == null)
            {
                return(false);
            }
            else
            {
                var deletedIngredient = RealmManager.Find <Ingredient>(id);
                RealmManager.Write(() =>
                {
                    RealmManager.Realm.Remove(deletedIngredient);
                });
                return(true);
            }
        }
コード例 #30
0
        //Send Request for all employees
        public static async Task <bool> SendGetEmployeesRequest()
        {
            //make a new request object
            var serviceRequest = new GetEmployeesRequest();
            //get a response
            var response = await ServiceRequestHandler.MakeServiceCall <EmployeeList>(serviceRequest);

            if (response == null)
            {
                //call failed
                return(false);
            }
            else
            {
                //add the response into the local database
                RealmManager.AddOrUpdate <EmployeeList>(response);
                //call succeeded
                return(true);
            }
        }