コード例 #1
0
        public static async Task ActualizarTerminalPorSucursal(TerminalPorSucursal terminal, string strToken)
        {
            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
                StringContent contentJson = serializarEntidad(terminal);
                if (strToken != "")
                {
                    httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", strToken);
                }
                HttpResponseMessage httpResponse = await httpClient.PostAsync(strServicioURL + "/actualizarterminalporsucursal", contentJson);

                if (httpResponse.StatusCode == HttpStatusCode.InternalServerError)
                {
                    string strError = serializer.Deserialize <string>(httpResponse.Content.ReadAsStringAsync().Result);
                    throw new Exception(strError);
                }
                if (httpResponse.StatusCode != HttpStatusCode.OK)
                {
                    throw new Exception(httpResponse.ReasonPhrase);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public static async Task <TerminalPorSucursal> ObtenerTerminalPorSucursal(int intIdEmpresa, int intIdSucursal, int intIdTerminal, string strToken)
        {
            try
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
                if (strToken != "")
                {
                    httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", strToken);
                }
                HttpResponseMessage httpResponse = await httpClient.GetAsync(strServicioURL + "/obtenerterminalporsucursal?idempresa=" + intIdEmpresa + "&idsucursal=" + intIdSucursal + "&idterminal=" + intIdTerminal);

                if (httpResponse.StatusCode == HttpStatusCode.InternalServerError)
                {
                    string strError = serializer.Deserialize <string>(httpResponse.Content.ReadAsStringAsync().Result);
                    throw new Exception(strError);
                }
                if (httpResponse.StatusCode != HttpStatusCode.OK)
                {
                    throw new Exception(httpResponse.ReasonPhrase);
                }
                TerminalPorSucursal sucursal = null;
                string responseContent       = await httpResponse.Content.ReadAsStringAsync();

                string strResponse = serializer.Deserialize <string>(responseContent);
                if (strResponse != "")
                {
                    sucursal = serializer.Deserialize <TerminalPorSucursal>(strResponse);
                }
                return(sucursal);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        private async void CargarTerminalPorSucursal()
        {
            if (txtIdEmpresa.Text != "" && txtIdSucursal.Text != "" && txtIdTerminal.Text != "")
            {
                terminal = await Administrador.ObtenerTerminalPorSucursal(int.Parse(txtIdEmpresa.Text), int.Parse(txtIdSucursal.Text), int.Parse(txtIdTerminal.Text), strToken);

                if (terminal == null)
                {
                    bolTerminalNueva            = true;
                    terminal                    = new TerminalPorSucursal();
                    terminal.IdEmpresa          = int.Parse(txtIdEmpresa.Text);
                    terminal.IdSucursal         = int.Parse(txtIdSucursal.Text);
                    terminal.IdTerminal         = int.Parse(txtIdTerminal.Text);
                    txtValorRegistro.Text       = "";
                    txtDescripcionTerminal.Text = "Terminal " + txtIdTerminal.Text;
                    chkDispositivoMovil.Checked = false;
                    MessageBox.Show("La sucursal y terminal ingresados no están registrados para la empresa actual. Ingrese la información y proceda a guardar los cambios. . .", "Leandro Software", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    bolTerminalNueva            = false;
                    txtValorRegistro.Text       = terminal.ValorRegistro;
                    txtDescripcionTerminal.Text = "Terminal " + txtIdTerminal.Text;
                    chkDispositivoMovil.Checked = terminal.IdTipoDispositivo == StaticTipoDispisitivo.AppMovil;
                }
            }
        }
コード例 #4
0
        private async void CargarSucursalPorEmpresa()
        {
            if (txtIdEmpresa.Text != "" && txtIdSucursal.Text != "")
            {
                sucursal = await Administrador.ObtenerSucursalPorEmpresa(int.Parse(txtIdEmpresa.Text), int.Parse(txtIdSucursal.Text), strToken);

                if (sucursal == null)
                {
                    bolSucursalNueva            = true;
                    bolTerminalNueva            = true;
                    sucursal                    = new SucursalPorEmpresa();
                    sucursal.IdEmpresa          = int.Parse(txtIdEmpresa.Text);
                    sucursal.IdSucursal         = int.Parse(txtIdSucursal.Text);
                    txtNombreSucursal.Text      = txtNombreComercial.Text != "" ? txtNombreComercial.Text : txtNombreEmpresa.Text;
                    txtDireccionSucursal.Text   = txtDireccion.Text;
                    txtTelefonoSucursal.Text    = txtTelefono.Text;
                    txtIdTerminal.Text          = "1";
                    txtDescripcionTerminal.Text = "Terminal 1";
                    txtValorRegistro.Text       = "";
                    terminal                    = new TerminalPorSucursal();
                    terminal.IdEmpresa          = int.Parse(txtIdEmpresa.Text);
                    terminal.IdSucursal         = int.Parse(txtIdSucursal.Text);
                    terminal.IdTerminal         = 1;
                    terminal.ValorRegistro      = "";
                    terminal.ImpresoraFactura   = "";
                    terminal.AnchoLinea         = 0;
                    terminal.UltimoDocFE        = 0;
                    terminal.UltimoDocND        = 0;
                    terminal.UltimoDocNC        = 0;
                    terminal.UltimoDocTE        = 0;
                    terminal.UltimoDocMR        = 0;
                    terminal.IdTipoDispositivo  = chkDispositivoMovil.Checked ? StaticTipoDispisitivo.AppMovil : StaticTipoDispisitivo.AppEscritorio;
                    txtIdTerminal.Enabled       = false;
                    txtValorRegistro.Enabled    = false;
                    btnCargarTerminal.Enabled   = false;
                    MessageBox.Show("La sucursal no están registrada para la empresa actual. Ingrese la información y proceda a guardar los cambios. . .", "Leandro Software", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    bolSucursalNueva            = false;
                    bolTerminalNueva            = false;
                    terminal                    = null;
                    txtIdTerminal.Text          = "";
                    txtDescripcionTerminal.Text = "";
                    chkDispositivoMovil.Checked = false;
                    txtNombreSucursal.Text      = sucursal.NombreSucursal;
                    txtDireccionSucursal.Text   = sucursal.Direccion;
                    txtTelefonoSucursal.Text    = sucursal.Telefono;
                    txtIdTerminal.Enabled       = true;
                    txtValorRegistro.Enabled    = true;
                    btnCargarTerminal.Enabled   = true;
                }
            }
        }
コード例 #5
0
 public void ActualizarTerminalPorSucursal(string strDatos)
 {
     try
     {
         JObject             parametrosJO = JObject.Parse(strDatos);
         string              strEntidad   = parametrosJO.Property("Entidad").Value.ToString();
         TerminalPorSucursal terminal     = serializer.Deserialize <TerminalPorSucursal>(strEntidad);
         servicioMantenimiento.ActualizarTerminalPorSucursal(terminal);
     }
     catch (Exception ex)
     {
         throw new WebFaultException <string>(ex.Message, HttpStatusCode.InternalServerError);
     }
 }
コード例 #6
0
 public string ObtenerTerminalPorSucursal(int intIdEmpresa, int intIdSucursal, int intIdTerminal)
 {
     try
     {
         TerminalPorSucursal terminal = servicioMantenimiento.ObtenerTerminalPorSucursal(intIdEmpresa, intIdSucursal, intIdTerminal);
         string strRespuesta          = "";
         if (terminal != null)
         {
             strRespuesta = serializer.Serialize(terminal);
         }
         return(strRespuesta);
     }
     catch (Exception ex)
     {
         throw new WebFaultException <string>(ex.Message, HttpStatusCode.InternalServerError);
     }
 }