private void IsHourCostPresent() { try { //Obtain a virtual store for application IsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication(); //This code will open and read the contents of myFile.txt var readFile = new StreamReader(new IsolatedStorageFileStream("settings\\hourprice.txt", FileMode.Open, myStore)); string fileText = readFile.ReadLine(); //The control textRead will display the text entered in the file IsolatedStorageSettings.ApplicationSettings["isFirstRun"] = fileText; readFile.Close(); Constantes c = new Constantes(); Constantes.MyStruct.HourPrice = int.Parse(fileText); string var = Constantes.MyStruct.HourPrice.ToString(); } catch { MessageBox.Show("Tarif horaire non spécifié found - creating new one"); PayePrice.IsEnabled = false; calcPrice.IsEnabled = false; purposeBabySitting.IsEnabled = false; } }
public Esperar(Constantes constantes, IVectorTools vectorTools, int prioridad, float segundosAEsperar) : base(constantes, vectorTools, prioridad) { SolicitarEspera(segundosAEsperar); LogData = new LogItem(LogType.Decision, "Esperant", $"Esperant {segundosAEsperar} segons"); }
public PasoEsperar(Constantes constantes, float segundosAEsperar, LogItem logItem) : base() { this.constantes = constantes; TiempoRestante = TiempoAEsperar = segundosAEsperar; LogData = logItem; }
public PosicionarSateliteEnActitudOrbital(Constantes constantes, IVectorTools vectorTools, int prioridad) : base(constantes, vectorTools, prioridad) { DefinirPaso(new PasoEnfoqueOrbital()); DefinirPaso(new PasoComprobarEnfoque(ActitudRotacion.Orbital)); LogData = new LogItem(0, "Orientació orbital", "Orientar el satel·lit amb l'orbita"); }
public CalcularInclinacion(Constantes constantes, IVectorTools vectorTools, int prioridad, ConversorOrbital conversor) : base(constantes, vectorTools, prioridad) { this.conversor = conversor; DefinirPaso(new PasoEnfoqueATierra()); DefinirPaso(new PasoComprobarEnfoque(ActitudRotacion.EnfocadoATierra)); DefinirPaso(new PasoGenerico(new LogItem(LogType.Paso, "Calc. inclinació", "Calcular l'inclinació"), Calcular)); LogData = new LogItem(LogType.Decision, "Calc. Inclinació", "Calculant Inclinació"); }
public CalcularSentidoDeLaOrbita(Constantes constantes, IVectorTools vectorTools, int prioridad) : base(constantes, vectorTools, prioridad) { DefinirPaso(new PasoEnfoqueATierra()); DefinirPaso(new PasoComprobarEnfoque(ActitudRotacion.EnfocadoATierra)); DefinirPaso(new PasoTomarAltura()); DefinirPaso(new PasoEsperar(constantes, 5, new LogItem(LogType.Paso, "Esperar", "Esperant per evaluar el sentit"))); DefinirPaso(new PasoGenerico(new LogItem(LogType.Paso, "Sentit orbita", "Comprobant el sentit de l'orbita"), ComprobarSiLaOrbitaSubeOBaja)); LogData = new LogItem(LogType.Decision, "Calc. sentit", "Calculant el sentit de l'orbita"); }
public OrbitalElements(Constantes constantes, float momentoAngular, float excentricity, float inclination, float angleOfAscendingNode, float argumentOfPeriapsis, float trueAnomaly) { this.constantes = constantes; MomentoAngular = momentoAngular; Excentricity = excentricity; Inclination = inclination; ArgumentOfPeriapsis = argumentOfPeriapsis; AngleOfAscendingNode = angleOfAscendingNode; TrueAnomaly = trueAnomaly; CalcularValoresDerivados(); }
public CalcularPeriapsis(Constantes constantes, IVectorTools vectorTools, int prioridad) : base(constantes, vectorTools, prioridad) { DefinirPaso(new PasoEnfoqueATierra()); DefinirPaso(new PasoComprobarEnfoque(ActitudRotacion.EnfocadoATierra)); DefinirPaso(new PasoTomarAltura()); DefinirPaso(new PasoEsperarPeriapsis()); DefinirPaso(new PasoGenerico(new LogItem(LogType.Paso, "Registrant Periapsis"), (data) => { data.Periapsis = data.AlturaDeReferencia; data.OrbitaSubiendo = null; return true; } )); LogData = new LogItem(LogType.Decision, "Calc. Periapsis", "Calculant Periapsis"); }
public Circularizar(Constantes constantes, IVectorTools vectorTools, int prioridad) : base(constantes, vectorTools, prioridad) { DefinirPaso(new PasoGenerico(new LogItem(LogType.Paso, "Calcular impuls", "Calcular el valor del impuls."), CalcularValoresDelImpulso)); DefinirPaso(new PasoEnfoqueATierra()); DefinirPaso(new PasoComprobarEnfoque(ActitudRotacion.EnfocadoATierra)); DefinirPaso(new PasoTomarAltura()); DefinirPaso(new PasoEsperarPeriapsis()); DefinirPaso(new PasoEsperarApoapsis()); DefinirPaso(new PasoGenerico(new LogItem(LogType.Paso, "Cambiar velocitat"), CambiarVelocidad)); //DefinirPaso(new Paso( "", EsperarPeriapsis)); //DefinirPaso(new Paso( "", SolicitarEnfoqueOrbital)); //DefinirPaso(new Paso( "", ComprobarEnfoqueCorrecto)); //DefinirPaso(new Paso( "", EsperarMomentoDeIgnicion)); //DefinirPaso(new Paso( "", EncenderMotor)); //DefinirPaso(new Paso( "", EsperarDuracionDelImpulso)); //DefinirPaso(new Paso( "", ApagarMotor)); DefinirPaso(new PasoGenerico(new LogItem(LogType.Paso, "Resetejar", "Resetejar valors orbitals"), ResetearValoresOrbitales)); LogData = new LogItem(LogType.Decision, "Orbita circular", "Fer l'orbita circular"); }
void verFin(int windowID) { if (puntuacion == 0) { GUI.Box(rectFin [2], Diccionario.getPalabra("Sin llave"), btnOpciones.label); } else { GUI.Box(rectFin [1], Diccionario.getPalabra("Con llave"), btnOpciones.label); if (premio != null) { GUIContent contenido = new GUIContent(); contenido.text = Diccionario.getPalabra("Con Premio"); contenido.image = premio; GUI.Box(rectFin [3], contenido, fin.box); } } if (GUI.Button(rectFin [4], Diccionario.getPalabra("Continuar"), btnOpciones.button)) { Constantes.setSincronizar(true); Instantiate(Resources.Load <GameObject> ("Prefab/Mapa")); Destroy(this); } }
private bool Insert(ref Constantes item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added) { DataAccessEnterpriseSQL.DAAsignarProcedure("T_SP_INSERTAR_Constantes"); DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCONS_CodTabla", item.CONS_CodTabla, SqlDbType.Char, 3, ParameterDirection.InputOutput); DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCONS_CodTipo", item.CONS_CodTipo, SqlDbType.Char, 3, ParameterDirection.InputOutput); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCONS_Desc_SPA", item.CONS_Desc_SPA, SqlDbType.VarChar, 50, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCONS_Desc_ENG", item.CONS_Desc_ENG, SqlDbType.Char, 18, ParameterDirection.Input); if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0) { //String _CONS_CodTabla; //if (String.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pchrCONS_CodTabla"].Value.ToString(), out _CONS_CodTabla)) //{ item.CONS_CodTabla = _CONS_CodTabla; } //String _CONS_CodTipo; //if (String.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pchrCONS_CodTipo"].Value.ToString(), out _CONS_CodTipo)) //{ item.CONS_CodTipo = _CONS_CodTipo; } return(true); } else { return(false); } } else { return(true); } } catch (Exception ex) { throw ex; } }
private Resultado resolverSuma(Resultado resIzq, Resultado resDer) { String validarTipo = Constantes.ValidarTipos(resIzq.Tipo, resDer.Tipo, Constantes.MT_SUMA); if (validarTipo == Constantes.T_NUM) { return(resolverNumerica(resIzq, resDer)); } if (validarTipo == Constantes.T_STR) { String dIzq, dDer; if (resIzq.Tipo == Constantes.T_BOOL) { dIzq = Convert.ToInt32(Convert.ToBoolean(resIzq.Valor)).ToString(); } else { dIzq = resIzq.Valor; } if (resDer.Tipo == Constantes.T_BOOL) { dDer = Convert.ToInt32(Convert.ToBoolean(resDer.Valor)).ToString(); } else { dDer = resDer.Valor; } return(FabricarResultado.creaCadena(String.Concat(dIzq, dDer))); } if (validarTipo == Constantes.T_BOOL) { return(FabricarResultado.creaBooleano(resIzq.Boleano || resDer.Boleano)); } return(new Resultado()); }
// Use this for initialization void Start() { cargando1 = Diccionario.getPalabra("Despertando"); if (cargando1 == null || cargando1.Trim().Length == 0) { cargando1 = "Despertando"; } cargando2 = ""; sync = Sync.getSync(); int id_usuario = GestorSQLite.getGestorSQLite().obtenerUsuarioAcual(); windowRect = new Rect(Screen.width / 4, Screen.height / 7, Screen.width / 2, 5 * Screen.height / 7); windowSkin = Resources.Load <GUISkin> ("GUISkin/Opciones/fondoOpcionesSkin"); sincronizando = Resources.Load <GUISkin> ("GUISkin/Mapa/sincronizarSkin"); campos = Resources.Load <GUISkin> ("GUISkin/Login/camposSkin"); botonSkin = Resources.Load <GUISkin> ("GUISkin/Mapa/botonesSuperiorSkin"); fondo = Resources.Load <Texture2D> ("Images/fondo_login"); if (id_usuario > 0 && !Constantes.getErrorDatos()) { cuenta = true; try { sync.setId_Usuario(id_usuario); Thread t = new Thread(new ThreadStart(sync.sincronizacion)); t.Start(); } catch (Exception e) { Debug.Log(e); SceneManager.LoadScene("MapaScene"); } logueando = true; } else if (Constantes.getErrorDatos()) { error = Diccionario.getPalabra("Datos Incorrectos"); } InvokeRepeating("cambioCargando", 1f, 1f); }
async void BtnRegistrar_Clicked(object sender, EventArgs e) { Loading(true); var alojamiento = (Comercio)BindingContext; if (string.IsNullOrEmpty(txtNombre.Text)) { UserDialogs.Instance.Alert(Constantes.TitleAlojamientoRequired, "Advertencia", "OK"); Loading(false); return; } if (alojamiento.Id > 0) { if (alojamiento.Stream == null) { await FirebaseHelper.ActualizarAlojamiento(alojamiento.Id, alojamiento.Nombre, alojamiento.Descripcion, alojamiento.ImagenPrincipal, alojamiento.Direccion, alojamiento.Contacto, alojamiento.Horario, alojamiento.Ubicacion, alojamiento.VideoUrl, alojamiento.IdPueblo); } else { await FirebaseHelper.ActualizarAlojamiento(alojamiento.Id, alojamiento.Nombre, alojamiento.Descripcion, alojamiento.ImagenPrincipal = await FirebaseHelper.SubirFoto(alojamiento.Stream, "Imagen principal de " + alojamiento.Nombre), alojamiento.Direccion, alojamiento.Contacto, alojamiento.Horario, alojamiento.Ubicacion, alojamiento.VideoUrl, alojamiento.IdPueblo); } } else { if (alojamiento.Stream == null) { await FirebaseHelper.InsertarAlojamiento(alojamiento.Id = Constantes.GenerarId(), alojamiento.Nombre, alojamiento.Descripcion, alojamiento.ImagenPrincipal, alojamiento.Direccion, alojamiento.Contacto, alojamiento.Horario, alojamiento.Ubicacion, alojamiento.VideoUrl, alojamiento.IdPueblo); } else { await FirebaseHelper.InsertarAlojamiento(alojamiento.Id = Constantes.GenerarId(), alojamiento.Nombre, alojamiento.Descripcion, alojamiento.ImagenPrincipal = await FirebaseHelper.SubirFoto(alojamiento.Stream, "Imagen principal de " + alojamiento.Nombre), alojamiento.Direccion, alojamiento.Contacto, alojamiento.Horario, alojamiento.Ubicacion, alojamiento.VideoUrl, alojamiento.IdPueblo); } } Loading(false); UserDialogs.Instance.Alert("Registro realizado correctamente", "Correcto", "OK"); }
private void button9_Click(object sender, EventArgs e) { Constantes constantes = new Constantes(); }
public AnuncioController(Constantes constantes, teste_webmotorsContext context, APIService apiservice) { this.CONSTANTES = constantes; this.db = context; this.APIService = apiservice; }
public async Task StartAsync() { var accion = "Desactivar"; context.PrivateConversationData.SetValue <string>("Accion", accion); var reply = context.MakeMessage(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; string confirmacionRespuesta1 = "Tengo esta respuesta para usted:"; string confirmacionRespuesta2 = "Tengo estas respuestas para usted:"; string preguntaNoRegistrada1 = "Lo siento, su pregunta no esta registrada, tal vez no escribió la pregunta correctamente"; string preguntaNoRegistrada2 = "Lo siento, su pregunta no esta registrada"; string opcionSecundarioDeRespuesta1 = "Pero esta respuesta le podría interesar:"; string opcionSecundarioDeRespuesta2 = "Pero estas respuestas le podrían interesar:"; string preguntaConsulta = "¿Tiene alguna otra consulta?"; Constantes c = Constantes.Instance; // Recorrido de la primera parte de la pregunta foreach (var entityP1 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra1")) { var palabra1 = entityP1.Entity.ToLower().Replace(" ", ""); if (palabra1 == "ventana" || palabra1 == "ventanaemergente" || palabra1 == "ventanadealerta") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "mensaje" || palabra2 == "mensajenuevo" || palabra2 == "nuevomensaje") { reply.Attachments = RespuestasOutlook.GetDesactivarActivarAlertasEscritorio(); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { await context.PostAsync($"¿{palabra2}?, por favor vuelva a escribir la consulta correctamente"); return; } } await context.PostAsync($"Quizás desea saber como desactivar sus ventanas de alerta en Outlook, " + c.proponer()); reply.Attachments = RespuestasOutlook.GetDesactivarActivarAlertasEscritorio(); await context.PostAsync(reply); await context.PostAsync($"Caso contrario, la pregunta no se encuentra registrada o vuelva a escribir correctamente la pregunta."); return; } else if (palabra1 == "alertas" || palabra1 == "alerta") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "escritorio") { reply.Attachments = RespuestasOutlook.GetDesactivarActivarAlertasEscritorio(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { reply.Attachments = RespuestasOutlook.GetDesactivarActivarAlertasEscritorio(); await context.PostAsync($"Lo siento, su pregunta no esta registrada, tal vez no escribió correctamente la palabra '{palabra2}'?"); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } } await context.PostAsync($"Quizás desea saber como desactivar sus ventanas de alerta en Outlook, " + c.proponer()); reply.Attachments = RespuestasOutlook.GetDesactivarActivarAlertasEscritorio(); await context.PostAsync(reply); await context.PostAsync($"Caso contrario, la pregunta no se encuentra registrada o vuelva a escribir correctamente la pregunta."); return; } else if (palabra1 == "otroscorreos" || palabra1 == "otrocorreo") { reply.Attachments = RespuestasOutlook.GetDesactivarActivarOtrosCorreosOutlook(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "hipervínculo" || palabra1 == "hipervinculo" || palabra1 == "hipervínculos" || palabra1 == "hipervinculos") { reply.Attachments = RespuestasWord.GetDesactivarHipervinculos(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "formato") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "automático" || palabra2 == "automatico") { reply.Attachments = RespuestasWord.GetDesactivarFormatoAutomatico(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { reply.Attachments = RespuestasWord.GetDesactivarFormatoAutomatico(); await context.PostAsync($"Lo siento, su pregunta no esta registrada, tal vez no escribió correctamente la palabra '{palabra2}'?"); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } } // No se detectó la segunda parte de la pregunta reply.Attachments = reply.Attachments = RespuestasWord.GetDesactivarFormatoAutomatico(); await context.PostAsync(preguntaNoRegistrada1); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { await context.PostAsync($"Lo siento, su pregunta no esta registrada"); await context.PostAsync($"O tal vez no la escribió correctamente, ¿{palabra1}?"); return; } } foreach (var servicio in result.Entities.Where(Entity => Entity.Type == "Servicio")) { var serv = servicio.Entity.ToLower().Replace(" ", ""); if (serv == "onedrive") { reply.Attachments = RespuestasOneDrive.GetDesactivarDesinstalarOneDrive(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { reply.Attachments = RespuestasOneDrive.GetDesactivarDesinstalarOneDrive(); await context.PostAsync($"Lo siento, su pregunta no esta registrada, tal vez no escribió correctamente la palabra '{serv}'?"); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); return; } } // No se detectó la primera parte de la pregunta await context.PostAsync(preguntaNoRegistrada2); reply.Attachments = Cards.GetConsultaV2(); await context.PostAsync(reply); await context.PostAsync("O tal vez no escribió la pregunta correctamente"); return; }
private void KilosPesadosTextBox_KeyPress(object sender, KeyPressEventArgs e) { Constantes.ValidarNumerosDecimales(sender, e, KilosPesadosTextBox.Text); }
public IActionResult LocalizarNutricionista(int pIndiceInicial, string pRua, string pCidade, string pBairro, string pCEP, string pUF, DateTime pDataInicio, DateTime pDataFim, string pNomeNutricionista, string mensagem) { ViewData[Constantes.ViewDataMensagemRetorno] = mensagem; ViewData[Constantes.ViewDataActionFiltro] = "FiltroLocalizarNutricionista"; ViewData[Constantes.ViewDataControllerFiltro] = "Contrato"; List <Agenda> agendas = _ServiceAgenda.AgendasCadastradas(pDataInicio, pDataFim, 0, true); List <int> nutricionistas = new List <int>(); if (agendas.Any(d => d.DataInicio > Constantes.DateTimeNow())) { agendas = agendas.Where(d => d.DataInicio > Constantes.DateTimeNow() && _ServiceContrato.AgendaDisponivelParaContratar(d.IdAgenda)).ToList(); nutricionistas = agendas .Where(d => d.DataInicio > Constantes.DateTimeNow()) .Select(c => c.IdUsuario) .Distinct() .ToList(); } else { agendas = new List <Agenda>(); } List <Endereco> enderecos = new List <Endereco>(); foreach (int nutricionista in nutricionistas) { if (string.IsNullOrEmpty(pNomeNutricionista) || _ServiceNutricionista.ConsultarNutricionistaPorID(nutricionista).Nome.Equals(pNomeNutricionista)) { enderecos.AddRange(_ServiceEndereco.EnderecosCadastrados( nutricionista, pRua, pCidade, pBairro, pCEP, pUF)); } } List <EnderecoAlteracaoVM> enderecosVm = new List <EnderecoAlteracaoVM>(); if (enderecos.Any()) { enderecosVm = enderecos.Distinct().Select(c => new EnderecoAlteracaoVM() { ID = c.IdEndereco, Bairro = c.Bairro, CEP = c.CEP, Cidade = c.Cidade, Complemento = c.Complemento, Logradouro = c.Logradouro, Numero = c.Numero, UF = c.UF.GetDefaultValue() }).ToList(); } List <AgendaListaContratoVM> listaAgendas = new List <AgendaListaContratoVM>(); if (agendas.Any(c => _ServiceContrato.AgendaDisponivelParaContratar(c.IdAgenda)) && enderecosVm.Any()) { listaAgendas = agendas.Join(enderecosVm, a => a.IdEndereco, e => e.ID, (agenda, endereco) => new AgendaListaContratoVM() { IdAgenda = agenda.IdAgenda, IdUsuario = agenda.IdUsuario, DataFim = agenda.DataFim, DataInicio = agenda.DataInicio, StatusDaAgenda = StatusAgendaEnum.Ativa, Endereco = endereco }).ToList(); } return(View(listaAgendas.Skip(pIndiceInicial).Take(Constantes.QuantidadeRegistrosPorPagina).OrderByDescending(c => c.DataInicio))); }
public static void CreateAccessSecurity(IApplicationBuilder app) { using (var scope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope()) { Assembly assembly = typeof(Security).Assembly; SecurityDescription attribute = null; MenuDescription menuAttribute = null; Dictionary <MenuDescription, object> menues = new Dictionary <MenuDescription, object>(); ArrayList items = new ArrayList(); GQ_AccesosDto itemClass = null; GQ_AccesosDto itemMethod = null; /// /// /// CREACION DE ROLES /// /// if (ROLES.Length > 0) { for (int i = 0; i < ROLES.Length; i++) { if (roles.ContainsKey(ROLES[i]) == false) { roles.Add(ROLES[i], null); } } } var RolColl = MySQLService.Instance.GetSession <GQ_Perfiles>().findBy(x => true).ToList(); for (int i = 0; i < roles.Keys.Count; i++) { string key = roles.Keys.ElementAt(i); var rol = RolColl.Where(x => x.KeyName == key).FirstOrDefault(); if (rol == null) { rol = new GQ_Perfiles(); rol.Nombre = key; rol.KeyName = key; rol.Estado = Constantes.ESTADO_ACTIVO; rol.Creado = DateTime.Now; rol.Modificado = DateTime.Now; MySQLService.Instance.GetSession <GQ_Perfiles>().Insert(rol); } roles[key] = new GQ_PerfilesDto(rol); } /// /// /// CREACION DE ACCESOS /// /// var elementsType = (from iface in assembly.GetTypes() where iface.Namespace != null && iface.Namespace.Contains("Controller") select iface); foreach (Type item in elementsType) { menuAttribute = (MenuDescription)item.GetCustomAttribute(typeof(MenuDescription), true); if (menuAttribute != null) { menues.Add(menuAttribute, item); } attribute = (SecurityDescription)item.GetCustomAttribute(typeof(SecurityDescription), true); if (attribute != null) { itemClass = new GQ_AccesosDto(); itemClass.ClassName = getNameObject(item); if (attribute.Estado == SecurityDescription.SeguridadEstado.Activo) { itemClass.MethodName = null; itemClass.Nombre = attribute.Name; itemClass.extra = attribute; //obtenerProfiles(attribute, roles); items.Add(itemClass); } foreach (MethodInfo method in item.GetMethods()) { menuAttribute = (MenuDescription)method.GetCustomAttribute(typeof(MenuDescription), true); if (menuAttribute != null) { menues.Add(menuAttribute, method); } attribute = (SecurityDescription)method.GetCustomAttribute(typeof(SecurityDescription), true); if (attribute != null && attribute.Estado == SecurityDescription.SeguridadEstado.Activo) { itemMethod = new GQ_AccesosDto(); itemMethod.ClassName = itemClass.ClassName; itemMethod.MethodName = method.Name; itemMethod.Nombre = attribute.Name; itemMethod.extra = attribute; //obtenerProfiles(attribute, roles); items.Add(itemMethod); } } } } var AccesoColl = MySQLService.Instance.GetSession <GQ_Accesos>().findBy(x => true).ToList(); foreach (GQ_AccesosDto ii in items) { var data = AccesoColl.Where(x => x.ClassName == ii.ClassName && x.MethodName == ii.MethodName).FirstOrDefault(); if (data == null) { data = new GQ_Accesos(); data.ClassName = ii.ClassName; data.MethodName = ii.MethodName; data.Nombre = ii.Nombre; MySQLService.Instance.GetSession <GQ_Accesos>().Insert(data); } else { data.Nombre = ii.Nombre; MySQLService.Instance.GetSession <GQ_Accesos>().Update(data); } attribute = (SecurityDescription)ii.extra; if (attribute.Perfiles != null && attribute.Perfiles.Length > 0) { for (int i = 0; i < attribute.Perfiles.Length; i++) { var rol = roles[attribute.Perfiles[i]]; var ar = rol.PerfilesAccesos.Where(x => x.AccesoId == data.Id).FirstOrDefault(); if (ar == null) { ar = new GQ_Perfiles_AccesosDto { PerfilId = rol.Id.Value, AccesoId = data.Id.Value, Permite = true }; rol.PerfilesAccesos.Add(ar); rol.Modificado = DateTime.Now; } } } } foreach (var item in roles.Values) { foreach (var itemA in item.PerfilesAccesos) { var itemInsert = itemA.GetEntity(); MySQLService.Instance.GetSession <GQ_Perfiles_Accesos>().Update(itemInsert); } } /// /// /// CREACION DE USUARIO ADMINISTRADOR /// /// var UsuarioColl = MySQLService.Instance.GetSession <GQ_Usuarios>().findBy(x => true); var usuario = UsuarioColl.Where(x => x.NombreUsuario == "admin").FirstOrDefault(); if (usuario == null) { usuario = new GQ_Usuarios { Nombre = "Admin", Apellido = "Admin", NombreUsuario = "admin", Password = Constantes.Encriptar("admin1234"), RequiereContraseña = false, Email = "", Estado = Constantes.ESTADO_ACTIVO, Creado = DateTime.Now, Modificado = DateTime.Now }; MySQLService.Instance.GetSession <GQ_Usuarios>().Insert(usuario); var up = new GQ_Usuarios_Perfiles { UsuarioId = usuario.Id.Value, PerfilId = roles[Security.ROL_ADMI].Id.Value, }; MySQLService.Instance.GetSession <GQ_Usuarios_Perfiles>().Insert(up); } /// /// /// CREACION DE MENUES /// /// var MenuColl = MySQLService.Instance.GetSession <GQ_Menues>().findBy(x => true).ToList(); var menu = MenuColl.Where(x => x.KeyName == MENU_CONFIG_ID).FirstOrDefault(); if (menu == null) { menu = new GQ_Menues(); menu.MenuPosition = MENU_CONFIG_ID; menu.KeyName = MENU_CONFIG_ID; menu.Nombre = "menu_configuracion"; menu.MenuIcono = "fa fa-fw fa-cogs"; menu.Creado = DateTime.Now; menu.Modificado = DateTime.Now; menu.Estado = Constantes.ESTADO_ACTIVO; MySQLService.Instance.GetSession <GQ_Menues>().Insert(menu); } menu = MenuColl.Where(x => x.KeyName == MENU_ESTADISTICAS_ID).FirstOrDefault(); if (menu == null) { menu = new GQ_Menues(); menu.MenuPosition = MENU_ESTADISTICAS_ID; menu.KeyName = MENU_ESTADISTICAS_ID; menu.Nombre = "menu_tablero_control"; menu.MenuIcono = "fa fa-fw fa-dashboard"; menu.Creado = DateTime.Now; menu.Modificado = DateTime.Now; menu.Estado = Constantes.ESTADO_ACTIVO; MySQLService.Instance.GetSession <GQ_Menues>().Insert(menu); } foreach (var m in menues.Keys) { menu = MenuColl.Where(x => x.KeyName == m.Id).FirstOrDefault(); if (menu == null) { var obj = menues[m]; menu = new GQ_Menues(); menu.MenuPosition = m.Id; menu.KeyName = m.Id; menu.Nombre = m.Description; menu.MenuIcono = ""; menu.MenuPadre = m.IdParent; menu.Creado = DateTime.Now; menu.Modificado = DateTime.Now; menu.Estado = Constantes.ESTADO_ACTIVO; if (obj is Type) { menu.MenuUrl = ((Type)obj).Name.Replace("Controller", ""); } else if (obj is MethodInfo) { menu.MenuUrl = ((MethodInfo)obj).ReflectedType.Name.Replace("Controller", "") + @"/" + ((MethodInfo)obj).Name; } MySQLService.Instance.GetSession <GQ_Menues>().Insert(menu); } } } }
private void CargarTotalesGastos() { int expensaId = Convert.ToInt32(Session["ExpensaId"]); lblTotalGastosOrdinarios.Text = _expensasServ.GetTotalGastosOrdinarios(expensaId).ToString("C", new CultureInfo("en-US")); lblTotalGastosExtraordinarios.Text = _expensasServ.GetTotalGastosExtraordinarios(expensaId).ToString("C", new CultureInfo("en-US")); lblTotalGastos.Text = (Constantes.GetDecimalFromCurrency(lblTotalGastosOrdinarios.Text) + Constantes.GetDecimalFromCurrency(lblTotalGastosExtraordinarios.Text)).ToString("C", new CultureInfo("en-US")); }
public async Task StartAsync() { Constantes c = Constantes.Instance; var reply = context.MakeMessage(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; string confirmacionRespuesta1 = "Tengo esta respuesta para usted:"; string confirmacionRespuesta2 = "Tengo estas respuestas para usted:"; string preguntaNoRegistrada1 = "Lo siento, su pregunta no esta registrada, tal vez no escribió la pregunta correctamente"; string preguntaNoRegistrada2 = "Lo siento, su pregunta no esta registrada"; string opcionSecundarioDeRespuesta1 = "Pero esta respuesta le podría interesar:"; string opcionSecundarioDeRespuesta2 = "Pero estas respuestas le podrían interesar:"; string preguntaConsulta = "si tiene otra consulta por favor hágamelo saber"; foreach (var entityP1 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra1")) { var palabra1 = entityP1.Entity.ToLower().Replace(" ", ""); if (palabra1 == "archivodepetición" || palabra1 == "archivodepeticion") { reply.Attachments = RespuestasOneDrive.GetDefinicionArchivoPeticion(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "plan" || palabra1 == "planes" || palabra1 == "precio" || palabra1 == "precios") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "almacenamiento" || palabra2 == "almacenamientos") { foreach (var entityP3 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra3")) { var palabra3 = entityP3.Entity.ToLower().Replace(" ", ""); if (palabra3 == "región" || palabra3 == "regiones" || palabra3 == "país" || palabra3 == "paises") { reply.Attachments = RespuestasOneDrive.GetPlanesAlmacenamientoPaisOneDrive(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { await context.PostAsync($"¿{palabra3}?, por favor vuelva a escribir la consulta correctamente"); return; } } reply.Attachments = RespuestasOneDrive.GetPlanesAlmacenamientoPaisOneDrive(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { await context.PostAsync($"¿{palabra2}?, por favor vuelva a escribir la consulta correctamente"); return; } } await context.PostAsync("Quizás desea saber cuáles son los plantes de almacenamiento por región o por país de One Drive, " + c.proponer()); reply.Attachments = RespuestasOneDrive.GetPlanesAlmacenamientoPaisOneDrive(); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "formatos" || palabra1 == "formato") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "videos" || palabra2 == "video") { reply.Attachments = RespuestasOneDrive.GetFormatoVideoPermitidosOneDrive(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } } await context.PostAsync("Quizás desea saber cuáles son los formatos de video permitidos en One Drive, " + c.proponer()); reply.Attachments = RespuestasOneDrive.GetFormatoVideoPermitidosOneDrive(); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "requisitos" || palabra1 == "requesito") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "sistema" || palabra2 == "equipo") { reply.Attachments = RespuestasOneDrive.GetRequisitosSistemaOneDrive(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } } await context.PostAsync("Quizás desea saber cuáles son los requisitos que debe tener su equipo para usar One Drive, " + c.proponer()); reply.Attachments = RespuestasOneDrive.GetRequisitosSistemaOneDrive(); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "firma" || palabra1 == "firmas") { reply.Attachments = RespuestasWord.GetQueEsFirmaDigital(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { await context.PostAsync($"Lo siento '{palabra1}' no se encuentra registrado."); return; } } //obtener el producto si este fue elegido de forma explicita foreach (var entity in result.Entities.Where(Entity => Entity.Type == "Servicio")) { var value = entity.Entity.ToLower().Replace(" ", ""); if (value == "outlook" || value == "outlok") { reply.Attachments = RespuestasOutlook.GetOutlookDefinicionCard(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (value == "excel") { reply.Attachments = RespuestasExcel.GetExcelDefinicionCard(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (value == "powerpoint") { reply.Attachments = RespuestasPowerPoint.GetPowerPointDefinicionCard(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (value == "word") { reply.Attachments = RespuestasWord.GetWordDefinicionCard(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (value == "onedrive") { reply.Attachments = RespuestasOneDrive.GetOneDriveDefinicion(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { await context.PostAsync($"Lo siento, '{value}' no esta registrado como servicio"); reply.Attachments = Cards.GetConsultaV2(); await context.PostAsync(reply); return; } } //obtener el producto si este a sido escogido anteriormente var servicio = "Servicio"; context.PrivateConversationData.TryGetValue <string>("tipoServicio", out servicio); if (servicio == "Word") { reply.Attachments = RespuestasWord.GetWordDefinicionCard(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (servicio == "Excel") { reply.Attachments = RespuestasExcel.GetExcelDefinicionCard(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (servicio == "Outlook") { reply.Attachments = RespuestasOutlook.GetOutlookDefinicionCard(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (servicio == "PowerPoint") { reply.Attachments = RespuestasPowerPoint.GetPowerPointDefinicionCard(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (servicio == "OneDrive") { reply.Attachments = RespuestasOneDrive.GetOneDriveDefinicion(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { // Si el usuario no a ingresado la primera parte de la pregunta await context.PostAsync("Lo siento, su pregunta no esta registrada"); reply.Attachments = Cards.GetConsultaV2(); await context.PostAsync(reply); await context.PostAsync("O tal vez no escribió la pregunta correctamente, seleccione un servicio y vuelva a hacer la pregunta"); return; } }
public void Load() { try { Client = ContainerService.Resolve <IDelfinServices>(); /************** Servicios/Documentos *****************/ Infrastructure.WinForms.Controls.ComboBox.ComboxBoxItem.AddComboBoxItem("I", "INGRESO", true); Infrastructure.WinForms.Controls.ComboBox.ComboxBoxItem.AddComboBoxItem("C", "COSTO"); ListIngresoCosto = Infrastructure.WinForms.Controls.ComboBox.ComboxBoxItem.GetComboBoxItems(); ListTiposEntidadDocumentos = Client.GetAllTiposEntidad(); ListTiposTDO = Client.GetAllTiposByTipoCodTabla("TDO"); /*****************************************************/ /************** Servicios/Linea Negocio *****************/ ListTiposLNG = Client.GetAllConstantesByConstanteTabla("LNG"); ListTiposEntidad = Client.GetAllTiposEntidad(); /*****************************************************/ /************** Servicios/RegimenVia *****************/ ListTiposRGM = Client.GetAllConstantesByConstanteTabla("RGM"); ListTiposVIA = Client.GetAllConstantesByConstanteTabla("VIA"); /*****************************************************/ //SAP mcomun //String Codigo =Item.SERV_Codigo.ToString; Servicio servSeleccionar = new Servicio(); servSeleccionar.SERV_Codigo = 0; servSeleccionar.SERV_Nombre_SPA = "< Seleccionar Servicio >"; ListServiciosAgrupador = Client.GetAllServicio(); ListServiciosAgrupador.Insert(0, servSeleccionar); ListServiciosUnificador = Client.GetAllServicio(); ListServiciosUnificador.Insert(0, servSeleccionar); Constantes consSeleccionar = new Constantes(); consSeleccionar.CONS_CodTipo = ""; consSeleccionar.CONS_Desc_SPA = "< Seleccionar Tipo >"; ListTiposServicios = Client.GetAllConstantesByConstanteTabla("TSV"); foreach (var item in ListTiposServicios) { item.CONS_CodTipo = item.CONS_CodTipo.Trim(); item.CONS_CodTipoTipo = item.CONS_CodTipoTipo.Trim(); } ListTiposServicios.Insert(0, consSeleccionar); DSPeriodos = new DataSet(); DSPeriodos = Client.GetDSDocsVta("CON_CENTSS_PeriodosDisponibles", null); string x_year = Client.GetFecha().Year.ToString(); ObservableCollection <Infrastructure.Aspect.DataAccess.DataAccessFilterSQL> _listFilters = new ObservableCollection <Infrastructure.Aspect.DataAccess.DataAccessFilterSQL>(); _listFilters.Add(new Infrastructure.Aspect.DataAccess.DataAccessFilterSQL() { FilterName = "@TIPO_CodTabla", FilterValue = "OPE", FilterType = Infrastructure.Aspect.DataAccess.DataAccessFilterTypes.Char, FilterSize = 3 }); _listFilters.Add(new Infrastructure.Aspect.DataAccess.DataAccessFilterSQL() { FilterName = "@TIPO_ano", FilterValue = x_year, FilterType = Infrastructure.Aspect.DataAccess.DataAccessFilterTypes.Char, FilterSize = 4 }); _listFilters.Add(new Infrastructure.Aspect.DataAccess.DataAccessFilterSQL() { FilterName = "@Tipo", FilterValue = "V", FilterType = Infrastructure.Aspect.DataAccess.DataAccessFilterTypes.Char, FilterSize = 1 }); DSTiposOPE = Client.GetDSDocsVta("CON_TABLSS_TodosPorTipo", _listFilters); _listFilters = new ObservableCollection <Infrastructure.Aspect.DataAccess.DataAccessFilterSQL>(); _listFilters.Add(new Infrastructure.Aspect.DataAccess.DataAccessFilterSQL() { FilterName = "@TIPO_CodTabla", FilterValue = "OPE", FilterType = Infrastructure.Aspect.DataAccess.DataAccessFilterTypes.Char, FilterSize = 3 }); _listFilters.Add(new Infrastructure.Aspect.DataAccess.DataAccessFilterSQL() { FilterName = "@TIPO_ano", FilterValue = x_year, FilterType = Infrastructure.Aspect.DataAccess.DataAccessFilterTypes.Char, FilterSize = 4 }); _listFilters.Add(new Infrastructure.Aspect.DataAccess.DataAccessFilterSQL() { FilterName = "@Tipo", FilterValue = "C", FilterType = Infrastructure.Aspect.DataAccess.DataAccessFilterTypes.Char, FilterSize = 1 }); DSTiposOPE_Costo = Client.GetDSDocsVta("CON_TABLSS_TodosPorTipo", _listFilters); LoadParameteres(); LView.LoadView(); MView.LoadView(); } catch (Exception ex) { Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Title, "Ha ocurrido un error inicializando la vista.", ex); } }
/// <summary> /// Initializes a new instance of the <see cref="AnimationPreparer"/> class. /// </summary> /// <param name="formappal">The formappal.</param> /// <param name="Animacion">The animacion.</param> public AnimationPreparer(System.Windows.Forms.Form formappal, Constantes Animacion) : this(formappal, Animacion, 15, 5, 5) { }
private async void BtnGuardarExp_Clicked(object sender, EventArgs e) { Loading(true); var audio = (Audio)BindingContext; var ruta = await FirebaseHelper.ObtenerRuta(audio.IdRuta); //Pongo esta condición porque da un error (Null) que no logro controlar si no se pone if (txtNombre.Text == null) { txtNombre.Text = ""; } if (audio.Id > 0) { if (txtNombre.Text.Equals("") || txtNombre == null || string.IsNullOrWhiteSpace(txtNombre.Text)) { UserDialogs.Instance.Alert("Es necesario introducir el nombre del audio/descripción correspondiente con la ubicación.", "Error", "OK"); return; } if (txtNumero.Text.Equals("") || txtNumero == null || string.IsNullOrWhiteSpace(txtNumero.Text)) { UserDialogs.Instance.Alert("Es necesario introducir el número del audio/descripción correspondiente con la ubicación.", "Error", "OK"); return; } if (txtNumero.Text.ToCharArray().All(char.IsDigit) == false) { UserDialogs.Instance.Alert("Es necesario introducir un número para identificar al Audio.", "Error", "OK"); return; } else { foreach (var audio1 in ruta.Audios) { if (audio1.Id == audio.Id) { audio1.Numero = int.Parse(txtNumero.Text); audio1.Nombre = txtNombre.Text; audio1.Descripcion = txtDescripcion.Text; if (!string.IsNullOrEmpty(recorder.FilePath) || !string.IsNullOrEmpty(recorder.GetAudioFilePath())) { bool answer = await UserDialogs.Instance.ConfirmAsync("Hay información grabada con el micrófono. ¿Desea guardarla?", "Atención", "Sí", "No"); if (answer == true) { audio1.Sonido = await FirebaseHelper.SubirAudio(recorder.GetAudioFileStream(), audio1.Nombre); } } await FirebaseHelper.ActualizarRuta(ruta.Id, ruta.Nombre, ruta.Descripcion, ruta.ImagenPrincipal, ruta.VideoUrl, ruta.IdPueblo, ruta.Camino, ruta.Ubicaciones, ruta.Audios, ruta.Valoraciones); } break; } } } else { if (ruta.Audios == null) { ruta.Audios = new List <Audio>(); } if (txtNombre.Text.Equals("") || string.IsNullOrWhiteSpace(txtNombre.Text) || string.IsNullOrEmpty(txtNombre.Text)) { UserDialogs.Instance.Alert("Es necesario introducir el nombre del audio/descripción correspondiente con la ubicación.", "Error", "OK"); return; } if (txtNumero.Text.Equals("") || txtNumero.Text == null || string.IsNullOrWhiteSpace(txtNumero.Text)) { UserDialogs.Instance.Alert("Es necesario introducir el número del audio/descripción correspondiente con la ubicación.", "Error", "OK"); return; } foreach (var audio1 in ruta.Audios) { if (audio1.Numero.ToString().Equals(txtNumero.Text.ToString())) { UserDialogs.Instance.Alert("El número del audio/descripción pertenece a un registro ya guardado. Comprueba qué número deseas introducir.", "Error", "OK"); return; } break; } if (txtNumero.Text.ToCharArray().All(char.IsDigit) == false) { UserDialogs.Instance.Alert("Es necesario introducir un número para identificar al audio/descripción.", "Error", "OK"); return; } else { var audioNuevo = new Audio { Id = Constantes.GenerarId(), IdRuta = ruta.Id, Numero = int.Parse(txtNumero.Text), Nombre = txtNombre.Text, Descripcion = txtDescripcion.Text }; if (!string.IsNullOrEmpty(recorder.FilePath) || !string.IsNullOrEmpty(recorder.GetAudioFilePath())) { bool answer = await UserDialogs.Instance.ConfirmAsync("Hay información grabada con el micrófono. ¿Desea guardarla?", "Atención", "Sí", "No"); if (answer == true) { audioNuevo.Sonido = await FirebaseHelper.SubirAudio(recorder.GetAudioFileStream(), audioNuevo.Nombre); } } if (audioNuevo.Numero.Equals("")) { UserDialogs.Instance.Alert("Es necesario introducir el número del audio correspondiente con la ubicación.", "Error", "OK"); return; } ruta.Audios.Add(audioNuevo); await FirebaseHelper.ActualizarRuta(ruta.Id, ruta.Nombre, ruta.Descripcion, ruta.ImagenPrincipal, ruta.VideoUrl, ruta.IdPueblo, ruta.Camino, ruta.Ubicaciones, ruta.Audios, ruta.Valoraciones); } } Loading(false); UserDialogs.Instance.Alert("Registro realizado correctamente.", "Correcto", "OK"); await Navigation.PopAsync(); }
public async Task StartAsync() { var accion = "Exportar"; context.PrivateConversationData.SetValue <string>("Accion", accion); var reply = context.MakeMessage(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; string confirmacionRespuesta1 = "Tengo esta respuesta para usted:"; string confirmacionRespuesta2 = "Tengo estas respuestas para usted:"; string preguntaNoRegistrada1 = "Lo siento, su pregunta no esta registrada, tal vez no escribió la pregunta correctamente"; string preguntaNoRegistrada2 = "Lo siento, su pregunta no esta registrada"; string opcionSecundarioDeRespuesta1 = "Pero esta respuesta le podría interesar:"; string opcionSecundarioDeRespuesta2 = "Pero estas respuestas le podrían interesar:"; string preguntaConsulta = "¿Tiene alguna otra consulta?"; Constantes c = Constantes.Instance; // Recorrido de la primera parte de la pregunta foreach (var entityP1 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra1")) { var palabra1 = entityP1.Entity.ToLower().Replace(" ", ""); if (palabra1 == "calendario" || palabra1 == "calendarios") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "google" || palabra2 == "googol") { reply.Attachments = RespuestasOutlook.GetExportarCalendarioGoogleCalendar(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { reply.Attachments = RespuestasOutlook.GetExportarCalendarioGoogleCalendar(); await context.PostAsync($"Lo siento, su pregunta no esta registrada, tal vez no escribió correctamente la palabra '{palabra2}'?"); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); return; } } // No se detectó la segunda parte de la pregunta reply.Attachments = RespuestasOutlook.GetExportarCalendarioGoogleCalendar(); await context.PostAsync(preguntaNoRegistrada1); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); return; } else if (palabra1 == "correoelectrónico" || palabra1 == "correoelectrónicos" || palabra1 == "correoelectronico" || palabra1 == "correoelectronicos" || palabra1 == "contacto" || palabra1 == "contactos" || palabra1 == "correo" || palabra1 == "correos") { reply.Attachments = RespuestasOutlook.GetExportarCorreoContactosCalendarioOutlook(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "archivos" || palabra1 == "archivo" || palabra1 == "documentos" || palabra1 == "documento") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "pdf" || palabra2 == "xps") { reply.Attachments = RespuestasWord.GetGuardarArchivoPDF(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { reply.Attachments = RespuestasWord.GetGuardarArchivoPDF(); await context.PostAsync($"Lo siento, su pregunta no esta registrada, tal vez no escribió correctamente la palabra '{palabra2}'?"); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); return; } } reply.Attachments = RespuestasWord.GetGuardarArchivoPDF(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { await context.PostAsync($"Lo siento, su pregunta no esta registrada"); await context.PostAsync($"O tal vez no la escribió correctamente, ¿{palabra1}?"); return; } } // No se detectó la primera parte de la pregunta await context.PostAsync(preguntaNoRegistrada2); reply.Attachments = Cards.GetConsultaV2(); await context.PostAsync(reply); await context.PostAsync("O tal vez no escribió la pregunta correctamente"); return; }
private void PrecioFanegaTextBox_KeyPress(object sender, KeyPressEventArgs e) { Constantes.ValidarNumerosDecimales(sender, e, PrecioFanegaTextBox.Text); }
protected Decision(Constantes constantes, IVectorTools vectorTools, int prioridad) { this.constantes = constantes; VectorTools = vectorTools; Prioridad = prioridad; }
public Resultado ejecutar(Contexto ctx, int nivel) { String nombreVar = instruccion.ChildNodes[0].Token.Text; if (!existeVariable(ctx, nombreVar)) { return(FabricarResultado.creaFail()); } Resultado res = new Expresion(instruccion.ChildNodes[1].ChildNodes[0]).resolver(ctx); String tipo = res.Tipo; if (tipo == Constantes.T_ERROR) { ListaErrores.getInstance().setErrorSemantico(instruccion.Token.Location.Line, instruccion.Token.Location.Line, "No se puedo resolver la expresion", Interprete.archivo); return(FabricarResultado.creaFail()); //error en la expresion } Variable destino = obtenerVariable(ctx, nombreVar); String tipoVar = destino.Tipo; String casteo = Constantes.ValidarTipos(tipoVar, tipo, Constantes.MT_ASIG); String valor = null; if (casteo == Constantes.T_ERROR) { ListaErrores.getInstance().setErrorSemantico(instruccion.Token.Location.Line, instruccion.Token.Location.Line, "No se puede asignar ese tipo de dato", Interprete.archivo); //no se puede asignar ese tipo } else { String tmp = ""; switch (tipoVar) { case Constantes.T_STR: switch (tipo) { case Constantes.T_BOOL: tmp = "" + Convert.ToInt32(Convert.ToBoolean(res.Valor)); break; default: tmp = res.Valor; break; } break; case Constantes.T_NUM: switch (tipo) { case Constantes.T_BOOL: tmp = "" + Convert.ToInt32(Convert.ToBoolean(res.Valor)); break; case Constantes.T_NUM: tmp = res.Valor; break; default: ListaErrores.getInstance().setErrorSemantico(instruccion.Token.Location.Line, instruccion.Token.Location.Line, "error de casteo", Interprete.archivo); //error por si llegara a pasar aunque no lo creo break; } break; case Constantes.T_BOOL: switch (tipo) { case Constantes.T_BOOL: tmp = res.Valor; break; default: ListaErrores.getInstance().setErrorSemantico(instruccion.Token.Location.Line, instruccion.Token.Location.Line, "error de casteo", Interprete.archivo); //error por si llegara a pasar aunque no lo creo break; } break; } valor = tmp; } destino.Valor = valor; ctx.ActualizarValor(nombreVar, destino); return(FabricarResultado.creaOk()); }
public static IList <ListarRolesAsignablesDto> GetListarRolesAsignables(string pusr_str_red, string prol_str_alias, int pint_rol_sin_asignar) { var parameter = new ListarRolesAsignablesParameter() { int_rol_sin_asignar = pint_rol_sin_asignar, rol_str_alias = prol_str_alias, usr_str_red = pusr_str_red, sis_str_siglas = Constantes.GetModuleAcronym() }; var result = (ListarRolesAsignablesResult)parameter.Execute(); return(result == null ? new List <ListarRolesAsignablesDto>() : result.Hits.ToList()); }
public async Task StartAsync() { var reply = context.MakeMessage(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; var accion = "Combinar"; context.PrivateConversationData.SetValue <string>("Accion", accion); string confirmacionRespuesta1 = "Tengo esta respuesta para usted:"; string confirmacionRespuesta2 = "Tengo estas respuestas para usted:"; string preguntaNoRegistrada1 = "Lo siento, su pregunta no esta registrada, tal vez no escribió la pregunta correctamente"; string preguntaNoRegistrada2 = "Lo siento, su pregunta no esta registrada"; string opcionSecundarioDeRespuesta1 = "Pero esta respuesta le podría interesar:"; string opcionSecundarioDeRespuesta2 = "Pero estas respuestas le podrían interesar:"; string preguntaConsulta = "si tiene otra consulta por favor hágamelo saber"; Constantes c = Constantes.Instance; // Se detectó la primera parte de la pregunta foreach (var entityP1 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra1")) { var palabra1 = entityP1.Entity.ToLower().Replace(" ", ""); context.PrivateConversationData.SetValue <string>("Palabra1", palabra1); // ------------------------------------------------------------------- // La primera parte de la pregunta es firma if (palabra1 == "documento" || palabra1 == "documentos" || palabra1 == "achivos" || palabra1 == "archivo") { reply.Attachments = RespuestasWord.GetCombinarDocumentosWord(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "correspondencia") { // Se detectó la segunda parte de la pregunta foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); // La segunda parte de la prgunta es mensaje o correo if (palabra2 == "documento" || palabra2 == "documentos" || palabra2 == "archivoexcel" || palabra2 == "documentoexcel" || palabra2 == "hoja") { reply.Attachments = RespuestasWord.GetCombinarCorrespondenciaHojaExcelWord(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { reply.Attachments = RespuestasWord.GetCombinarCorrespondenciaHojaExcelWord(); await context.PostAsync($"Lo siento, su pregunta no esta registrada, tal vez no escribió correctamente la palabra '{palabra2}'?"); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); return; } } // No se detectó la segunda parte de la pregunta reply.Attachments = RespuestasWord.GetCombinarCorrespondenciaHojaExcelWord(); await context.PostAsync(preguntaNoRegistrada1); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); return; } else { reply.Attachments = RespuestasWord.GetCombinarDocumentosWord(); await context.PostAsync($"Lo siento, su pregunta no esta registrada, tal vez no escribió correctamente la palabra '{palabra1}'?"); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); return; } } // Si el usuario no ingreso la primera parte de la pregunta await context.PostAsync(preguntaNoRegistrada2); reply.Attachments = Cards.GetConsultaV2(); await context.PostAsync(reply); await context.PostAsync("O tal vez no escribió la pregunta correctamente"); return; }
public PasoEsperar(Constantes constantes, float segundosAEsperar) : this(constantes, segundosAEsperar, null) { }
public async Task StartAsync() { var accion = "Mover"; context.PrivateConversationData.SetValue <string>("Accion", accion); var reply = context.MakeMessage(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; string confirmacionRespuesta1 = "Tengo esta respuesta para usted:"; string preguntaConsulta = "¿Tiene alguna otra consulta?"; string opcionSecundarioDeRespuesta1 = "Pero esta respuesta le podría interesar:"; string preguntaNoRegistrada2 = "Lo siento, su pregunta no esta registrada"; Constantes c = Constantes.Instance; // Recorrido de la primera parte de la pregunta foreach (var entityP1 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra1")) { var palabra1 = entityP1.Entity.ToLower().Replace(" ", ""); if (palabra1 == "carpeta" || palabra1 == "carpetas") { reply.Attachments = RespuestasOutlook.GetCambiarNombreCarpeta(); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (palabra1 == "archivos" || palabra1 == "archivo") { foreach (var entityP2 in result.Entities.Where(Entity => Entity.Type == "Pregunta::Palabra2")) { var palabra2 = entityP2.Entity.ToLower().Replace(" ", ""); if (palabra2 == "datos" || palabra2 == "dato") { reply.Attachments = RespuestasOutlook.GetMoverArchivoDatosOutlook(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { reply.Attachments = RespuestasOutlook.GetMoverArchivoDatosOutlook(); await context.PostAsync($"Lo siento, su pregunta no esta registrada, tal vez no escribió correctamente la palabra '{palabra1}'?"); await context.PostAsync(opcionSecundarioDeRespuesta1); await context.PostAsync(reply); return; } } foreach (var service in result.Entities.Where(Entity => Entity.Type == "Servicio")) { var serv = service.Entity.ToLower().Replace(" ", ""); if (serv == "outlook") { reply.Attachments = RespuestasOutlook.GetMoverArchivoDatosOutlook(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (serv == "onedrive") { reply.Attachments = RespuestasOneDrive.GetCambiarNombreMoverFotosArhivosOneDrive(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { await context.PostAsync($"'{serv}' no se encuentra registrado como servicio"); return; } } //obtener el producto si este a sido escogido anteriormente var servicio = "Servicio"; context.PrivateConversationData.TryGetValue <string>("tipoServicio", out servicio); if (servicio == "Outlook") { reply.Attachments = RespuestasOutlook.GetMoverArchivoDatosOutlook(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else if (servicio == "OneDrive") { reply.Attachments = RespuestasOneDrive.GetCambiarNombreMoverFotosArhivosOneDrive(); await context.PostAsync(confirmacionRespuesta1); await context.PostAsync(reply); await context.PostAsync(preguntaConsulta); return; } else { // Si el usuario no a ingresado la primera parte de la pregunta await context.PostAsync("Lo siento, su pregunta no esta registrada"); reply.Attachments = Cards.GetConsultaV2(); await context.PostAsync(reply); await context.PostAsync("O tal vez no escribió la pregunta correctamente, seleccione un servicio y vuelva a hacer la pregunta"); return; } } } // No se detectó la primera parte de la pregunta await context.PostAsync(preguntaNoRegistrada2); reply.Attachments = Cards.GetConsultaV2(); await context.PostAsync(reply); await context.PostAsync("O tal vez no escribió la pregunta correctamente"); return; }
private void Start() { constantes = GameObject.FindWithTag("Constante").GetComponent <Constantes>(); }
private void NombreTextBox_KeyPress(object sender, KeyPressEventArgs e) { Constantes.ValidarNombreTextBox(sender, e); }
internal bool validaNProdutosCredito(int nMinimoASeleccionar) { bool nprodutosValid = true; lberror.Text = ""; //Valida se Produtos estão selecionados - Valida o nº de familias. Não é por nº de subproduto int countSel = 0; TreeNode todosF = trtipologiaProdutosRFTree.Nodes[0]; foreach (TreeNode tr in todosF.ChildNodes) { if (tr.Checked) { countSel++; } } int countSel2 = 0; TreeNode todosC = trtipologiaProdutosRCTree.Nodes[0]; foreach (TreeNode tr in todosC.ChildNodes) { if (tr.Checked) { countSel2++; } } int countSel3 = 0; TreeNode todosA = trtipologiaProdutosRATree.Nodes[0]; foreach (TreeNode tr in todosA.ChildNodes) { if (tr.Checked) { countSel3++; } } //Validacao Numero Minimo de Produtos a seleccionar if ((countSel + countSel2 + countSel3) < nMinimoASeleccionar) { string[] args = { nMinimoASeleccionar.ToString() }; lberror.Text = Constantes.NovaMensagem(Constantes.Mensagens.NMinimoProdutosML, args); lberror.Visible = true; lberror.ForeColor = System.Drawing.Color.Red; nprodutosValid = false; } //de acordo com a Tipologia de Produto Base ou Avançada)) if (txtSubProductDescription.Text.ToUpper().Contains("BASE")) { if ((countSel + countSel2 + countSel3) > Convert.ToInt32(ConfigurationManager.AppSettings["NMaxProdutoMLBase"])) { lberror.Text = Constantes.Mensagens.NMinimoProdutosRiscoB; lberror.Visible = true; lberror.ForeColor = System.Drawing.Color.Red; nprodutosValid = false; } } else if (txtSubProductDescription.Text.ToUpper().Contains("AVANCADO")) { if ((countSel + countSel2 + countSel3) > Convert.ToInt32(ConfigurationManager.AppSettings["NMaxProdutoMLAvancada"])) { lberror.Text = Constantes.Mensagens.NMinimoProdutosRiscoA; lberror.Visible = true; lberror.ForeColor = System.Drawing.Color.Red; nprodutosValid = false; } } else { lberror.Text = Constantes.Mensagens.ProdutoMLNIdentificado; lberror.Visible = true; lberror.ForeColor = System.Drawing.Color.Red; nprodutosValid = false; } return(nprodutosValid); }
private void CantidadSacosTextBox_KeyPress(object sender, KeyPressEventArgs e) { Constantes.ValidarNumerosDecimales(sender, e, CantidadSacosTextBox.Text); }
/// <summary> /// Animations the start. /// </summary> /// <param name="Animacion">The animacion.</param> /// <param name="coolEffect">if set to <c>true</c> [cool effect].</param> /// <param name="parametros">The parametros.</param> public void AnimationStart(Constantes Animacion, bool coolEffect, object[] parametros) { int paramlength; FormAnimations fanims; fanims = new FormAnimations(this.formappal, this.time, this.stepX, this.stepY); paramlength = parametros.Length; formappal.Opacity = 0; formappal.Visible = true; switch (Animacion) { #region Left2Right ///Parameters: ///P[0] posini; P[1] posfin; ///if coolEffect is true, and paramLength < 2 the form is placed at the left side of the screen case Constantes.Left2Right: if (coolEffect && paramlength >= 2) { formappal.Opacity = 1; } if (paramlength == 2) { fanims.Left2Right((int)parametros[0], (int)parametros[1]); } if (paramlength == 0) { if (!coolEffect) { fanims.Left2Right(); } else { this.formappal.Left = -formappal.Width; this.formappal.Opacity = 1; fanims.Left2Right(); } } if (paramlength == 1) { if (!coolEffect) { fanims.Left2Right((int)parametros[0]); } else { formappal.Left = -formappal.Width; this.formappal.Opacity = 1; fanims.Left2Right((int)parametros[0]); } } break; #endregion #region Right2Left ///Parameters: ///P[0] posini; P[1] posfin; ///if coolEffect is true, and paramLength < 2 the form is placed at the right side of the screen case Constantes.Right2Left: if (coolEffect && paramlength >= 2) { this.formappal.Opacity = 1; } if (paramlength == 2) { fanims.Right2Left((int)parametros[0], (int)parametros[1]); } if (paramlength == 0) { if (!coolEffect) { fanims.Right2Left(); } else { this.formappal.Left = Screen.PrimaryScreen.WorkingArea.Width; this.formappal.Opacity = 1; fanims.Right2Left(); } } if (paramlength == 1) { if (!coolEffect) { fanims.Right2Left((int)parametros[0]); } else { formappal.Left = Screen.PrimaryScreen.WorkingArea.Width; this.formappal.Opacity = 1; fanims.Right2Left((int)parametros[0]); } } break; #endregion #region Top2Bottom ///Parameters: ///P[0] posini; P[1] posfin; ///if coolEffect is true, and paramLength < 2 the form is placed at the top side of the screen case Constantes.Top2Bottom: if (coolEffect && paramlength >= 2) { this.formappal.Opacity = 1; } if (paramlength == 2) { fanims.Top2Bottom((int)parametros[0], (int)parametros[1]); } if (paramlength == 0) { if (!coolEffect) { fanims.Top2Bottom(); } else { this.formappal.Top = -formappal.Height; this.formappal.Opacity = 1; fanims.Top2Bottom(); } } if (paramlength == 1) { if (!coolEffect) { fanims.Top2Bottom((int)parametros[0]); } else { this.formappal.Top = -formappal.Height; this.formappal.Opacity = 1; fanims.Top2Bottom((int)parametros[0]); } } break; #endregion #region Bottom2Top ///Parameters: ///P[0] posini; P[1] posfin; ///if coolEffect is true, and paramLength < 2 the form is placed at the bottom side of the screen case Constantes.Bottom2Top: if (coolEffect && paramlength >= 2) { this.formappal.Opacity = 1; } if (paramlength == 2) { fanims.Bottom2Top((int)parametros[0], (int)parametros[1]); } if (paramlength == 0) { if (!coolEffect) { fanims.Bottom2Top(); } else { this.formappal.Top = Screen.PrimaryScreen.WorkingArea.Height; this.formappal.Opacity = 1; fanims.Bottom2Top(); } } if (paramlength == 1) { if (!coolEffect) { fanims.Bottom2Top((int)parametros[0]); } else { this.formappal.Top = Screen.PrimaryScreen.WorkingArea.Height; this.formappal.Opacity = 1; fanims.Bottom2Top((int)parametros[0]); } } break; #endregion #region FadeIn ///Parameters: ///P[0] initial transparent percentage; P[1] opacity step; ///if coolEffect is not important for this animation. case Constantes.FadeIn: fanims = new FormAnimations(this.formappal, 50); //The time used for animations might be smaller but for a smooth FadeIn this time is good. if (paramlength == 2) { formappal.Opacity = (Double.Parse(parametros[0].ToString()) + 1) / 100; fanims.FadeIn(Double.Parse(parametros[0].ToString()), (int)parametros[1]); } if (paramlength == 0) { formappal.Opacity = 0; fanims.FadeIn(); } break; #endregion #region FadeOut ///Parameters: ///P[0] initial transparent percentage; P[1] opacity step; ///if coolEffect is not important for this animation. case Constantes.FadeOut: fanims = new FormAnimations(this.formappal, 50); //The time used for animations might be smaller but for a smooth FadeOut this time is good. if (paramlength == 2) { formappal.Opacity = (Double.Parse(parametros[0].ToString()) + 1) / 100; fanims.FadeOut(Double.Parse(parametros[0].ToString()), (int)parametros[1]); } if (paramlength == 0) { formappal.Opacity = 1; fanims.FadeOut(); } break; #endregion } this.formappal.Refresh(); }
public Resultado ejecutar(Contexto ctx, int nivel) { String valor = null; String varTipo = instruccion.ChildNodes[0].ToString(); if (instruccion.ChildNodes.Count == 3) { Resultado res = new Expresion(instruccion.ChildNodes[2].ChildNodes[0]).resolver(ctx); String tipo = res.Tipo; String casteo = Constantes.ValidarTipos(varTipo, tipo, Constantes.MT_ASIG); if (tipo == Constantes.T_ERROR) { ListaErrores.getInstance().setErrorSemantico(instruccion.Token.Location.Line, instruccion.Token.Location.Line, "error de tipo", Interprete.archivo); } else if (casteo == Constantes.T_ERROR) { ListaErrores.getInstance().setErrorSemantico(instruccion.Token.Location.Line, instruccion.Token.Location.Line, "error de casteo", Interprete.archivo); } else { String tmp = ""; switch (varTipo) { case Constantes.T_STR: switch (tipo) { case Constantes.T_BOOL: tmp = "" + Convert.ToInt32(Convert.ToBoolean(res.Valor)); break; default: tmp = res.Valor; break; } break; case Constantes.T_NUM: switch (tipo) { case Constantes.T_BOOL: tmp = "" + Convert.ToInt32(Convert.ToBoolean(res.Valor)); break; case Constantes.T_NUM: tmp = res.Valor; break; default: ListaErrores.getInstance().setErrorSemantico(instruccion.Token.Location.Line, instruccion.Token.Location.Line, "Error de casteo", Interprete.archivo); break; } break; case Constantes.T_BOOL: switch (tipo) { case Constantes.T_BOOL: tmp = res.Valor; break; default: ListaErrores.getInstance().setErrorSemantico(instruccion.Token.Location.Line, instruccion.Token.Location.Line, "error de casteo", Interprete.archivo); break; } break; } valor = tmp; } } foreach (var id in instruccion.ChildNodes[1].ChildNodes) { String nombre = id.Token.Text; Variable var = new Variable(nombre, valor, varTipo, nivel); if (nivel == Constantes.GLOBAL) { if (existeVariableGlobal(nombre)) { //error ya existe la variable } crearVariableGlobal(var); } else { if (existeVariableLocal(ctx, nombre)) { //ya existe la variable local } crearVariableLocal(ctx, var); } } return(FabricarResultado.creaOk()); }
private void LoadTemplate(bool facial, bool infos) { bool serveur = chk_via_serveur.Checked; if (serveur) { Utils.WriteLog("Chargement des empreintes du serveur"); String query = ""; if (infos) { if (employe != null ? employe.Id < 1 : true) { query = "select e.* from yvs_grh_employes e inner join yvs_agences a on e.agence = a.id where a.societe = " + Constantes.SOCIETE.Id + " order by e.nom"; } else { query = "select e.* from yvs_grh_employes e inner join yvs_agences a on e.agence = a.id where e.id = " + employe.Id; } List <Employe> list = EmployeBLL.List(query); le.Clear(); foreach (Employe e in list) { le.Add(new Empreinte((long)-(le.Count + 1), e)); } } else { if (employe != null ? employe.Id < 1 : true) { query = "select p.* from yvs_grh_empreinte_employe p inner join yvs_grh_employes e on p.employe = e.id inner join yvs_agences a on e.agence = a.id where (p.empreinte_faciale is null or p.empreinte_faciale = 0) and empreinte_digital > -1 and a.societe = " + Constantes.SOCIETE.Id + " order by e.nom"; if (facial) { query = "select p.* from yvs_grh_empreinte_employe p inner join yvs_grh_employes e on p.employe = e.id inner join yvs_agences a on e.agence = a.id where (p.empreinte_digital is null or p.empreinte_digital = 0) and empreinte_faciale > 0 and a.societe = " + Constantes.SOCIETE.Id + " order by e.nom"; } } else { query = "select p.* from yvs_grh_empreinte_employe p where (p.empreinte_faciale is null or p.empreinte_faciale = 0) and empreinte_digital > -1 and p.employe = " + employe.Id; if (facial) { query = "select p.* from yvs_grh_empreinte_employe p where (p.empreinte_digital is null or p.empreinte_digital = 0) and empreinte_faciale > 0 and p.employe = " + employe.Id; } } le = EmpreinteBLL.List(query); if (chk_not_in.Checked) { List <Empreinte> list = new List <Empreinte>(); list.AddRange(le); le.Clear(); if (currentPointeuse != null ? currentPointeuse.Id > 0 : false) { Appareil z = Utils.ReturnAppareil(currentPointeuse); Utils.VerifyZkemkeeper(ref z, ref currentPointeuse); if (z == null) { Utils.WriteLog("La liaison avec l'appareil " + currentPointeuse.Ip + " est corrompue"); return; } currentPointeuse.Zkemkeeper = z; if (facial) { switch (currentPointeuse.Type) { case Constantes.TYPE_IFACE: foreach (Empreinte y in list) { List <Empreinte> l = z.SSR_GetAllFaceTemplate(currentPointeuse.IMachine, (int)y.Employe.Id, currentPointeuse.Connecter, false); if (l != null ? l.Count < 1 : true) { le.Add(y); } } break; default: Utils.WriteLog("Les empreintes faciales ne sont pas integrées dans l'appareil " + currentPointeuse.Ip); break; } } else { switch (currentPointeuse.Type) { case Constantes.TYPE_IFACE: foreach (Empreinte y in list) { List <Empreinte> l = z.SSR_GetAllTemplate(currentPointeuse.IMachine, (int)y.Employe.Id, currentPointeuse.Connecter, false); if (l != null ? l.Count < 1 : true) { le.Add(y); } } break; default: foreach (Empreinte y in list) { List <Empreinte> l = z.GetAllTemplate(currentPointeuse.IMachine, (int)y.Employe.Id, currentPointeuse.Connecter, false); if (l != null ? l.Count < 1 : true) { le.Add(y); } } break; } } } else { Utils.WriteLog("Vous devez selectionner une pointeuse ou déselectionner le filtre sur les empreintes interne"); } } } } else { if (currentPointeuse != null ? currentPointeuse.Id > 0 : false) { Appareil z = Utils.ReturnAppareil(currentPointeuse); Utils.VerifyZkemkeeper(ref z, ref currentPointeuse); if (z == null) { Utils.WriteLog("La liaison avec l'appareil " + currentPointeuse.Ip + " est corrompue"); return; } currentPointeuse.Zkemkeeper = z; Utils.WriteLog("Chargement des empreintes de l'appareil " + currentPointeuse.Ip); if (employe != null ? employe.Id < 1 : true) { if (facial) { switch (currentPointeuse.Type) { case Constantes.TYPE_IFACE: le = z.SSR_GetAllFaceTemplate(currentPointeuse.IMachine, currentPointeuse.Connecter, chk_not_in.Checked); break; default: Utils.WriteLog("Les empreintes faciales ne sont pas integrées dans l'appareil " + currentPointeuse.Ip); break; } } else { switch (currentPointeuse.Type) { case Constantes.TYPE_IFACE: le = z.SSR_GetAllTemplate(currentPointeuse.IMachine, currentPointeuse.Connecter, chk_not_in.Checked); break; default: le = z.GetAllTemplate(currentPointeuse.IMachine, currentPointeuse.Connecter, chk_not_in.Checked); break; } } } else { if (facial) { switch (currentPointeuse.Type) { case Constantes.TYPE_IFACE: le = z.SSR_GetAllFaceTemplate(currentPointeuse.IMachine, (int)employe.Id, currentPointeuse.Connecter, chk_not_in.Checked); break; default: Utils.WriteLog("Les empreintes faciales ne sont pas integrées dans l'appareil " + currentPointeuse.Ip); break; } } else { switch (currentPointeuse.Type) { case Constantes.TYPE_IFACE: le = z.SSR_GetAllTemplate(currentPointeuse.IMachine, (int)employe.Id, currentPointeuse.Connecter, chk_not_in.Checked); break; default: le = z.GetAllTemplate(currentPointeuse.IMachine, (int)employe.Id, currentPointeuse.Connecter, chk_not_in.Checked); break; } } } } else { Utils.WriteLog("Vous devez selectionner une pointeuse"); } } if (le != null ? le.Count > 0 : false) { ObjectThread o = new ObjectThread(Constantes.PBAR_WAIT); o.UpdateMaxBar(le.Count); LoadEmpreinte(le); } else { Constantes.LoadPatience(true); } ResetDataEmpreinte(); }
private void LoginButton_Click(object sender, EventArgs e) { RepositorioBase <Usuarios> repositorio = new RepositorioBase <Usuarios>(); if (!Validar()) { return; } Expression <Func <Usuarios, bool> > filtro = x => true; string username = UserTextBox.Text; string password = PassWordTextBox.Text; filtro = x => x.UserName.Equals(username); List <Usuarios> usuario = repositorio.GetList(filtro); Usuarios tiposUsuario = new Usuarios(); if (usuario.Count > 0) { if (usuario.Exists(x => x.UserName.Equals(username))) { if (usuario.Exists(x => x.Password.Equals(Constantes.SHA1(password)))) { foreach (var item in repositorio.GetList(x => x.UserName.Equals(username))) { PesadasBLL.UsuarioParaLogin(item.Nombre, item.UsuarioID); tiposUsuario = repositorio.Buscar(item.UsuarioID); } if (tiposUsuario.TipoUsuario.Equals(Constantes.admi)) { tipoUsuario = Constantes.admi; } else if (tiposUsuario.TipoUsuario.Equals(Constantes.user)) { tipoUsuario = Constantes.user; } this.Close(); Thread hilo = new Thread(AbrirMainForms); hilo.Start(); } else { MessageBox.Show("Contraseña Incorrecto!!", "AgroSoft", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Usuarios " + username + " Por Favor Consulte un Administrador", "AgroSoft", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { repositorio.Guardar(new Usuarios() { Nombre = "Admin", UserName = "******", Password = Constantes.SHA1("root1234"), TipoUsuario = "A", FechaRegistro = DateTime.Now.Date });; MessageBox.Show("Al parecer es tu primera vez ejecutando el programa," + "El Username es *root* y el Password *root1234*", "AgroSoft", MessageBoxButtons.OK, MessageBoxIcon.Information); } }