예제 #1
0
        public static int GrabarCambioEstado(int IdUsuario, int OnOff)
        {
            try
            {
                if (IdUsuario > 0)
                {
                    ApiServices         objApi   = new ApiServices();
                    string              Request  = "{}";
                    HttpResponseMessage response = objApi.CallService("usuarios/GetUsuariosById/" + IdUsuario, Request, ApiServices.TypeMethods.GET).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        string Respuesta = response.Content.ReadAsStringAsync().Result;
                        Models.UsuarioViewModel objUsuario = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.UsuarioViewModel>(Respuesta);
                        if (objUsuario != null)
                        {
                            objUsuario.Estado = OnOff;
                            string RequestPUT = Newtonsoft.Json.JsonConvert.SerializeObject(objUsuario);
                            HttpResponseMessage responsePUT = objApi.CallService("usuarios/" + objUsuario.Id, RequestPUT, ApiServices.TypeMethods.PUT).Result;
                            if (responsePUT.IsSuccessStatusCode)
                            {
                                return(1);
                            }
                        }
                        //Models.Usuarios objUsuario = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.Usuarios>(Respuesta);
                        //if (objUsuario != null)
                        //{
                        //    objUsuario.Estado = OnOff;
                        //    response = null;

                        //    string Request2 = Newtonsoft.Json.JsonConvert.SerializeObject(objUsuario, new Newtonsoft.Json.JsonSerializerSettings()
                        //    {
                        //        PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects,
                        //        Formatting = Newtonsoft.Json.Formatting.Indented
                        //    });
                        //    response = objApi.CallService("usuarios/" + objUsuario.Id, Request2, ApiServices.TypeMethods.PUT).Result;
                        //    if (response.IsSuccessStatusCode)
                        //    {
                        //        return 1;
                        //    }
                        //}
                        return(0);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }
예제 #2
0
        public static int Grabar(string Titulo, string Desc, string FechaEnvio)
        {
            try
            {
                Models.Notificaciones objNotif = new Models.Notificaciones()
                {
                    Titulo      = Titulo,
                    Descripcion = Desc,
                    Fecha       = Convert.ToDateTime(FechaEnvio),
                    Prioridad   = 1,
                    Tipo        = "S",
                    Icono       = ""
                };

                ApiServices         objApi   = new ApiServices();
                HttpResponseMessage response = null;
                string Request = Newtonsoft.Json.JsonConvert.SerializeObject(objNotif);
                response = objApi.CallService("Notificaciones", Request, ApiServices.TypeMethods.POST).Result;

                #region
                Controllers.BodyNotificationPush objNotifPushReq = new Controllers.BodyNotificationPush()
                {
                    Titulo      = Titulo,
                    Descripcion = Desc
                };

                HttpResponseMessage responseNotif = null;
                //responseNotif = objApi.SendNotificationPush(Titulo, Desc).Result;
                string RequestPush = Newtonsoft.Json.JsonConvert.SerializeObject(objNotifPushReq);
                responseNotif = objApi.CallService("NotificationPush", RequestPush, ApiServices.TypeMethods.POST).Result;
                #endregion


                if (response.IsSuccessStatusCode && responseNotif.IsSuccessStatusCode)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }
        public void IniciarControles()
        {
            HdnIdDescuento.Value = "0";
            #region CargarCombo

            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("usuarios/GetUsuariosByTipo/2", Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string Respuesta           = response.Content.ReadAsStringAsync().Result;
                List <Models.Usuarios> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.Usuarios> >(Respuesta);
                DlComercio.DataSource     = obj;
                DlComercio.DataTextField  = "Nombre";
                DlComercio.DataValueField = "Id";
                DlComercio.DataBind();
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            #endregion
        }
예제 #4
0
        public void GetGrillaUltCupones()
        {
            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("Pedidos/UltDescuentosDescargados/" + 4, Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string Respuesta = response.Content.ReadAsStringAsync().Result;
                List <Models.PedidoViewModel> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.PedidoViewModel> >(Respuesta);
                string data = "";

                foreach (var item in obj)
                {
                    data += "<tr> ";
                    data += "<td> <img src='" + item.ImgUsuarioSolicita + "'> " + item.Nombre_UsuarioSolicita + " </td>  ";
                    data += "<td> " + item.Nombre_UsuarioInteres + " </td> ";
                    data += "<td> " + item.FechaPedido + " </td> ";
                    data += "<td> <label class='badge badge-gradient-info'>" + item.CodigoDescuento + "</label> </td> ";
                    data += "	</tr> ";
                }
                LitUltCupones.Text = data;
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
예제 #5
0
        public static int Eliminar(string idPreg)
        {
            try
            {
                if (!string.IsNullOrEmpty(idPreg))
                {
                    ApiServices         objApi   = new ApiServices();
                    HttpResponseMessage response = null;
                    string Request = "{}";
                    response = objApi.CallService("Preguntas_Frecuentes/" + idPreg, Request, ApiServices.TypeMethods.DELETE).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }
예제 #6
0
        public static List <Models.Paises> IniModalEdit(string Id)
        {
            List <Models.Paises> lista = new List <Models.Paises>();

            try
            {
                if (Id != "0")
                {
                    Int64               IdPais   = Convert.ToInt64(Id);
                    ApiServices         objApi   = new ApiServices();
                    string              Request  = "{}";
                    HttpResponseMessage response = objApi.CallService("Paises/" + IdPais, Request, ApiServices.TypeMethods.GET).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        //resp = await response.Content.ReadAsAsync();
                        string        Respuesta = response.Content.ReadAsStringAsync().Result;
                        Models.Paises obj       = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Paises>(Respuesta);
                        if (obj != null)
                        {
                            lista.Add(new Models.Paises
                            {
                                Id     = obj.Id,
                                Nombre = obj.Nombre
                            });
                        }
                    }
                }
            }
            catch
            {
                int sss = 0;
            }
            return(lista);
        }
예제 #7
0
        public void GetDetalleGrilla()
        {
            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("categorias", Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                //resp = await response.Content.ReadAsAsync();
                string RespuestaVtex = response.Content.ReadAsStringAsync().Result;
                List <ResponseServices.RespCategorias> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ResponseServices.RespCategorias> >(RespuestaVtex);
                string data = "";
                foreach (var item in obj)
                {
                    data += "<tr> ";
                    data += "<td> " + item.Id + " </td> ";
                    data += "<td> " + item.Nombre + " </td>  ";
                    data += "<td><img src='" + item.Imagen + "' style='width:200px !important;border-radius:0px !important;height: auto !important;' ></td> ";
                    data += "<td style='font-size: x-large'>  ";
                    data += "<a style='cursor:pointer' onclick='GetEditId(" + item.Id + ");return false' ><i class='mdi mdi-lead-pencil'></i><span class='count-symbol bg-warning'></span></a> ";
                    data += "<a style='cursor:pointer' onclick='SetDeleteId(" + item.Id + ");return false' ><i class='mdi mdi-delete-outline'></i><span class='count-symbol bg-warning'></span></a> ";
                    data += "</td>	</tr> ";
                }
                LitCategorias.Text = data;
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
예제 #8
0
        public void GetDetalleGrilla()
        {
            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("Preguntas_Frecuentes", Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                //resp = await response.Content.ReadAsAsync();
                string Respuesta = response.Content.ReadAsStringAsync().Result;
                List <Models.Preguntas_Frecuentes> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.Preguntas_Frecuentes> >(Respuesta);
                string data = "";
                foreach (var item in obj)
                {
                    data += "<tr> ";
                    data += "<td> " + item.Id + " </td>  ";
                    data += "<td> " + item.Pregunta + " </td>  ";
                    data += "<td> " + item.Orden + " </td> ";
                    data += "<td style='font-size: x-large'>  ";
                    //data += "<a style='cursor:pointer' onclick='GetEditId(\"" + item.Pregunta + "\");return false' ><i class='mdi mdi-lead-pencil'></i><span class='count-symbol bg-warning'></span></a> ";
                    data += "<a style='cursor:pointer' onclick='GetEditId(" + item.Id + ");return false' ><i class='mdi mdi-lead-pencil'></i><span class='count-symbol bg-warning'></span></a> ";
                    data += "<a style='cursor:pointer' onclick='SetDeleteId(" + item.Id + ");return false' ><i class='mdi mdi-delete-outline'></i><span class='count-symbol bg-warning'></span></a> ";
                    data += "</td>	</tr> ";
                }
                LitFAQ.Text = data;
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
예제 #9
0
        public static int Eliminar(int idDesc)
        {
            try
            {
                if (idDesc > 0)
                {
                    ApiServices         objApi   = new ApiServices();
                    HttpResponseMessage response = null;
                    string Request = "{}";
                    response = objApi.CallService("productos/" + idDesc, Request, ApiServices.TypeMethods.DELETE).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }
예제 #10
0
        public void IniciarControles()
        {
            HdnIdLocalidad.Value = "0";

            //LblIdLocalidad.Text = "";
            //TxbDescripcion.Text = "";
            //TxbDirecGMap.Text = "";
            //TxbProvincia.Text = "";
            #region CargarCombo

            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("paises", Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string Respuesta         = response.Content.ReadAsStringAsync().Result;
                List <Models.Paises> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.Paises> >(Respuesta);
                DlPais.DataSource     = obj;
                DlPais.DataTextField  = "Nombre";
                DlPais.DataValueField = "Id";
                DlPais.DataBind();
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            #endregion
        }
예제 #11
0
        public void GetGrillaUltUsuarios()
        {
            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("usuarios/UltimosUsuarios/" + 6, Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string Respuesta           = response.Content.ReadAsStringAsync().Result;
                List <Models.Usuarios> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.Usuarios> >(Respuesta);
                string data = "";

                foreach (var item in obj)
                {
                    data += "<tr> ";
                    data += "<td> " + item.Id + " </td> ";
                    data += "<td> " + item.Nombre + " </td> ";
                    data += "<td> " + item.Fecha_Alta.Value.ToShortDateString() + " </td> ";
                    data += "<td> <div class='progress'><div class='progress-bar bg-gradient-success' role='progressbar' style='width: 100%' aria-valuenow='100' aria-valuemin='0' aria-valuemax='100'></div> </div> </td> ";
                    data += "	</tr> ";
                }
                LitUltUsuarios.Text = data;
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
예제 #12
0
        public void GetDetallePedido(int idPed)
        {
            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("Pedidos/" + idPed, Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string         Respuesta = response.Content.ReadAsStringAsync().Result;
                Models.Pedidos obj       = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Pedidos>(Respuesta);

                LblTitulo.Text          = "Detalle de Canje #" + obj.Id.ToString();
                LblUsuarioVendedor.Text = obj.Productos.Usuarios.Nombre.ToString();
                LblFechaAltaCanje.Text  = obj.FechaPedido.Value.ToShortDateString();
                LblImporte.Text         = "$" + obj.Productos.Importe.ToString();
                imgUsuario.ImageUrl     = obj.Productos.Usuarios.Imagen;

                string data = "";
                data += "<div class='row mt-3'> ";
                data += "<div class='col-6 pr-1'> ";
                data += "<img src='" + obj.Productos.Imagen + "' class='mb-2 mw-100 w-100 rounded' alt='image'> ";
                if (obj.Productos.Imagen2 != null)
                {
                    data += "<img src='" + obj.Productos.Imagen2 + "' class='mw-100 w-100 rounded' alt='image'> ";
                }

                data += "</div> ";
                data += "</div> ";

                LitImgCanje.Text = data;

                ///////////////
                string dataProd = "";
                dataProd += "<div class='d-flex mt-5 align-items-top'> ";
                //dataProd += "<img src='"+obj.Usuarios.Imagen+"' class='img-sm rounded-circle mr-3' alt='image'> ";
                dataProd += "<div class='mb-0 flex-grow'> ";
                dataProd += "<h5 class='mr-2 mb-2'>" + obj.Productos.Nombre + "</h5> ";
                dataProd += "<p class='mb-0 font-weight-light'>" + obj.Productos.Descripcion + "</p> ";
                dataProd += "</div></div> ";

                LitDetalleCanje.Text = dataProd;

                if (obj.IdPedido_Estado > 2)
                {
                    DivMatch.Visible = true;
                    GetDatosComprador(obj);
                }
                else
                {
                    DivMatch.Visible = false;
                }
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
예제 #13
0
        public static List <Models.ProductoEditVM> IniModalEdit(string Id)
        {
            List <Models.ProductoEditVM> lista = new List <Models.ProductoEditVM>();

            try
            {
                if (Id != "0")
                {
                    Int64               IdPedido = Convert.ToInt64(Id);
                    ApiServices         objApi   = new ApiServices();
                    string              Request  = "{}";
                    HttpResponseMessage response = objApi.CallService("productos/ProductsByIdProd/" + IdPedido, Request, ApiServices.TypeMethods.GET).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        //resp = await response.Content.ReadAsAsync();
                        string        Respuesta = response.Content.ReadAsStringAsync().Result;
                        Models.ItemVM obj       = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.ItemVM>(Respuesta);
                        if (obj != null)
                        {
                            //lista.Add(new Models.Productos
                            //{
                            //    Id = obj.Id,
                            //    Nombre = obj.Nombre,
                            //    Descripcion = obj.Descripcion,
                            //    CodigoDescuento = obj.CodigoDescuento,
                            //    Cantidad = obj.Cantidad,
                            //    PorcentajeDescuento = obj.PorcentajeDesc,
                            //    FechaVencimiento = obj.FechaVencimiento,
                            //    Imagen = obj.Imagen,
                            //    IdUsuario = obj.IdUsuario
                            //});
                            lista.Add(new Models.ProductoEditVM
                            {
                                Id                  = obj.Id,
                                Nombre              = obj.Nombre,
                                Descripcion         = obj.Descripcion,
                                CodigoDescuento     = obj.CodigoDescuento,
                                Cantidad            = obj.Cantidad,
                                PorcentajeDescuento = obj.PorcentajeDesc,
                                FechaVencimiento    = obj.FechaVencimiento,
                                Imagen              = obj.Imagen,
                                IdUsuario           = obj.IdUsuario,
                                IdCategoria         = obj.IdCategoria,
                                FechaVenceAnio      = (obj.FechaVencimiento != null) ? obj.FechaVencimiento.Value.Year : 2020,
                                FechaVenceMes       = (obj.FechaVencimiento != null) ? obj.FechaVencimiento.Value.Month : 12,
                                FechaVenceDia       = (obj.FechaVencimiento != null) ? obj.FechaVencimiento.Value.Day.ToString().PadLeft(2, '0') : "31",
                            });
                        }
                    }
                }
            }
            catch
            {
                int sss = 0;
            }
            return(lista);
        }
예제 #14
0
        public void GetDetalleGrilla(int idEstado)
        {
            switch (idEstado)
            {
            case 1:     //Pendiente
                LblTituloGrilla.Text = "Listado de Descuentos Pendientes";
                break;

            case 4:     //Confirmados
                LblTituloGrilla.Text = "Listado de Descuentos Confirmados";
                break;
            }

            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("Pedidos/DescuentosByState/" + idEstado, Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string Respuesta = response.Content.ReadAsStringAsync().Result;
                List <Models.PedidoViewModel> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.PedidoViewModel> >(Respuesta);
                string data = "";

                foreach (var item in obj)
                {
                    data += "<tr> ";
                    data += "<td> <img src='" + item.ImgUsuarioSolicita + "'> " + item.Nombre_UsuarioSolicita + " </td>  ";

                    data += "<td> " + item.NombreProductoInteres + " </td> ";
                    data += "<td><label class='badge badge-gradient-success'>" + item.Desc_Estado + "</label></td>  ";
                    data += "<td> " + item.FechaPedido + " </td> ";
                    data += "<td> " + item.Id + " </td> ";
                    data += "<td> " + item.CodigoDescuento + " </td> ";
                    data += "<td style='font-size: x-large'>  ";
                    if (idEstado > 1)
                    {
                        data += "<a style='cursor:pointer' onclick='VerDetalle(" + item.Id + ");return false' ><i class='mdi mdi-magnify'></i><span class='count-symbol bg-warning'></span></a> ";
                    }
                    if (idEstado == 1)
                    {
                        data += "<a style='cursor:pointer' onclick='SetDeleteId(" + item.Id + ");return false' ><i class='mdi mdi-delete-outline'></i><span class='count-symbol bg-warning'></span></a> ";
                    }

                    data += "<a style='cursor:pointer' onclick='GetEditId(" + item.Id + ");return false' ><i class='mdi mdi-pencil'></i><span class='count-symbol bg-warning'></span></a> ";
                    data += "</td></td>	</tr> ";
                }
                LitGrilla.Text = data;
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
예제 #15
0
        public static int Grabar(Models.Usuarios comercio, int EsNuevo)
        //public static int Grabar(int EsNuevo)
        //public static int Grabar(string Nombre, string Direccion, int Telefono, string Mail, Int64 Cuit, string RazonSocial, string Imagen, int EsNuevo)
        {
            //Models.Usuarios comercio = new Models.Usuarios();
            try
            {
                if (comercio != null)
                {
                    ApiServices         objApi   = new ApiServices();
                    HttpResponseMessage response = null;
                    if (EsNuevo == 0)
                    {
                        string Request = Newtonsoft.Json.JsonConvert.SerializeObject(comercio);
                        response = objApi.CallService("usuarios/" + comercio.Id, Request, ApiServices.TypeMethods.PUT).Result;
                    }
                    else
                    {
                        comercio.Fecha_Alta = DateTime.Now;
                        string Request = Newtonsoft.Json.JsonConvert.SerializeObject(comercio);
                        response = objApi.CallService("usuarios", Request, ApiServices.TypeMethods.POST).Result;
                    }

                    if (response.IsSuccessStatusCode)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }
예제 #16
0
        public static int Grabar(Models.Usuarios usuario, int EsNuevo)
        {
            try
            {
                if (usuario != null)
                {
                    ApiServices         objApi   = new ApiServices();
                    HttpResponseMessage response = null;
                    usuario.Fecha_Alta = DateTime.Now;

                    string Request = Newtonsoft.Json.JsonConvert.SerializeObject(usuario);
                    if (EsNuevo == 0)
                    {
                        response = objApi.CallService("usuarios/" + usuario.Id, Request, ApiServices.TypeMethods.PUT).Result;
                    }
                    else
                    {
                        response = objApi.CallService("usuarios", Request, ApiServices.TypeMethods.POST).Result;
                    }

                    if (response.IsSuccessStatusCode)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }
예제 #17
0
        //public async Task GetDetalleGrilla()
        public void GetDetalleGrilla()
        {
            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("usuarios/GetUsuariosByTipo/1", Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string Respuesta           = response.Content.ReadAsStringAsync().Result;
                List <Models.Usuarios> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.Usuarios> >(Respuesta);
                string data = "";

                foreach (var item in obj)
                {
                    data += "<tr> ";
                    data += "<td> " + item.Id + " </td> ";
                    data += "<td> <img src='" + item.Imagen + "'> " + item.Nombre + " </td>  ";
                    data += "<td> " + item.Mail + " </td> ";
                    data += "<td> " + item.Whatsapp + " </td> ";
                    if (item.Estado == 1)
                    {
                        data += "<td> ACTIVO </td>  ";
                    }
                    else
                    {
                        data += "<td> INACTIVO </td>  ";
                    }

                    data += "<td><label class='badge badge-gradient-success'>" + item.Planes.Descripcion + "</label> </td> ";
                    data += "<td style='font-size: x-large'>  ";
                    if (item.Estado == 1)
                    {
                        data += "<a style='cursor:pointer' alt='Desactivar' onclick='ActivarDesactivarUsuario(" + item.Id + ",0);return false' ><i class='mdi mdi-close-circle'></i><span class='count-symbol bg-warning'></span></a> ";
                    }
                    else
                    {
                        data += "<a style='cursor:pointer' alt='Activar' onclick='ActivarDesactivarUsuario(" + item.Id + ",1);return false' ><i class='mdi mdi-checkbox-marked-circle'></i><span class='count-symbol bg-warning'></span></a> ";
                    }

                    data += "<a style='cursor:pointer' onclick='SetDeleteId(" + item.Id + ");return false' ><i class='mdi mdi-delete-outline'></i><span class='count-symbol bg-warning'></span></a> ";
                    data += "</td>	</tr> ";
                }
                LitGrilla.Text = data;
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
예제 #18
0
        public static int Grabar(Models.Preguntas_Frecuentes preg, int EsNuevo)
        {
            try
            {
                if (preg != null)
                {
                    ApiServices         objApi   = new ApiServices();
                    HttpResponseMessage response = null;
                    string Request = Newtonsoft.Json.JsonConvert.SerializeObject(preg);
                    if (EsNuevo == 0)
                    {
                        response = objApi.CallService("Preguntas_Frecuentes/" + preg.Id, Request, ApiServices.TypeMethods.PUT).Result;
                    }
                    else
                    {
                        response = objApi.CallService("Preguntas_Frecuentes", Request, ApiServices.TypeMethods.POST).Result;
                    }

                    if (response.IsSuccessStatusCode)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }
예제 #19
0
        public static List <Models.Usuarios> IniModalEdit(string Id)
        {
            List <Models.Usuarios> lista = new List <Models.Usuarios>();

            try
            {
                if (Id != "0")
                {
                    Int64               IdComercio = Convert.ToInt64(Id);
                    ApiServices         objApi     = new ApiServices();
                    string              Request    = "{}";
                    HttpResponseMessage response   = objApi.CallService("usuarios/" + IdComercio, Request, ApiServices.TypeMethods.GET).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        //resp = await response.Content.ReadAsAsync();
                        string          Respuesta = response.Content.ReadAsStringAsync().Result;
                        Models.Usuarios obj       = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Usuarios>(Respuesta);
                        if (obj != null)
                        {
                            lista.Add(new Models.Usuarios
                            {
                                Id           = obj.Id,
                                Nombre       = obj.Nombre,
                                Direccion    = obj.Direccion,
                                Telefono     = obj.Telefono,
                                Mail         = obj.Mail,
                                Cuit         = obj.Cuit,
                                Razon_Social = obj.Razon_Social,
                                Imagen       = obj.Imagen,
                                token        = obj.token,
                                IdTipo       = obj.IdTipo,
                                Estado       = obj.Estado,
                                Lat          = obj.Lat,
                                Long         = obj.Long,
                                Puntuacion   = obj.Puntuacion
                            });
                        }
                    }
                }
            }
            catch
            {
                int sss = 0;
            }
            return(lista);
        }
예제 #20
0
        public void GetDatosComprador(Models.Pedidos obj, Models.Usuarios objUsuario)
        {
            LblUsuarioComprador.Text     = objUsuario.Nombre.ToString();
            LblFechaEntrega.Text         = (obj.FechaEntrega != null) ? obj.FechaEntrega.Value.ToShortDateString():"";
            LblImporteDiferencia.Text    = "Diferencia $0";
            imgUsuarioComprador.ImageUrl = objUsuario.Imagen;

            string data = "";

            data += "<div class='row mt-3'> ";
            data += "<div class='col-6 pr-1'> ";
            data += "<img src='" + obj.Usuarios.Imagen + "' class='mb-2 mw-100 w-100 rounded' alt='image'> ";

            data += "</div> ";
            data += "</div> ";

            LitImgCanjeComprador.Text = data;

            ///////////////
            if (obj.IdProductoInteres != null)
            {
                ApiServices         objApi   = new ApiServices();
                HttpResponseMessage response = objApi.CallService("Productos/" + obj.IdProductoInteres, "{}", ApiServices.TypeMethods.GET).Result;
                if (response.IsSuccessStatusCode)
                {
                    string Respuesta         = response.Content.ReadAsStringAsync().Result;
                    var    dateTimeConverter = new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    };
                    Models.Productos ObjProductos = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Productos>(Respuesta, dateTimeConverter);

                    if (ObjProductos != null)
                    {
                        string dataProd = "";
                        dataProd += "<div class='d-flex mt-5 align-items-top'> ";
                        dataProd += "<div class='mb-0 flex-grow'> ";
                        dataProd += "<h5 class='mr-2 mb-2'>" + ObjProductos.Nombre + "</h5> ";
                        dataProd += "<p class='mb-0 font-weight-light'>" + ObjProductos.Descripcion + "</p> ";
                        dataProd += "</div></div> ";

                        LitDetalleCanjeComprador.Text = dataProd;
                    }
                }
            }
        }
예제 #21
0
        public void GetDetalleGrilla()
        {
            ApiServices objApi  = new ApiServices();
            string      Request = "{}";
            //HttpResponseMessage response=objApi.CallService("Pedidos/DescuentosByState/" + idEstado, Request, ApiServices.TypeMethods.GET).Result;
            HttpResponseMessage response = objApi.CallService("Notificaciones/", Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string Respuesta = response.Content.ReadAsStringAsync().Result;
                List <Models.Notificaciones> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.Notificaciones> >(Respuesta);
                string data = "";

                foreach (var item in obj)
                {
                    data += "<tr> ";
                    data += "<td> " + item.Id + " </td> ";
                    data += "<td> " + item.Titulo + " </td> ";
                    data += "<td> " + item.Fecha + " </td> ";
                    data += "<td><label class='badge badge-gradient-success'>ENVIADA</label></td>  ";
                    //data += "<td> <img src='" + item.Img_Usuario + "'> " + item.Nombre_Usuario + " </td>  ";

                    //data += "<td> " + item.Nombre_Producto + " </td> ";

                    //data += "<td> " + item.Fecha_Pedido.Value.ToShortDateString() + " </td> ";
                    //data += "<td> " + item.Id + " </td> ";
                    //data += "<td> " + item.CodigoDescuento + " </td> ";
                    data += "<td style='font-size: x-large'>  ";
                    data += "<a style='cursor:pointer' onclick='VerDetalle(" + item.Id + ");return false' ><i class='mdi mdi-magnify'></i><span class='count-symbol bg-warning'></span></a> ";
                    data += "</td></td>	</tr> ";
                }
                LitGrilla.Text = data;
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
예제 #22
0
        public void GetGrillaUltCanjes()
        {
            ApiServices         objApi   = new ApiServices();
            string              Request  = "{}";
            HttpResponseMessage response = objApi.CallService("Pedidos/UltimosCanjes/" + 4, Request, ApiServices.TypeMethods.GET).Result;

            if (response.IsSuccessStatusCode)
            {
                string Respuesta = response.Content.ReadAsStringAsync().Result;
                List <Models.PedidoViewModel> obj = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.PedidoViewModel> >(Respuesta);
                string data = "";

                foreach (var item in obj)
                {
                    data += "<tr> ";
                    data += "<td> <img src='" + item.Img_Usuario + "'> " + item.Nombre_Usuario + " </td>  ";

                    data += "<td> " + item.Nombre_Producto + " </td> ";
                    if (item.IdPedido_Estado == 1)
                    {
                        data += "<td><label class='badge badge-gradient-success'>" + item.Desc_Estado + "</label></td>  ";
                    }
                    else
                    {
                        data += "<td><label class='badge badge-gradient-warning'>" + item.Desc_Estado + "</label></td>  ";
                    }

                    data += "<td> " + item.Fecha_Pedido.Value.ToShortDateString() + " </td> ";
                    data += "<td> " + item.Id + " </td> ";
                    data += "	</tr> ";
                }
                LitGrillaUltCanjes.Text = data;
            }
            else
            {
                string RespuestaService  = response.Content.ReadAsStringAsync().Result;
                ApiServices.Response obj = Newtonsoft.Json.JsonConvert.DeserializeObject <ApiServices.Response>(RespuestaService);
                RespuestaService = response.StatusCode + " - " + obj.Error.message;
            }
            //return ListaOrdenes;
        }
        public static int Grabar(string Nombre, string Desc, string Codigo, string Imagen, string IdUsuario, string Cantidad)
        {
            try
            {
                string           CodDescuento = (string.IsNullOrEmpty(Codigo)) ? new Models.FuncGrales().GenerateRandom(8) : Codigo;
                Models.Productos objProd      = new Models.Productos()
                {
                    Nombre             = Nombre,
                    Descripcion        = Desc,
                    CodigoDescuento    = CodDescuento,
                    Imagen             = Imagen,
                    IdUsuario          = Convert.ToInt32(IdUsuario),
                    Cantidad           = Convert.ToInt32(Cantidad),
                    IdTipo             = 2,
                    IdEstado           = 1,
                    Importe            = 0,
                    Fecha_Publicacion  = DateTime.Now,
                    TipoDespublicacion = 1,
                    IdCategoria        = 1
                };

                ApiServices         objApi   = new ApiServices();
                HttpResponseMessage response = null;
                string Request = Newtonsoft.Json.JsonConvert.SerializeObject(objProd);
                response = objApi.CallService("productos", Request, ApiServices.TypeMethods.POST).Result;

                if (response.IsSuccessStatusCode)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }
예제 #24
0
        public static List <Models.Preguntas_Frecuentes> IniModalEdit(int Id)
        {
            List <Models.Preguntas_Frecuentes> lista = new List <Models.Preguntas_Frecuentes>();

            try
            {
                if (Id > 0)
                {
                    //Int64 IdFAQ = Convert.ToInt64(Id);
                    ApiServices         objApi   = new ApiServices();
                    string              Request  = "{}";
                    HttpResponseMessage response = objApi.CallService("Preguntas_Frecuentes/" + Id, Request, ApiServices.TypeMethods.GET).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        //resp = await response.Content.ReadAsAsync();
                        string Respuesta = response.Content.ReadAsStringAsync().Result;
                        Models.Preguntas_Frecuentes obj = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Preguntas_Frecuentes>(Respuesta);
                        if (obj != null)
                        {
                            lista.Add(new Models.Preguntas_Frecuentes
                            {
                                Id        = obj.Id,
                                Orden     = obj.Orden,
                                Pregunta  = obj.Pregunta,
                                Respuesta = obj.Respuesta
                            });
                        }
                    }
                }
            }
            catch
            {
                int sss = 0;
            }
            return(lista);
        }
예제 #25
0
        public static List <Models.Terminos> IniModalEdit(int Id)
        {
            List <Models.Terminos> lista = new List <Models.Terminos>();

            try
            {
                if (Id > 0)
                {
                    //Int64 IdFAQ = Convert.ToInt64(Id);
                    ApiServices         objApi   = new ApiServices();
                    string              Request  = "{}";
                    HttpResponseMessage response = objApi.CallService("Terminos/" + Id, Request, ApiServices.TypeMethods.GET).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        //resp = await response.Content.ReadAsAsync();
                        string          Descripcion = response.Content.ReadAsStringAsync().Result;
                        Models.Terminos obj         = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Terminos>(Descripcion);
                        if (obj != null)
                        {
                            lista.Add(new Models.Terminos
                            {
                                Id          = obj.Id,
                                Titulo      = obj.Titulo,
                                Descripcion = obj.Descripcion
                            });
                        }
                    }
                }
            }
            catch
            {
                int sss = 0;
            }
            return(lista);
        }
예제 #26
0
        public static int Grabar(string Nombre, string Desc, string Codigo, string Imagen, string IdUsuario, string Cantidad, string PorcDesc, string FechaVence, int flagoEsNuevo, int IdProducto, int IdCategoria)
        {
            try
            {
                ////////////////////////////
                string LatComercio = "", LngComercio = "";
                #region Get Latitud y Longitud Comercio
                try
                {
                    ApiServices         objApiUsuario = new ApiServices();
                    HttpResponseMessage respUsuario   = objApiUsuario.CallService("usuarios/" + IdUsuario, "{}", ApiServices.TypeMethods.GET).Result;
                    if (respUsuario.IsSuccessStatusCode)
                    {
                        //resp = await response.Content.ReadAsAsync();
                        string          Respuesta = respUsuario.Content.ReadAsStringAsync().Result;
                        Models.Usuarios obj       = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.Usuarios>(Respuesta);
                        if (obj != null)
                        {
                            LatComercio = obj.Lat;
                            LngComercio = obj.Long;
                        }
                    }
                }
                catch
                {
                }
                #endregion


                ////////////////////////


                string           CodDescuento = (string.IsNullOrEmpty(Codigo)) ? new Models.FuncGrales().GenerateRandom(8) : Codigo;
                Models.Productos objProd      = new Models.Productos()
                {
                    Id                  = (flagoEsNuevo == 1)? 0: IdProducto,
                    Nombre              = Nombre,
                    Descripcion         = Desc,
                    CodigoDescuento     = CodDescuento,
                    Imagen              = Imagen,
                    IdUsuario           = Convert.ToInt32(IdUsuario),
                    Cantidad            = Convert.ToInt32(Cantidad),
                    IdTipo              = 2,
                    IdEstado            = 1,
                    Importe             = 0,
                    Fecha_Publicacion   = DateTime.Now,
                    TipoDespublicacion  = 1,
                    IdCategoria         = IdCategoria,
                    PorcentajeDescuento = PorcDesc,
                    FechaVencimiento    = Convert.ToDateTime(FechaVence),
                    lat                 = LatComercio,
                    lng                 = LngComercio
                };

                ApiServices         objApi   = new ApiServices();
                HttpResponseMessage response = null;
                string Request = Newtonsoft.Json.JsonConvert.SerializeObject(objProd);
                if (flagoEsNuevo == 1)
                {
                    response = objApi.CallService("productos", Request, ApiServices.TypeMethods.POST).Result;
                }
                else
                {
                    response = objApi.CallService("productos/" + IdProducto, Request, ApiServices.TypeMethods.PUT).Result;
                }


                if (response.IsSuccessStatusCode)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                //Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(0);
            }
        }