public WebServiceResponseDTO <UserWebServiceDTO> SetFileLido(string apikey, string email, InfoLidoDTO mInfoLido)
        {
            string url = "vendor/lido-setup";

            //long idLido = GetIdLido(email, apikey);

            var json = JsonConvert.SerializeObject(new
            {
                cabana_qty = mInfoLido.cabana_qty,
                //cabana_note = mInfoLido.cabana_note,
                lido_zone_array = (from x in mInfoLido.lido_zone_array
                                   select new
                {
                    name = x.IdFila,
                    x.umbrella_qty,
                    x.sun_bed_qty,
                    x.chair_qty
                }).ToList()
            });

            try
            {
                Task <HttpResponseMessage> response = null;
                response = ExecuteRequestJson(ConnectionHelper.WebServiceCallType.Post, json, url, apikey);

                var ctn = response.GetAwaiter().GetResult().Content.ReadAsStringAsync();
                return(JsonConvert.DeserializeObject <WebServiceResponseDTO <UserWebServiceDTO> >(ctn.Result));
            }
            catch (Exception ex)
            {
                return(new WebServiceResponseDTO <UserWebServiceDTO>()
                {
                    error = true, message = ConnectionHelper.ConnectionErrorString, data = null
                });
            }
        }
        public WebServiceResponseDTO <UserWebServiceDTO> SetServiziLido(string apikey, string email, InfoLidoDTO mInfoLido)
        {
            string url = "vendor/lido/services";

            //long idLido = GetIdLido(email, apikey);

            //PulisciServizi(apikey, email);

            var json = JsonConvert.SerializeObject(new { lido_service_array = (from x in mInfoLido.lido_service_array select int.Parse(x.IdServizio)).ToList() });

            try
            {
                Task <HttpResponseMessage> response = null;
                response = ExecuteRequestJson(ConnectionHelper.WebServiceCallType.Post, json, url, apikey);

                var ctn = response.GetAwaiter().GetResult().Content.ReadAsStringAsync();
                return(JsonConvert.DeserializeObject <WebServiceResponseDTO <UserWebServiceDTO> >(ctn.Result));
            }
            catch (Exception ex)
            {
                return(new WebServiceResponseDTO <UserWebServiceDTO>()
                {
                    error = true, message = ConnectionHelper.ConnectionErrorString, data = null
                });
            }
        }
        public WebServiceResponseDTO <UserWebServiceDTO> SetMailPaypal(string apikey, string email, InfoLidoDTO mInfoLido)
        {
            string url = "vendor/lido/paypal";

            //long idLido = GetIdLido(email, apikey);

            var listParam = new List <KeyValuePair <string, string> >();

            listParam.Add(new KeyValuePair <string, string>("email_paypal", mInfoLido.email_paypal));
            //listParam.Add(new KeyValuePair<string, string>("id_lido", idLido.ToString()));

            try
            {
                Task <HttpResponseMessage> response = null;
                response = ExecuteRequest(ConnectionHelper.WebServiceCallType.Post, listParam, url, apikey);

                var ctn = response.GetAwaiter().GetResult().Content.ReadAsStringAsync();
                return(JsonConvert.DeserializeObject <WebServiceResponseDTO <UserWebServiceDTO> >(ctn.Result));
            }
            catch (Exception ex)
            {
                return(new WebServiceResponseDTO <UserWebServiceDTO>()
                {
                    error = true, message = ConnectionHelper.ConnectionErrorString, data = null
                });
            }
        }
        public WebServiceResponseDTO <UserWebServiceDTO> SetListinoPrezzi(string apikey, InfoLidoDTO mInfoLido)
        {
            string url = "vendor/lido/prices";

            var listParam = new List <KeyValuePair <string, string> >();

            listParam.Add(new KeyValuePair <string, string>("cabana_price", mInfoLido.cabana_price.ToString()));
            listParam.Add(new KeyValuePair <string, string>("sun_bed_price", mInfoLido.sun_bed_price.ToString()));
            listParam.Add(new KeyValuePair <string, string>("umbrella_price", mInfoLido.umbrella_price.ToString()));
            listParam.Add(new KeyValuePair <string, string>("chair_price", mInfoLido.chair_price.ToString()));
            listParam.Add(new KeyValuePair <string, string>("cabana_note", mInfoLido.cabana_note));

            try
            {
                Task <HttpResponseMessage> response = null;
                response = ExecuteRequest(ConnectionHelper.WebServiceCallType.Post, listParam, url, apikey);

                var ctn = response.GetAwaiter().GetResult().Content.ReadAsStringAsync();
                return(JsonConvert.DeserializeObject <WebServiceResponseDTO <UserWebServiceDTO> >(ctn.Result));
            }
            catch (Exception ex)
            {
                return(new WebServiceResponseDTO <UserWebServiceDTO>()
                {
                    error = true, message = ConnectionHelper.ConnectionErrorString, data = null
                });
            }
        }
        public WebServiceResponseDTO <UserWebServiceDTO> SetInfoLido(string apiKey, string email, InfoLidoDTO mInfoLido)
        {
            string url = "vendor/lido/info";

            //long idLido = GetIdUtenteLido(apiKey);

            var listParam = new List <KeyValuePair <string, string> >();

            listParam.Add(new KeyValuePair <string, string>("name", mInfoLido.name));
            listParam.Add(new KeyValuePair <string, string>("telephone", mInfoLido.telephone));
            //listParam.Add(new KeyValuePair<string, string>("nomelido", mInfoLido.nomelido));
            listParam.Add(new KeyValuePair <string, string>("address", mInfoLido.address));
            listParam.Add(new KeyValuePair <string, string>("city", mInfoLido.city));
            listParam.Add(new KeyValuePair <string, string>("lat", mInfoLido.lat));
            listParam.Add(new KeyValuePair <string, string>("lng", mInfoLido.lng));
            listParam.Add(new KeyValuePair <string, string>("min_day_forewarning", mInfoLido.min_day_forewarning.ToString()));
            listParam.Add(new KeyValuePair <string, string>("open_season_date", mInfoLido.open_season_date.ToString("yyyyMMdd")));
            listParam.Add(new KeyValuePair <string, string>("close_season_date", mInfoLido.close_season_date.ToString("yyyyMMdd")));
            //listParam.Add(new KeyValuePair<string, string>("idutente", idLido.ToString()));

            try
            {
                Task <HttpResponseMessage> response = null;
                response = ExecuteRequest(ConnectionHelper.WebServiceCallType.Post, listParam, url, apiKey);

                var ctn = response.GetAwaiter().GetResult().Content.ReadAsStringAsync();
                return(JsonConvert.DeserializeObject <WebServiceResponseDTO <UserWebServiceDTO> >(ctn.Result));
            }
            catch (Exception ex)
            {
                return(new WebServiceResponseDTO <UserWebServiceDTO>()
                {
                    error = true, message = ConnectionHelper.ConnectionErrorString, data = null
                });
            }
        }
        public WebServiceResponseDTO <InfoLidoDTO> SetupCompletoLido(string apiKey, string email, InfoLidoDTO mInfoLido)
        {
            string url = "vendor/lido-complete-setup";

            //long idLido = GetIdUtenteLido(apiKey);

            //var listParam = new List<KeyValuePair<string, string>>();
            //listParam.Add(new KeyValuePair<string, string>("name", mInfoLido.name));
            //listParam.Add(new KeyValuePair<string, string>("telephone", mInfoLido.telephone));
            ////listParam.Add(new KeyValuePair<string, string>("nomelido", mInfoLido.nomelido));
            //listParam.Add(new KeyValuePair<string, string>("address", mInfoLido.address));
            //listParam.Add(new KeyValuePair<string, string>("city", mInfoLido.city));
            //listParam.Add(new KeyValuePair<string, string>("lat", mInfoLido.lat));
            //listParam.Add(new KeyValuePair<string, string>("lng", mInfoLido.lng));
            //listParam.Add(new KeyValuePair<string, string>("open_season_date", mInfoLido.open_season_date.ToString("yyyyMMdd")));
            //listParam.Add(new KeyValuePair<string, string>("close_season_date", mInfoLido.close_season_date.ToString("yyyyMMdd")));
            //listParam.Add(new KeyValuePair<string, string>("cabana_qty", mInfoLido.cabana_qty.ToString()));
            //listParam.Add(new KeyValuePair<string, string>("lido_zone_array", JsonConvert.SerializeObject((from x in mInfoLido.lido_zone_array
            //																							   select new
            //																							   {
            //																								   name = x.IdFila,
            //																								   x.umbrella_qty,
            //																								   x.sun_bed_qty,
            //																								   x.chair_qty
            //																							   }).ToList()
            //	                                                                                         )));
            //listParam.Add(new KeyValuePair<string, string>("cabana_price", mInfoLido.cabana_price.ToString()));
            //listParam.Add(new KeyValuePair<string, string>("sun_bed_price", mInfoLido.sun_bed_price.ToString()));
            //listParam.Add(new KeyValuePair<string, string>("umbrella_price", mInfoLido.umbrella_price.ToString()));
            //listParam.Add(new KeyValuePair<string, string>("chair_price", mInfoLido.chair_price.ToString()));
            //listParam.Add(new KeyValuePair<string, string>("email_paypal", mInfoLido.email_paypal));
            //listParam.Add(new KeyValuePair<string, string>("lido_service_array", JsonConvert.SerializeObject((from x in mInfoLido.lido_service_array select int.Parse(x.IdServizio)).ToList())));

            var jsonToRequest = JsonConvert.SerializeObject(new
            {
                mInfoLido.name,
                mInfoLido.telephone,
                mInfoLido.address,
                mInfoLido.city,
                mInfoLido.lat,
                mInfoLido.lng,
                open_season_date  = mInfoLido.open_season_date.ToString("yyyyMMdd"),
                close_season_date = mInfoLido.close_season_date.ToString("yyyyMMdd"),
                mInfoLido.cabana_qty,
                mInfoLido.cabana_note,
                lido_zone_array = (from x in mInfoLido.lido_zone_array
                                   select new
                {
                    name = x.IdFila,
                    x.umbrella_qty,
                    x.sun_bed_qty,
                    x.chair_qty
                }).ToList(),
                mInfoLido.cabana_price,
                mInfoLido.sun_bed_price,
                mInfoLido.umbrella_price,
                mInfoLido.chair_price,
                mInfoLido.email_paypal,
                lido_service_array = (from x in mInfoLido.lido_service_array select int.Parse(x.IdServizio)).ToList(),
                mInfoLido.user_name,
                mInfoLido.user_surname
            });

            //listParam.Add(new KeyValuePair<string, string>("idutente", idLido.ToString()));

            try
            {
                Task <HttpResponseMessage> response = null;
                //response = ExecuteRequest(ConnectionHelper.WebServiceCallType.Post, listParam, url, apiKey);
                response = ExecuteRequestJson(ConnectionHelper.WebServiceCallType.Post, jsonToRequest, url, apiKey);

                var ctn = response.GetAwaiter().GetResult().Content.ReadAsStringAsync();
                return(JsonConvert.DeserializeObject <WebServiceResponseDTO <InfoLidoDTO> >(ctn.Result));
            }
            catch (Exception ex)
            {
                return(new WebServiceResponseDTO <InfoLidoDTO>()
                {
                    error = true, message = ConnectionHelper.ConnectionErrorString, data = null
                });
            }
        }