Beispiel #1
0
        public LoginObject Login(string username, string password)
        {
            LoginObject obj = new LoginObject();

            string url = Settings.InstanceURL;

            url = url + "/api/logon";

            var logon = new
            {
                Item = new
                {
                    UserName = username,
                    Password = password,
                }
            };

            try {
                string results = ConnectWebAPI.Request(url, logon);

                obj = Newtonsoft.Json.JsonConvert.DeserializeObject <LoginObject> (results);

                return(obj);
            } catch (Exception ex) {
                Console.WriteLine(ex.StackTrace);

                return(null);
            }
        }
Beispiel #2
0
        public static DateTime GetTodayDate()
        {
            string url = Settings.InstanceURL;

            url = url + "/api/GetTodayDate";

            var logon = new
            {
            };

            try {
                string results = ConnectWebAPI.Request(url, logon);

                //too tired today , sorry about this stupid code :(
                results = results.Remove(0, 1);
                results = results.Remove(results.Length - 1, 1);

                LoginController.Log("Get Today Date :" + results);

                return(DateTime.Parse(results));
            } catch (Exception ex) {
                Console.WriteLine(ex.StackTrace);

                return(DateTime.Today);
            }
        }
Beispiel #3
0
        public static string GetOrderNotes(DateTime orderDate)
        {
            string url = Settings.InstanceURL;

            url = url + "/Api/GetOrderNotes";


            var objsearch = (new
            {
                OrderDate = orderDate,
                RestaurantId = Settings.RestaurantId
            });

            try {
                string results = ConnectWebAPI.Request(url, objsearch);



                return(results);
            } catch (Exception ex) {
                Console.WriteLine(ex.StackTrace);

                return(null);
            }
        }
Beispiel #4
0
        public static List <OrderList> GetOrderList(DateTime orderDate)
        {
            string url = Settings.InstanceURL;

            url = url + "/Api/GetOrderList";


            var objsearch = (new
            {
                OrderDate = orderDate,
                RestaurantId = Settings.RestaurantId
            });

            string results = ConnectWebAPI.Request(url, objsearch);

            if (results != null)
            {
                LoginController.Log(Constant.GetOrderDate + ":" + orderDate.ToShortDateString());


                ApiResultList <IEnumerable <OrderList> > objResult = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiResultList <IEnumerable <OrderList> > > (results);

                List <OrderList> returnObject = new List <OrderList> ();

                if (objResult.Items != null)
                {
                    foreach (object Item in objResult.Items)
                    {
                        OrderList temp = Newtonsoft.Json.JsonConvert.DeserializeObject <OrderList> (Item.ToString());
                        returnObject.Add(temp);
                    }
                }
                else
                {
                    return(null);
                }

                return(returnObject);
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        public static void Log(string action)
        {
            string url = Settings.InstanceURL;

            url = url + "/api/Log";

            var objsearch = (new
            {
                username = Settings.Username,
                action = action
            });

            try
            {
                ConnectWebAPI.Request(url, objsearch);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
        public static List <RestaurantList> GetRestaurantList()
        {
            string url = Settings.InstanceURL;

            url = url + "/Api/GetRestaurantList";


            var objsearch = (new
            {
            });

            string results = ConnectWebAPI.Request(url, objsearch);

            if (results != null)
            {
                ApiResultList <IEnumerable <RestaurantList> > objResult = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiResultList <IEnumerable <RestaurantList> > > (results);

                List <RestaurantList> returnObject = new List <RestaurantList> ();

                if (objResult.Items != null)
                {
                    foreach (object Item in objResult.Items)
                    {
                        RestaurantList temp = Newtonsoft.Json.JsonConvert.DeserializeObject <RestaurantList> (Item.ToString());
                        returnObject.Add(temp);
                    }
                }
                else
                {
                    return(null);
                }

                return(returnObject);
            }
            else
            {
                return(null);
            }
        }