Beispiel #1
0
        internal string LoadStatisticsData(ref List <StatisticsData> statisticsList, DateTime date1, DateTime date2)
        {
            //magdis.uz/contract/readfororder.php?date1=2018/12/08&date2=2018/12/14
            string answer           = KEY_VALUES.OK;
            string url              = string.Format("{0}contract/readfororder.php?date1={1}&date2={2}", MyGlobalClass.Host, date1.ToString("yyyy/MM/dd"), date2.ToString("yyyy/MM/dd"));
            string jsonString       = MyGlobalClass.GetResponsible(url);
            List <StatisticsData> f = new List <StatisticsData>();

            if (MyGlobalClass.TryConvert(jsonString, ref f))
            {
                statisticsList = f;
            }
            else
            {
                if (string.IsNullOrEmpty(jsonString))
                {
                    answer = "You is offline";
                }
                else
                {
                    answer = "Statistics data is not loaded, please try again";
                }
            }
            return(answer);
        }
Beispiel #2
0
        public string SignIn(string login, string password)
        {
            string answer = KEY_VALUES.OK;
            string url    = MyGlobalClass.Host + "customer/signin.php?log=" + login + "&pass="******"0") || string.IsNullOrEmpty(jsonString))
            {
                if (jsonString.Equals("0"))
                {
                    answer = "Login or password is wrong";
                }
                else
                {
                    answer = "You is offline";
                }
                return(answer);
            }

            Customer c = new Customer();

            if (MyGlobalClass.TryConvert(jsonString, ref c))
            {
                MyGlobalClass.Customer = c;
            }
            else
            {
                answer = "Customer not loaded, please try again";
                return(answer);
            }
            return(answer);
        }
Beispiel #3
0
        public string LoadRegions(ref List <Region> regionList)
        {
            string        answer     = KEY_VALUES.OK;
            string        url        = MyGlobalClass.Host + "region/read.php";
            string        jsonString = MyGlobalClass.GetResponsible(url);
            List <Region> list       = new List <Region>();

            if (MyGlobalClass.TryConvert(jsonString, ref list))
            {
                regionList = list;
            }
            else
            {
                if (string.IsNullOrEmpty(jsonString))
                {
                    answer = "You is offline";
                }
                else
                {
                    answer = "Regions is not loaded, please try again";
                }
            }
            return(answer);
        }
Beispiel #4
0
        public string LoadRegionbyID(int id, ref Region region)
        {
            string answer     = KEY_VALUES.OK;
            string url        = string.Format("{0}region/readbyid.php?id={1}", MyGlobalClass.Host, id);
            string jsonString = MyGlobalClass.GetResponsible(url);
            Region reg        = new Region();

            if (MyGlobalClass.TryConvert(jsonString, ref reg))
            {
                region = reg;
            }
            else
            {
                if (string.IsNullOrEmpty(jsonString))
                {
                    answer = "You is offline";
                }
                else
                {
                    answer = string.Format("Region id={0} is not loaded, please try again", id);
                }
            }
            return(answer);
        }
Beispiel #5
0
        public string LoadProductbyID(int id, ref Product product)
        {
            string  answer     = KEY_VALUES.OK;
            string  url        = string.Format("{0}product/readonce.php?id={1}", MyGlobalClass.Host, id);
            string  jsonString = MyGlobalClass.GetResponsible(url);
            Product pro        = new Product();

            if (MyGlobalClass.TryConvert(jsonString, ref pro))
            {
                product = pro;
            }
            else
            {
                if (string.IsNullOrEmpty(jsonString))
                {
                    answer = "You is offline";
                }
                else
                {
                    answer = string.Format("Product id={0} is not loaded, please try again", id);
                }
            }
            return(answer);
        }
Beispiel #6
0
        public string LoadOrdersByContractID(int contractID, ref List <Order> orderList)
        {
            string       answer     = KEY_VALUES.OK;
            string       url        = string.Format("{0}order/readbycontractid.php?contractID={1}", MyGlobalClass.Host, contractID);
            string       jsonString = MyGlobalClass.GetResponsible(url);
            List <Order> orL        = new List <Order>();

            if (MyGlobalClass.TryConvert(jsonString, ref orL))
            {
                orderList = orL;
            }
            else
            {
                if (string.IsNullOrEmpty(jsonString))
                {
                    answer = "You is offline";
                }
                else
                {
                    answer = "Orders is not loaded, please try again";
                }
            }
            return(answer);
        }
Beispiel #7
0
        public string LoadLocationbyID(int id, ref Location location)
        {
            string   answer     = KEY_VALUES.OK;
            string   url        = string.Format("{0}location/readonce.php?id={1}", MyGlobalClass.Host, id);
            string   jsonString = MyGlobalClass.GetResponsible(url);
            Location loc        = new Location();

            if (MyGlobalClass.TryConvert(jsonString, ref loc))
            {
                location = loc;
            }
            else
            {
                if (string.IsNullOrEmpty(jsonString))
                {
                    answer = "You is offline";
                }
                else
                {
                    answer = "Location is not loaded, please try again";
                }
            }
            return(answer);
        }
Beispiel #8
0
        public string LoadContractByMaxid(ref Contract contract)
        {
            string   answer     = KEY_VALUES.OK;
            string   url        = MyGlobalClass.Host + "contract/readmaxid.php";
            string   jsonString = MyGlobalClass.GetResponsible(url);
            Contract c          = new Contract();

            if (MyGlobalClass.TryConvert(jsonString, ref c))
            {
                contract = c;
            }
            else
            {
                if (string.IsNullOrEmpty(jsonString))
                {
                    answer = "You is offline";
                }
                else
                {
                    answer = "Contract is not loaded, please try again";
                }
            }
            return(answer);
        }
Beispiel #9
0
        public string LoadFEACNbyID(int id, ref FEACN feacn)
        {
            string answer     = KEY_VALUES.OK;
            string url        = string.Format("{0}feacn/readbyid.php?id={1}", MyGlobalClass.Host, id);
            string jsonString = MyGlobalClass.GetResponsible(url);
            FEACN  f          = new FEACN();

            if (MyGlobalClass.TryConvert(jsonString, ref f))
            {
                feacn = f;
            }
            else
            {
                if (string.IsNullOrEmpty(jsonString))
                {
                    answer = "You is offline";
                }
                else
                {
                    answer = "FEACN is not loaded, please try again";
                }
            }
            return(answer);
        }