protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.title = this.drawerTitle = this.Title; Helpers.Preferencias preferencias = new Preferencias(this); this.drawerLayout = this.FindViewById <DrawerLayout>(Resource.Id.drawer_layout); this.drawerListView = this.FindViewById <ListView>(Resource.Id.left_drawer_Menu); //Create Adapter for drawer List this.drawerListView.Adapter = new ArrayAdapter <string>(this, Resource.Layout.item_menu, Sections); //Set click handler when item is selected this.drawerListView.ItemClick += (sender, args) => ListItemClicked(args.Position); //Set Drawer Shadow this.drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start); //DrawerToggle is the animation that happens with the indicator next to the actionbar this.drawerToggle = new MyActionBarDrawerToggle(this, this.drawerLayout, this.Toolbar, Resource.String.drawer_open, Resource.String.drawer_close); //Display the current fragments title and update the options menu this.drawerToggle.DrawerClosed += (o, args) => { //this.SupportActionBar.Title = this.title; this.InvalidateOptionsMenu(); }; //Display the drawer title and update the options menu this.drawerToggle.DrawerOpened += (o, args) => { //this.SupportActionBar.Title = this.drawerTitle; this.InvalidateOptionsMenu(); }; //Set the drawer lister to be the toggle. this.drawerLayout.SetDrawerListener(this.drawerToggle); string action = this.Intent.GetStringExtra("idFragment"); if (!string.IsNullOrEmpty(action)) { int idFragment; int.TryParse(action, out idFragment); ListItemClicked(idFragment); } else { ListItemClicked(0); } initFirebase(); }
public void consultar() { uitxtbasedatos.Text = Preferencias.obtenerBaseDatos(); uitxtservidor.Text = Preferencias.obtenerServidor(); uitxtusuario.Text = Preferencias.obtenerUsuarioBD(); uitxtpassword.Text = Preferencias.obtenerPasswordBD(); UINUME_EMPRE.EditValue = Preferencias.obtenerNumeEmpre(); }
private void Login_Load(object sender, EventArgs e) { default_char_password = uitxtpassword.Properties.PasswordChar; if (Preferencias.recuerdaUsuario()) { uitxtusuario.Text = Preferencias.obtenerUsuario(); uitxtpassword.Text = Preferencias.obtenerPassword(); uichkrecordarme.Checked = true; } }
/// <summary> /// Atualizar conforme preferencias. /// </summary> /// <returns></returns> public async static Task <SROXml> AtualizacaoAutomatica() { Preferencias preferecias = await GetSPreferencias(); if (preferecias == null) { preferecias = new Preferencias(); } return(await AtualizacaoAutomatica(preferecias.TempoAtualizacao)); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Obtengo preferencias p = UserDataDefaults.GetPreferences(); // Cargo botones SetOrden(); SetMostrar(); SetTipo(); }
private void procesar() { if (uichkrecordarme.Checked) { Preferencias.recordarUsuario(uitxtusuario.Text, uitxtpassword.Text); } else { Preferencias.olvidarUsuario(); } this.Close(); }
public HttpClient initClient() { client = new HttpClient(new NativeMessageHandler()) { // BaseAddress = new Uri(webBase) BaseAddress = new Uri(getDatosConexionEmpresa(Preferencias.getEmpresaLiege())) }; client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/pdf")); return(client); }
public FormMain() { InitializeComponent(); formPreferencias = new Preferencias(); pathConfig = Application.StartupPath + @"\Configuracoes"; DB = Connect.OpenConnection(pathConfig); DBName = pathConfig + @"\SmartNotas.db"; if (!Directory.Exists(pathConfig)) { formPreferencias.Show(); } config = ACBrConfig.CreateOrLoad(Path.Combine(pathConfig, "nfse.config")); ComboBoxConfiguracoes(); }
private void FormArticulo_Load(object sender, EventArgs e) { preferencias = Preferencias.Get(Entorno.USUARIO); CargarUnidadMedida(); CargarFamilia(); CargarTarifaIVA(); int numeroDecimal = preferencias.NumeroDecimal; if (numeroDecimal > 0) { FORMATO_NUMERO += CalcularNumeroDecimal(numeroDecimal); } if (accion == 2) { Articulo2Form(); } }
/// <summary> /// Asincrono. Deve analisar retorno! /// Retorna todo preferencias cadastrados pelo usuário. /// </summary> /// <returns>retorna um objeto Preferencias do Usuario.</returns> public static async Task <Preferencias> GetSPreferencias() { using (Preferencias objSPreferencias = new Preferencias()) { Preferencias preferenciaEncontrada = await objSPreferencias.GetPreferencias(); if (preferenciaEncontrada == null || !preferenciaEncontrada.Criado) { var sucesso = await Core.CriarPreferenciasPadrao(); if (sucesso) { return(await Core.GetSPreferencias()); } } return(preferenciaEncontrada); } }
public void selEmpresa() { if (_dataSistema.usuario.CD_LOGIN == "root") { } else { _dataSistema.nombreVentana = "Empresas"; frm_sel_empresa f = new frm_sel_empresa(_dataSistema); f.ShowDialog(); if (f.empresa != null) { _dataSistema.empresa = f.empresa; uibtnempresa.Caption = _dataSistema.empresa.DS_EMPRESA; Preferencias.guardarParamGeneEmpre(_dataSistema.empresa.ID); } } }
private void nuevoChat() { if (!string.IsNullOrWhiteSpace(entryNombre.Text)) { string nombreSala = ""; bool continene = false; foreach (var ro in chats) { continene = continene || ro.Name.Equals(entryNombre.Text); } if (!continene) { activityIndicator.IsVisible = true; lstView.IsVisible = false; nombreSala = entryNombre.Text; Task.Run(async() => { Room r = new Room { Name = nombreSala }; chats.Add(db.saveRoom(r).Result); if (Preferencias.getNotificacionesEmergentes()) { Notification notification = new Notification { Title = "CHAT", Message = "Sala " + nombreSala + " creada con exito", Vibrate = Preferencias.getVibracion() }; await CrossNotifications.Current.Send(notification); } nombreSala = ""; }); } else { DisplayAlert("ERROR", "Ya existe una sala con un nombre igual", "Ok"); } entryNombre.Text = ""; } entryNombre.IsVisible = !entryNombre.IsVisible; labelNombre.IsVisible = entryNombre.IsVisible; buttonCrearChat.Text = (entryNombre.IsVisible) ? GUARDAR : CREAR_CHAT; }
public async Task <List <MaquinaFirebase> > getListadoMaquinaFirebase(string empresa) { empre = empresa; try { if (empresa.Equals(" TRH Liege ")) { client = new HttpClient(new NativeMessageHandler()) { // BaseAddress = new Uri(webBase) BaseAddress = new Uri(getDatosConexionEmpresa(Preferencias.getEmpresaLiege())) }; } else { client = new HttpClient(new NativeMessageHandler()) { // BaseAddress = new Uri(webBase) BaseAddress = new Uri(getDatosConexionEmpresa(Preferencias.getEmpresaSevilla())) }; } client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/pdf")); //client = initClient(); var response = client.GetAsync(@"api/ListadoMonitorizacion"); if (response.Result.IsSuccessStatusCode) { var content = await response.Result.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <List <MaquinaFirebase> >(content); return(result); } } catch (Exception ex) { throw new Exception("Se ha producido una excipcion no controlada", ex.InnerException); } return(null); }
/// <summary> /// Criar preferencias padrao. /// </summary> /// <returns>Sucesso.</returns> public static async Task <bool> CriarPreferenciasPadrao() { using (Preferencias preferencias = new Preferencias()) { try { preferencias.AtualizacaoAutomatica = true; preferencias.TempoAtualizacao = 2; preferencias.Criado = true; preferencias.PosicaoPublicidade = Windows.UI.Xaml.HorizontalAlignment.Center; return(await GravarPreferencias(preferencias)); } catch (Exception ex) { Core.GravarLog("Core", "CriarPreferenciasPadrao", ex); return(false); } } }
public Preferencia ToPreferencia() { List <Caracteristica> caracteristicas = Preferencias? .Select(p => new Caracteristica(p.Data, p.Caracteristica)) // map .ToList(); if (caracteristicas == null) { caracteristicas = new List <Caracteristica>(); } Preferencia preferencia = new Preferencia() { Id = IdPreferencia, Petisco = this.Petisco.ToPetisco(), Caracteristicas = caracteristicas }; return(preferencia); }
public void selPeriodo() { if (_dataSistema.empresa == null) { MetodosForm.mensajeErrorDefault("No selecciono una empresa", _dataSistema); return; } if (_dataSistema.usuario.CD_LOGIN == "root") { } else { _dataSistema.nombreVentana = "Periodos"; frm_sel_periodo f = new frm_sel_periodo(_dataSistema); f.ShowDialog(); if (f.periodo != null) { _dataSistema.periodo = f.periodo; uibtnperiodo.Caption = MetodosForm.encontrarMes(int.Parse(_dataSistema.periodo.NM_PERIODO.ToString())).ToUpper().Substring(0, 3) + " " + _dataSistema.periodo.NM_EJERCICIO.ToString(); Preferencias.guardarParamGenePeriodo(int.Parse(_dataSistema.periodo.NM_PERIODO.ToString()), int.Parse(_dataSistema.periodo.NM_EJERCICIO.ToString())); } } }
/// <summary> /// Atualizar a lista de objetos gravados em disco. /// </summary> /// <param name="listCodigosRastreio"></param> /// <returns></returns> public async static Task <bool> AtualizarObjetosDisco() { //muda a posicao da publicidade. Preferencias preferencias = await GetSPreferencias(); switch (preferencias.PosicaoPublicidade) { case Windows.UI.Xaml.HorizontalAlignment.Center: preferencias.PosicaoPublicidade = Windows.UI.Xaml.HorizontalAlignment.Right; break; case Windows.UI.Xaml.HorizontalAlignment.Left: preferencias.PosicaoPublicidade = Windows.UI.Xaml.HorizontalAlignment.Center; break; case Windows.UI.Xaml.HorizontalAlignment.Right: preferencias.PosicaoPublicidade = Windows.UI.Xaml.HorizontalAlignment.Left; break; default: break; } var gravouPref = await GravarPreferencias(preferencias); if (gravouPref) { } //Corrigir método, pois tem que ser atualizado do disco a partir do correio, mas nao pode perder os que ainda nao foram mostrados nos correios. var sucesso = false; SROXml sroXmlLocal = null; SROXml sroXml = null; try { sroXmlLocal = await Core.GetSROXml(); List <string> listCodigoRastreio = new List <string>(); if (sroXmlLocal != null && sroXmlLocal.Objetos != null) { foreach (Objeto item in sroXmlLocal.Objetos) { listCodigoRastreio.Add(item.Numero); } } if (listCodigoRastreio.Count > 0) { Correio correios = new Correio(); sroXml = correios.BuscaObjetosOnline(listCodigoRastreio, Enumeration.Resultado.T); List <string> listContain = null; List <string> listNaoContain = null; if (sroXml != null && sroXml.Objetos != null && (listCodigoRastreio.Count != sroXml.Objetos.Count)) { listContain = new List <string>(); listNaoContain = new List <string>(); foreach (var item in sroXml.Objetos) { listContain.Add(item.Numero); } for (int i = 0; i < listCodigoRastreio.Count; i++) { if (!listContain.Contains(listCodigoRastreio[i])) { listNaoContain.Add(listCodigoRastreio[i]); } } } if (sroXml != null && sroXml.Objetos != null) { //Alterar o forech para linqs. foreach (Objeto itemOnLine in sroXml.Objetos) { foreach (Objeto itemDisco in sroXmlLocal.Objetos) { if (itemOnLine.Numero == itemDisco.Numero) { if (itemOnLine.Eventos != null && itemOnLine.Eventos.Count > 0) { foreach (Evento eventoCoord in itemOnLine.Eventos) { if (eventoCoord.GeoX == 0 || eventoCoord.GeoY == 0) { eventoCoord.BuscaGeoLocalizacaoEvento(); } } } itemOnLine.Descricao = itemDisco.Descricao; itemOnLine.IdEndereco = itemDisco.IdEndereco; break; } } } if (listNaoContain != null) { for (int i = 0; i < listNaoContain.Count; i++) { foreach (Objeto item in sroXmlLocal.Objetos) { if (listNaoContain[i] == item.Numero) { Evento ev = new Evento(); ev.Descricao = "O nosso sistema não possui dados sobre o objeto informado. Se o objeto foi postado recentemente, é natural que seus rastros não tenham ingressado no sistema, nesse caso, por favor, tente novamente mais tarde. Adicionalmente, verifique se o código digitado está correto"; item.Eventos = new List <Evento>(); item.Eventos.Add(ev); sroXml.Objetos.Add(item); break; } } } } sroXml.UltimaAtualizacao = DateTime.Now; sucesso = await sroXml.GravarCorreioOnLine(); if (sucesso) { } } } } catch (Exception ex) { Core.GravarLog("Core", "AtualizarObjetosDisco", ex); } finally { if (sroXmlLocal != null) { sroXmlLocal.Dispose(); sroXmlLocal = null; } if (sroXml != null) { sroXml.Dispose(); sroXml = null; } } return(sucesso); }
/// <summary> /// Obtiene las tareas de la base de datos. /// </summary> /// <returns>Tareas.</returns> public Tarea[] GetTareas() { // Tareas List <Tarea> tareas = new List <Tarea>(); // Obtengo preferencias Preferencias p = UserDataDefaults.GetPreferences(); // Consulta string c = "SELECT * FROM tarea"; bool flagWhere = false; // Mostrar switch (p.Mostrar) { case 1: // Realizadas c += " WHERE EXISTS(SELECT NULL FROM tarea_realizada WHERE ID_TAREA = tarea.ID)"; flagWhere = true; break; case 2: // Sin realizar c += " WHERE NOT EXISTS(SELECT NULL FROM tarea_realizada WHERE ID_TAREA = tarea.ID)"; flagWhere = true; break; } // Tipo switch (p.Tipo) { case 1: // Urgente if (flagWhere) { c += " AND EXISTS(SELECT TRUE FROM tarea WHERE URGENTE = 1 OR OP2 = 1)"; } else { c += " WHERE EXISTS(SELECT TRUE FROM tarea WHERE URGENTE = 1 OR OP2 = 1)"; } break; case 2: // Normal if (flagWhere) { c += " AND EXISTS(SELECT TRUE FROM tarea WHERE URGENTE = 0 AND OP2 = 0)"; } else { c += " WHERE EXISTS(SELECT TRUE FROM tarea WHERE URGENTE = 0 AND OP2 = 0)"; } break; } // Orden c += " ORDER BY CREACION " + (p.Orden == 0 ? "ASC;" : "DESC;"); // Conexion try { // Bloqueo lock (l) { // Abro conexion connection.Open(); // Crea consulta using (SqliteCommand cmd = connection.CreateCommand()) { cmd.CommandText = c; cmd.CommandType = CommandType.Text; // Realiza consulta using (SqliteDataReader reader = cmd.ExecuteReader()) { // Lee datos while (reader.Read()) { tareas.Add(new Tarea { ID_Tarea = (int)reader[0], Cliente = new Cliente { ID_Cliente = (int)reader[1] }, Tipo = (int)reader[2] == 1, Direccion = new Direccion { ID_Direccion = (int)reader[3] }, Urgente = (int)reader[4] == 1, OP2 = (int)reader[5] == 1, Notas = (string)reader[6], Fecha_creacion = DatetimeToTimestamp((DateTime)reader[7]) }); } } } } } catch (Exception) { return(null); } // Cierro conexion connection.Close(); // Devuelvo tareas return(tareas.Count == 0 ? null : tareas.ToArray()); }
public void guardar() { Preferencias.guardarConexion(uitxtservidor.Text, uitxtbasedatos.Text, uitxtusuario.Text, uitxtpassword.Text); Preferencias.guardarNMEMPRE(int.Parse(UINUME_EMPRE.EditValue.ToString())); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs args) { //progress bar atualizar inicial. try { if (args.PreviousExecutionState != ApplicationExecutionState.Running) { bool loadState = (args.PreviousExecutionState == ApplicationExecutionState.Terminated); ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, loadState); Window.Current.Content = extendedSplash; } Window.Current.Activate(); //Verificar onde atualizar pela primeira vez. Preferencias preferencias = await Core.GetSPreferencias(); //Verfica se existe preferencia registra, caso nao cria uma padrão. var sucesso = await Core.AtualizacaoAutomatica(preferencias.TempoAtualizacao); //Core.AtualizarObjetosDisco(); if (sucesso != null && sucesso.Objetos != null) { } var sucessoHistorico = await Core.GravarObjetoHistorico(); if (sucessoHistorico) { } } catch (Exception ex) { //Entities.LOG.MetroEventSource.Log.Error(ex.Message + "#" + ex.InnerException + "APP.cs" + "#" + "OnLaunched"); } // Register handler for CommandsRequested events from the settings pane SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested; Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); //Associate the frame with a SuspensionManager key SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { // Restore the saved session state only when appropriate try { await SuspensionManager.RestoreAsync(); } catch (SuspensionManagerException) { //Something went wrong restoring state. //Assume there is no state and continue } } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // First time execution, initialize the logger try { EventListener verboseListener = new StorageFileEventListener("LOG_MyListenerVerbose"); EventListener informationListener = new StorageFileEventListener("LOG_MyListenerInformation"); verboseListener.EnableEvents(MetroEventSource.Log, EventLevel.Verbose); informationListener.EnableEvents(MetroEventSource.Log, EventLevel.Informational); } catch (Exception ex) { } // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (!rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups")) { throw new Exception("Failed to create initial page"); } } // Ensure the current window is active Window.Current.Activate(); }
private void LoadXML() { empresa = Empresa.Get(); preferencias = Preferencias.Get(Entorno.USUARIO); string value = ""; if (preferencias != null) { checkControlaInventario.Checked = preferencias.ControlaInventario; checkUltimaConfiguracion.Checked = preferencias.UltimaConfiguracion; txtLetraCambio.Text = preferencias.MensajeTituloValor; txtAdvertencia.Text = preferencias.MensajeCentralRiesgo; txtFirmaRemision.Text = preferencias.FirmaRemision; txtFirmaFactura.Text = preferencias.FirmaFactura; txtFirmaComprobante.Text = preferencias.FirmaComprobante; txtFirmaNotas.Text = preferencias.FirmaNotas; txtFirmaOrdenCompra.Text = preferencias.FirmaOrdenCompra; txtFirmaOrdenPedido.Text = preferencias.FirmaOrdenPedido; txtFirmaCotizacion.Text = preferencias.FirmaCotizacion; txtColor.Text = preferencias.ColorConsecutivo; txtPlantillaObservacion1.Text = preferencias.ObservacionDocumento; txtPlantillaObservacion2.Text = preferencias.OtraObservacionDocumento; checkActivarPuntoVenta.Checked = preferencias.ActivarPuntoVenta; checkEnvioFormaAnonima.Checked = preferencias.EnvioInformacionAnonima; if (preferencias.ActivarPuntoVenta) { if (preferencias.TerceroPuntoVentaID != null) { tercero = Tercero.Get(preferencias.TerceroPuntoVentaID.GetValueOrDefault()); txtTercero.Text = tercero.NombreComercial; } if (preferencias.TipoDocumentoPuntoVentaID != null) { cbTipoDocumentoFactura.SelectedValue = preferencias.TipoDocumentoPuntoVentaID; } } checkActivarCajonMonedero.Checked = preferencias.ActivarCajonMonedero; checkImprimirTirilla.Checked = preferencias.ImprimirTirilla; txtCajonMonedero.Text = preferencias.CodigoCajonMonedero; cbPuertoSalida.Text = preferencias.PuertoSalida; rbRedondeoInferior.Checked = preferencias.RedondeoInferior; rbRedondeoSistema.Checked = preferencias.RedondeoSistema; rbRedondeoSuperior.Checked = preferencias.RedondeoSuperior; TipoMoneda tipoMoneda = TipoMoneda.Get(preferencias.TipoMonedaID.GetValueOrDefault()); if (tipoMoneda != null) { cbTipoMoneda.SelectedValue = tipoMoneda.ID; } else { cbTipoMoneda.SelectedIndex = cbTipoMoneda.FindString(TIPO_MONEDA); } nudNumeroDecimal.Value = preferencias.NumeroDecimal; string separadorMiles = preferencias.SeparadorMiles; if (separadorMiles == "es-CO") { rbComa.Checked = true; } else { rbPunto.Checked = true; } checkImpresionEncabezado.Checked = preferencias.ImpresionEncabezado; checkImpresionLogotipo.Checked = preferencias.ImpresionLogotipo; cbLectorCodigo.Text = preferencias.BusquedaLector; if (preferencias.BusquedaLector == string.Empty) { cbLectorCodigo.SelectedIndex = 0; } if (preferencias.PuertoSalida == string.Empty) { cbPuertoSalida.SelectedIndex = 0; } value = preferencias.ImpresoraPredeterminada; } if (empresa != null) { txtIdentidad.Text = empresa.Nit; txtRazonSocial.Text = empresa.RazonSocial; txtDireccion.Text = empresa.Direccion; txtTelefono.Text = empresa.TelefonoPrincipal; txtEmail.Text = empresa.Email; txtFax.Text = empresa.Fax; txtFrase.Text = empresa.Frase; txtLogo.Text = empresa.RutaLogo; if (empresa.CiudadID != null) { Ciudad ciudad = Ciudad.Get(empresa.CiudadID.GetValueOrDefault()); Estado estado = Estado.Get(ciudad.EstadoID.GetValueOrDefault()); Pais pais = Pais.Get(estado.PaisID); cbPais.SelectedValue = pais.ID; cbDepartamento.SelectedValue = estado.ID; cbMunicipio.SelectedValue = ciudad.ID; } else { cbPais.SelectedIndex = 0; } txtCodigoCIIU.Text = empresa.CodigoCIIU; txtOtroTelefono.Text = empresa.OtroTelefono; txtTelefonoMovil.Text = empresa.Movil; txtPaginaWeb.Text = empresa.PaginaWeb; txtFondoPapel.Text = empresa.RutaFondoPapel; } int selectedIndex = 0; int num = 0; foreach (string text in PrinterSettings.InstalledPrinters) { cbImpresoras.Items.Add(text); if (text.Equals(value)) { selectedIndex = num; } num++; } if (num > 0) { cbImpresoras.SelectedIndex = selectedIndex; } /*string item = LicenciaXML.GetItem("ClaveAcceso"); * if (item != string.Empty && Convert.ToBoolean(item)) { * Sistema sistema = new SistemaFactory().GetSistema(); * checkClaveAcceso.Checked = sistema.ClaveAcceso; * }*/ }
void BtnGuardarClick(object sender, EventArgs e) { //empresa = new EmpresaFactory().GetEmpresa(); empresa.Nit = txtIdentidad.Text; empresa.RazonSocial = txtRazonSocial.Text; empresa.Direccion = txtDireccion.Text; empresa.TelefonoPrincipal = txtTelefono.Text; empresa.CiudadID = (cbMunicipio.SelectedItem as Ciudad).ID; //empresa.EstadoID = (cbMunicipio.SelectedItem as Ciudad).EstadoID.GetValueOrDefault(); //empresa.PaisID = Pais.Get((cbMunicipio.SelectedItem as Ciudad).EstadoID.GetValueOrDefault()).ID; empresa.Email = txtEmail.Text; empresa.Fax = txtFax.Text; empresa.Frase = txtFrase.Text; empresa.RutaLogo = txtLogo.Text; empresa.CodigoCIIU = txtCodigoCIIU.Text; empresa.OtroTelefono = txtOtroTelefono.Text; empresa.Movil = txtTelefonoMovil.Text; empresa.PaginaWeb = txtPaginaWeb.Text; empresa.RutaFondoPapel = txtFondoPapel.Text; if (empresa.ID == 0) { empresa.Save(); } else { empresa.Update(); } //preferencias = new PreferenciasFactory().GetPreferencias(Entorno.USUARIO); if (preferencias == null) { preferencias = new Preferencias(); preferencias.UsuarioID = Entorno.USUARIO.ID; preferencias.FechaCreacion = DateTime.Now; } preferencias.ControlaInventario = checkControlaInventario.Checked; preferencias.ImpresoraPredeterminada = cbImpresoras.Text; preferencias.FirmaRemision = txtFirmaRemision.Text; preferencias.FirmaFactura = txtFirmaFactura.Text; preferencias.FirmaComprobante = txtFirmaComprobante.Text; preferencias.FirmaNotas = txtFirmaNotas.Text; preferencias.FirmaOrdenCompra = txtFirmaOrdenCompra.Text; preferencias.FirmaOrdenPedido = txtFirmaOrdenPedido.Text; preferencias.FirmaCotizacion = txtFirmaCotizacion.Text; preferencias.MensajeTituloValor = txtLetraCambio.Text; preferencias.MensajeCentralRiesgo = txtAdvertencia.Text; preferencias.ObservacionDocumento = txtPlantillaObservacion1.Text; preferencias.OtraObservacionDocumento = txtPlantillaObservacion2.Text; preferencias.TipoMonedaID = (cbTipoMoneda.SelectedItem as TipoMoneda).ID; preferencias.UltimaConfiguracion = checkUltimaConfiguracion.Checked; preferencias.NumeroDecimal = Convert.ToInt32(nudNumeroDecimal.Value); preferencias.ImpresionEncabezado = checkImpresionEncabezado.Checked; preferencias.ImpresionLogotipo = checkImpresionLogotipo.Checked; preferencias.ColorConsecutivo = txtColor.Text; preferencias.BusquedaLector = cbLectorCodigo.Text; preferencias.TipoDocumentoPuntoVentaID = (cbTipoDocumentoFactura.SelectedItem as TipoDocumento).ID; preferencias.ActivarPuntoVenta = checkActivarPuntoVenta.Checked; preferencias.TerceroPuntoVentaID = tercero == null ? 0 : tercero.ID; preferencias.RedondeoInferior = rbRedondeoInferior.Checked; preferencias.RedondeoSistema = rbRedondeoSistema.Checked; preferencias.RedondeoSuperior = rbRedondeoSuperior.Checked; if (checkActivarPuntoVenta.Checked && preferencias.TerceroPuntoVentaID == 0) { MessageBox.Show("Tercero en el punto de venta es requerido!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); checkActivarPuntoVenta.Checked = (preferencias.ActivarPuntoVenta = false); } if (checkActivarPuntoVenta.Checked && preferencias.BusquedaLector == string.Empty) { MessageBox.Show("Busqueda del lector venta es requerido!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); checkActivarPuntoVenta.Checked = (preferencias.ActivarPuntoVenta = false); } preferencias.ActivarCajonMonedero = checkActivarCajonMonedero.Checked; preferencias.ImprimirTirilla = checkImprimirTirilla.Checked; preferencias.CodigoCajonMonedero = txtCajonMonedero.Text; preferencias.PuertoSalida = cbPuertoSalida.Text; preferencias.EnvioInformacionAnonima = checkEnvioFormaAnonima.Checked; if (rbComa.Checked) { preferencias.SeparadorMiles = "es-CO"; Thread.CurrentThread.CurrentCulture = new CultureInfo("es-CO"); } else { preferencias.SeparadorMiles = "en-US"; Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); } if (preferencias.ID == 0) { preferencias.Save(); } else { preferencias.Update(); } /*string item = LicenciaXML.GetItem("ClaveAcceso"); * if (item != string.Empty && Convert.ToBoolean(item)) { * Sistema sistema = new SistemaFactory().GetSistema(); * sistema.ClaveAcceso = checkClaveAcceso.Checked; * persistentFactory.Update(sistema); * }*/ //Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; MessageBox.Show("Grabado con exito!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); DialogResult = DialogResult.OK; Close(); }
protected void AplicarIdioma(Form1 principal, Form2 alumno, Form10 profesor, Form4 busqueda, Form6 acerca, Form12 informacion, Preferencias preferencias, Forms.Form_Idioma idioma) { }
/// <summary> /// Gravar Preferencias do usuario. /// </summary> /// <param name="preferencias"></param> /// <returns>Gravado com sucesso.</returns> public static async Task <bool> GravarPreferencias(Preferencias preferencias) { return(await preferencias.GravarPreferencias()); }