Esempio n. 1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            Cuadre c = new Cuadre();

            ObtenerDatosCuadre(c);

            if (Convert.ToSingle(tbxTotalIntroducido.Text) != Convert.ToSingle(tbxTotalAIntroducir.Text) || tbxTotalAIntroducir.Text == "0")
            {
                Utilitario.ShowToastr(this, "Total introducido debe ser igual al Total", "Mensaje", "error");
            }
            else
            {
                if (c.Insertar())
                {
                    Utilitario.ShowToastr(this, "Guardado", "Mensaje", "success");
                    ImprimirCuadre(c.CuadreId);
                    Limpiar();
                }
            }
        }
Esempio n. 2
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            if (!Utilitario.EsValido(this) || !validacionesExitosas)
            {
                return;
            }

            Cursor = Cursors.WaitCursor;

            if (UsuariosBD.Login(txtUsuario.Text.Trim(), txtContraseña.Text.Trim()) == false)
            {
                lblError.Text = Errores.TipoErroresTxt.Incorrectos.ToName("Usuario y/o contraseña");
                Cursor        = Cursors.Arrow;
                return;
            }

            Cursor = Cursors.Arrow;
            frmPrincipal.ActualizarStatusBar(txtUsuario.Text);
            this.Close();
        }
 public void IniciarSesion(string casoPrueba, string urlInicial, string usuario, string clave,
                           string valorEsperado, string urlTestlink, string keyTestlink,
                           string idTestCaseInternoTestlink, string idTestCaseExternoTestlink,
                           string idTestPlanTestlink, string idBuidTestink, string nombreBuildTestlink)
 {
     try
     {
         iniciarSesionPage.IngresarPaginaIniciarSesion(urlInicial);
         string valorObtenido = iniciarSesionPage.IniciarSesion(usuario, clave);
         Assert.AreEqual(valorObtenido, valorEsperado + "as");
     }
     catch (AssertionException e)
     {
         Utilitario.CaputarPantallarError(rutaCarpetaError, "Error: " + e.Message, ref playlistPage.GetWebDriver());
         Assert.Fail(e.StackTrace);
     }
     catch (Exception e)
     {
         Assert.Fail("ERROR: " + e.StackTrace);
     }
 }
        /// <summary>
        /// Valida la autenticacion del usuario en el sistema c&ctex
        /// </summary>
        /// <param name="login">string de entrada</param>
        /// <param name="password">string de entrada</param>
        /// <param name="nameFile">string de entrada</param>
        /// <returns>Retorna booleano</returns>
        public bool ValidarUsuarioIcetex(string login, string password, string nameFile)
        {
            //UsuarioDao objUsuario = new UsuarioDao();

            string file      = System.Web.Hosting.HostingEnvironment.MapPath("~/" + nameFile);
            string xmlString = System.IO.File.ReadAllText(file);
            List <UsuarioIcetexEntity> lstUsuarioIcetex = Utilitario.Deserialize <List <UsuarioIcetexEntity> >(xmlString);

            if (lstUsuarioIcetex.Exists(u => u.Login.ToUpper().Equals(login.ToUpper())))
            {
                string pass = this.usuarioDao.ValidarUsuarioIcetex(login);
                using (MD5 md5Hash = MD5.Create())
                {
                    return(VerificarMd5Hash(md5Hash, password, pass));
                }
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// Metodo que valida usuario
        /// </summary>
        /// <param name="email">string de entrada</param>
        /// <param name="password">string de entrada</param>
        /// <param name="convocatoria">string de entrada</param>
        /// <returns>Retorna booleano</returns>
        public UsuarioEntity ValidarUsuario(string email, string password, string convocatoria)
        {
            UsuarioEntity usuario = new UsuarioEntity();

            usuario.SeAutentica = false;
            //bool ingreso = false;

            CRijndael MEncriptar            = new CRijndael();
            string    contraseniaEncriptada = MEncriptar.Encriptar(password);

            DataTable            vobjResultado = this.usuarioDao.ValidarUsuario(email, contraseniaEncriptada, convocatoria);
            List <UsuarioEntity> lstusuario    = Utilitario.ConvertTo <UsuarioEntity>(vobjResultado);

            if (lstusuario.Count > 0)
            {
                usuario             = lstusuario.FirstOrDefault();
                usuario.SeAutentica = true;
            }

            return(usuario);
        }
Esempio n. 6
0
        public bool CamposValidos()
        {
            if (!string.IsNullOrEmpty(CPF) && !Utilitario.IsCPF(CPF))
            {
                this.Mensagem = "O CPF digitado não é válido.";
            }
            else if (!string.IsNullOrEmpty(Email) && !Utilitario.IsEmail(Email))
            {
                this.Mensagem = "O E-mail digitado não é válido.";
            }
            else if (!string.IsNullOrEmpty(CPFResponsavel) && !Utilitario.IsCPF(CPFResponsavel))
            {
                this.Mensagem = "O CPF do Responsável digitado não é válido.";
            }
            else if (!string.IsNullOrEmpty(DataNascimento) && !Utilitario.IsDateTime(DataNascimento))
            {
                this.Mensagem = "A Data de Nascimento digitada não é válida.";
            }

            return(string.IsNullOrEmpty(this.Mensagem));
        }
Esempio n. 7
0
        protected void btnCalcular_Click(object sender, EventArgs e)
        {
            float taza   = Convert.ToSingle(tbxTaza.Text);
            float tiempo = 0;

            try
            {
                string loco = tbxFecha.Text;
                if (radbFecha.Checked == true && tbxFecha.Text == string.Empty)
                {
                    Utilitario.ShowToastr(this, "FORMATO DE LA FECHA ES INCORRECTO DIA/MES/AñO", "Mensaje", "error");
                }
                else if (radbNumeroCuota.Checked == true && tbxCantidadCuota.Text == string.Empty)
                {
                    Utilitario.ShowToastr(this, "CAMPO CUOTAS ESTA VACIO", "Mensaje", "error");
                }
                else
                {
                    if (radbFecha.Checked == true)
                    {
                        tiempo = ObtenerNumeroTiempo(tbxFecha.Text);
                    }
                    else
                    {
                        tiempo = ObtenerNumeroTiempo(Convert.ToString(TiempoPorCuota()));
                    }


                    float monto = Convert.ToSingle(tbxMonto.Text);
                    tbxtotal.Text = InteresSimple(monto, tiempo, taza).ToString("N2");

                    btnGuardar.Visible = true;
                    Cuotas();
                }
            }catch (Exception EX)
            {
                throw EX;
                // Utilitario.ShowToastr(this, "FORMATO DE LA FECHA ES INCORRECTO DIA/MES/AñO", "Mensaje", "error");
            }
        }
Esempio n. 8
0
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            float total = 0;

            try
            {
                if (ValidarAbonar())
                {
                    total = Convert.ToSingle(Total());

                    DataTable dt = (DataTable)ViewState["Detalle2"];
                    DataRow   row;
                    row = dt.NewRow();

                    row["Cantidad"] = tbxAbono.Text;
                    row["Fecha"]    = DateTime.Today.ToString("dd/MM/yy");

                    if (Total().ToString() == tbxMontoTotal.Text)
                    {
                        Utilitario.ShowToastr(this, "SALDADA", "Mensaje", "success");
                    }
                    else
                    {
                        dt.Rows.Add(row);
                        ViewState["Detalle2"] = dt;
                        ObtenerGridViewAbono();
                    }

                    tbxPendiente.Text = Convert.ToString(Convert.ToSingle(tbxMontoTotal.Text) - (Convert.ToSingle(tbxAbono.Text) + total));
                    tbxAbono.Text     = string.Empty;

                    btnGuardar.Visible = true;
                    tbxAbono.ReadOnly  = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 9
0
        protected void btnBuscarCliente_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            string condicion   = "";
            int    UsuarioCoId = Convert.ToInt32(Session["UsuarioCoId"]);

            if (dropCliente.SelectedValue == "0")
            {
                condicion = " Nombre like '" + tbxBuscar.Text + "%' and UsuarioCoId = " + UsuarioCoId;
            }
            else if (dropCliente.SelectedValue == "1")
            {
                condicion = " Cedula =" + tbxBuscar.Text + "%' and UsuarioCoId = " + UsuarioCoId;
            }
            else if (dropCliente.SelectedValue == "2")
            {
                condicion = " Telefono =" + tbxBuscar.Text + "%' and UsuarioCoId = " + UsuarioCoId;
            }
            else if (dropCliente.SelectedValue == "3")
            {
                condicion = " ClienteId =" + tbxBuscar.Text;
            }

            dt = Utilitario.Lista(" ClienteId,Nombre,Telefono,Cedula,Direccion ", " from Cliente ", " where " + condicion + " and Estado =1");

            if (dt.Rows.Count > 0)
            {
                gridCliente.DataSource = dt;
                gridCliente.DataBind();
                lblNoEncontrado.Visible = false;
            }
            else
            {
                Utilitario.ShowToastr(this, "NO SE ENCONTRARON RESULTADO", "Mensaje", "error");
                lblNoEncontrado.Visible = true;
                gridCliente.DataSource  = null;
                gridCliente.DataBind();
            }
        }
Esempio n. 10
0
        public Utilitario Buscar(string matricula, bool chequearNull)
        {
            perUtilitario pu = new perUtilitario();

            Utilitario utilitario = pu.Buscar(matricula);

            if (utilitario == null)
            {
                negAuto negAuto = new negAuto();
                Auto    auto    = negAuto.Buscar(matricula, false);
                if (auto != null)
                {
                    throw new Exception("La matrícula ingresada pertenece a un auto.");
                }
                else if (chequearNull && utilitario == null && auto == null)
                {
                    throw new Exception("No existe el utilitario.");
                }
            }

            return(utilitario);
        }
Esempio n. 11
0
        public List <EstruturaPresenca> RelatorioPresencas(string dataInicial, string dataFinal, int AssinaturaTipo, int ano)
        {
            List <EstruturaPresenca> relatorioCompleto = new List <EstruturaPresenca>();

            BD bd = new BD();

            try
            {
                string     relatorio     = @"rel_PresencasAssinaturas {0} , {1} , '{2}' ";
                List <int> res           = BuscarApresentacoesAcessoCadastrado(bd, dataInicial, dataFinal, AssinaturaTipo, ano);
                string     apresentacoes = Utilitario.ArrayToString(res.ToArray());

                relatorio = string.Format(relatorio, AssinaturaTipo, ano, apresentacoes);

                while (bd.Consulta(relatorio).Read())
                {
                    EstruturaPresenca ln = new EstruturaPresenca();

                    ln.ApresentacaoID      = bd.LerInt("ApresentacaoID");
                    ln.Assinantes          = bd.LerInt("Assinantes");
                    ln.Avulsas             = bd.LerInt("Avulsas");
                    ln.CapacidadeSala      = bd.LerInt("CapacidadeSala");
                    ln.Cortesias           = bd.LerInt("Cortesias");
                    ln.DataApresentacao    = bd.LerDateTime("Horario");
                    ln.PublicoPrevisto     = bd.LerInt("PublicoPrevisto");
                    ln.PresencasAssinantes = bd.LerInt("PresencasAssinantes");
                    ln.PresencasAvulsas    = bd.LerInt("PresencasAvulsas");
                    ln.PresencasCortesias  = bd.LerInt("PresencasCortesias");
                    relatorioCompleto.Add(ln);
                }
            }
            catch { }
            finally
            {
                bd.Fechar();
            }

            return(relatorioCompleto);
        }
        public RespuestaComun CrearUsuario(UsuarioModelo oDatosUsuario, string accion)
        {
            RespuestaComun respuesta = new RespuestaComun();

            try
            {
                Dictionary <string, object> parametros = new Dictionary <string, object>
                {
                    { "us_nombre", oDatosUsuario.Nombres },
                    { "us_apellido", oDatosUsuario.Apellidos },
                    { "us_numero_identificacion", "1722993324" },
                    { "us_usuario", "cardenasma" },
                    { "us_correo_electronico", oDatosUsuario.Correo },
                    { "us_password", oDatosUsuario.Contrasenia },
                };

                //string parametroDatoMetodo = Utilitario.SerializarIdentado(datosMetodo);
                string storeProcedure = string.Empty;
                if (accion == "I")
                {
                    storeProcedure = "spi_crea_usuario_catastro";
                }
                else if (accion == "M")
                {
                    storeProcedure = Enumerador.SpSubServicios.spu_sub_servicio.ObtenerDescripcion();
                }
                else if (accion == "E")
                {
                    storeProcedure = Enumerador.SpSubServicios.spd_sub_servicio.ObtenerDescripcion();
                }
                respuesta = gestionConexiones.EjecutaStoreProcedure(Utilitario.SerializarIdentado(parametros), string.Empty, storeProcedure);
            }
            catch (Exception ex)
            {
                //respuesta = conexionGestion.AsignarDatosRespuesta(Enumerador.EnumTipoRespuesta.ErrorException, Constantes.RESPUESTA_MENSAJE_ERROR);
                //UtilitarioLogs.PreparaGuardaLogsBase(ex, Enumerador.EnumTipoRespuesta.ErrorException, datosMetodo);
            }
            return(respuesta);
        }
Esempio n. 13
0
        public static async Task <string> PostRestAsync <T>(string controladorAccion, object objeto, string token)
        {
            string strJson = string.Empty;

            using (HttpClient oClienteHttp = ConfigurarClienteHttp(token))
            {
                HttpResponseMessage oRespuesta = new HttpResponseMessage();
                string postCuerpo = Utilitario.SerializarIdentado(objeto);

                try
                {
                    oRespuesta = await oClienteHttp.PostAsync(controladorAccion, new StringContent(postCuerpo, Encoding.UTF8, "application/json"));

                    oRespuesta = ManejarRespuesta(oRespuesta);
                    if (oRespuesta.IsSuccessStatusCode)
                    {
                        strJson = oRespuesta.Content.ReadAsStringAsync().Result;
                    }
                    else
                    {
                        throw new Exception(string.Format(CultureInfo.CurrentCulture, "{0} | {1} | {2}", oRespuesta.ReasonPhrase, oRespuesta.RequestMessage.ToString(), oRespuesta.StatusCode.ToString()));
                    }
                }
                catch (Exception ex)
                {
                    oRespuesta.StatusCode   = System.Net.HttpStatusCode.InternalServerError;
                    oRespuesta.ReasonPhrase = ex.Message.Replace("\r\n", "").Replace("\n", "").Replace("\r", "");
                    RespuestaComun respuesta = new RespuestaComun();
                    respuesta.Codigo         = Constantes.CODIGO_ERROR_GENERICO;
                    respuesta.Mensaje        = Constantes.MENSAJE_ERROR_GENERICO;
                    respuesta.MensajeInterno = Constantes.MENSAJE_ERROR_GENERICO;
                    strJson = Utilitario.SerializarIdentado(respuesta);

                    //LogModelo modLog = Utilitario.PreparaGuardaLogsBase(ex, Enumerador.EnumTipoRespuesta.ErrorException, ObtieneDatosMetodo(controladorAccion, postCuerpo));
                    //await oClienteHttp.PostAsync("Logs/GestionarLogException", new StringContent(Utilitario.SerializarIdentado(modLog), Encoding.UTF8, "application/json"));
                }
                return(strJson);
            }
        }
Esempio n. 14
0
        public void ActualizarDatos()
        {
            Prestamo pre        = new Prestamo();
            int      UsuarioId  = Convert.ToInt32(Session["UsuarioCoId"]);
            string   FechaCorte = "";

            pre.UsuarioCoId = UsuarioId;
            pre.PrestamoId  = Convert.ToInt32(tbxPrestamo.Text);
            pre.Estado      = 1;
            pre.Buscar(pre.PrestamoId);

            FechaCorte     = Utilitario.FormatoFecha(GenerarFechaProximoCorte(pre.FechaCorte, pre.Cuota, Utilitario.ObtenerIdUsuarioAdm(UsuarioId)));
            pre.FechaCorte = FechaCorte;

            pre.ActualizarFechaCorte();
            pre.ActualizarEstado();



            //GENERARLE LA FECHA QUE REGISTROCORTE AL PRESTAMO Y LLEVARSELA A QUE ABONE ESA MISMA FECHA DE CORTE;
            //CREO QUE HAY QUE HACER OTRA FUNCION CORTE PARA ESTE CASO
        }
Esempio n. 15
0
        protected void btnBuscarCliente_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            string condicion = "";

            if (dropCliente.SelectedValue == "0")
            {
                condicion = " C.Nombre like '" + tbxBuscar.Text + "%'";
            }
            else if (dropCliente.SelectedValue == "1")
            {
                condicion = " C.Cedula =" + tbxBuscar.Text;
            }
            else if (dropCliente.SelectedValue == "2")
            {
                condicion = " C.Telefono =" + tbxBuscar.Text;
            }
            else if (dropCliente.SelectedValue == "3")
            {
                condicion = " P.ClienteId =" + tbxBuscar.Text;
            }

            dt = Utilitario.Lista(" P.ClienteId,P.PrestamoId, C.Nombre, C.Telefono,C.Cedula,P.Total  ", " from Cliente as C inner join Prestamo as P on P.ClienteId = C.ClienteId inner join UsuarioCo as Co on Co.UsuarioCoId  = P.UsuarioCoId inner join Usuario as U on U.UsuarioId = Co.UsuarioId ", " where " + condicion + " and P.Estado >=1 and P.Estado<=3 and Co.UsuarioCoId = " + Session["UsuarioCoId"]);

            if (dt.Rows.Count > 0)
            {
                gridCliente.DataSource = dt;
                gridCliente.DataBind();
                lblNoEncontrado.Visible = false;
            }
            else
            {
                Utilitario.ShowToastr(this, "NO SE ENCONTRARON RESULTADO", "Mensaje", "error");
                lblNoEncontrado.Visible = true;
                div1.Visible            = false;
                LimpiarBuscarCliente();
            }
        }
Esempio n. 16
0
        private void GerarMockadoLista()
        {
            try
            {
                XDocument document = XDocument.Load("MockadoXML/Condicao.xml");
                foreach (var item in document.Descendants("CONDICAO"))
                {
                    var condicao = new CondicaoModel();
                    condicao.Bandeira      = Utilitario.GetValueFromListXMLElement(item.Descendants().ToList(), "BANDEIRA");
                    condicao.Internacional = Utilitario.GetValueFromListXMLElement(item.Descendants().ToList(), "INTERNACIONAL");
                    condicao.Debito        = Utilitario.GetValueFromListXMLElement(item.Descendants().ToList(), "DEBITO");
                    ListaCondicoes.Add(condicao);
                }

                Nome = Utilitario.GetSubElementValue(document, "NOME_DOCUMENTO", "NOME");
                Data = Utilitario.GetSubElementValue(document, "NOME_DOCUMENTO", "DATA");
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 17
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            NuevaAsignatura = new Asignaturas()
            {
                Asignatura = txtAsignatura.Text.Trim()
            };

            if (!Utilitario.EsValido(this.grpBox, NuevaAsignatura) || !asignaturaValidacion)
            {
                return;
            }

            try
            {
                var insetar = Utilitario.Pregunta("¿Desea realmente insertar esta asignatura?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (insetar == DialogResult.Yes)
                {
                    Cursor = Cursors.WaitCursor;
                    AsignaturasBD.Agregar(NuevaAsignatura);
                    NuevaAsignatura = new Asignaturas();
                    Utilitario.LimpiarCampos(this.grpBox);

                    var respuesta = Utilitario.Pregunta("Asignatura insertado correctamente." + Environment.NewLine + "¿Desea insertar otra asignatura?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (respuesta == DialogResult.No)
                    {
                        btnCancelar.PerformClick();
                    }
                }
            }
            catch (Exception)
            {
                Utilitario.Mensaje("Error al insertar asignatura", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Cursor = Cursors.Arrow;
        }
Esempio n. 18
0
        public ResultadoEjecucion Activar(ProveedorDao solicitudDao)
        {
            String              procedimiento      = ProcedimientoMantenimiento;
            Boolean             indicadorResultado = true;
            ProveedorDao        resultadoDao       = new ProveedorDao();
            ResultadoEjecucion  resultado          = new ResultadoEjecucion();
            List <ParametroDao> parametros         = new List <ParametroDao>();

            try
            {
                parametros.Add(new ParametroDao {
                    NombreParametro = "@pTipoOperacionMantenimiento", ValorParametro = TipoOperacionMantenimiento.Eliminar, TipoDato = DbType.Int16
                });
                parametros.Add(new ParametroDao {
                    NombreParametro = "@pCodigoProveedor", ValorParametro = solicitudDao.NombreProveedor, TipoDato = DbType.Byte
                });

                indicadorResultado = Utilitario.EjecutarProcedimiento(procedimiento, parametros);

                if (!indicadorResultado)
                {
                    //Validar que se generó un error al eliminar
                }
            }
            catch (Exception ex)
            {
                resultado = new ResultadoEjecucion()
                {
                    CodigoError         = -1,
                    MensajeErrorTecnico = "[" + CapaEjecucion.DAT.ToString() + "] " +
                                          "[ProveedorDat.Activar()] " +
                                          ex.Message,
                    MensajeErrorUsuario = String.Empty
                };
            }

            return(resultado);
        }
Esempio n. 19
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            NuevoHorario = new Horarios()
            {
                Horario = txtHorario.Text.Trim(),
            };

            if (!Utilitario.EsValido(this.formulario, NuevoHorario) || !horarioValidacion)
            {
                return;
            }

            try
            {
                var insetar = Utilitario.Pregunta("¿Desea realmente insertar este horario?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (insetar == DialogResult.Yes)
                {
                    Cursor = Cursors.WaitCursor;
                    HorariosBD.Agregar(NuevoHorario);
                    NuevoHorario = new Horarios();
                    Utilitario.LimpiarCampos(this);

                    var respuesta = Utilitario.Pregunta("Horario insertado correctamente." + Environment.NewLine + "¿Desea insertar otro horario?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (respuesta == DialogResult.No)
                    {
                        btnCancelar.PerformClick();
                    }
                }
            }
            catch (Exception)
            {
                Utilitario.Mensaje("Error al insertar el horario", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Cursor = Cursors.Arrow;
        }
Esempio n. 20
0
        public Utilitario Buscar(string matricula)
        {
            Conexion.Conectar();

            SqlCommand cmd = new SqlCommand("BuscarUtilitario", Conexion.cnn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add(new SqlParameter("Matricula", matricula));

            SqlDataReader dr = cmd.ExecuteReader();

            Utilitario utilitario = null;

            while (dr.Read())
            {
                utilitario = new Utilitario(dr["matricula"].ToString(), dr["marca"].ToString(), dr["modelo"].ToString(), Convert.ToInt32(dr["anio"].ToString()), Convert.ToInt32(dr["cantidad_puertas"].ToString()), Convert.ToDecimal(dr["costo_diario"].ToString()), Convert.ToInt32(dr["capacidad_carga"].ToString()), dr["tipo"].ToString());
            }

            Conexion.Desconectar();

            return(utilitario);
        }
        public async Task <IActionResult> GetQuoteService()
        {
            List <QuoteData> list = new List <QuoteData>();

            try
            {
                list = _quote.GetQuoteService();
                list = list.OrderBy(s => s.date).ToList();
                list = new Utilitario().CalcPercent(list);
            }
            catch (Exception ex)
            {
            }

            if (list.Count == 0)
            {
                return(NoContent());
            }
            else
            {
                return(Ok(list));
            }
        }
Esempio n. 22
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                Herramienta h = new Herramienta();


                if (tbxCodigo.Text == string.Empty)
                {
                    if (InsertarHerramienta())
                    {
                        Utilitario.ShowToastr(this, "Guardado", "Mensaje", "success");
                        Response.Redirect("~/Consulta/MenuAdm.aspx");
                    }
                    else
                    {
                        Utilitario.ShowToastr(this, "Error", "Mensaje", "error");
                    }
                }
                else
                {
                    if (ActualizarHerramienta(2))
                    {
                        Utilitario.ShowToastr(this, "Actualizado", "Mensaje", "success");
                        Response.Redirect("~/Consulta/MenuAdm.aspx");
                    }
                    else
                    {
                        Utilitario.ShowToastr(this, "Error no se guardo un dato", "Mensaje", "error");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 23
0
        private string MontarFiltro(string Doador, string Resgate, string ApresentacaoInicio, string ApresentacaoFim)
        {
            StringBuilder stb    = new StringBuilder();
            string        filtro = string.Empty;

            if (!string.IsNullOrEmpty(Doador) && string.IsNullOrEmpty(Resgate))
            {
                stb.AppendFilter("((Acao = 'D' AND Cliente LIKE '%" + Doador.ToSafeString() + "%') OR Acao = 'R') ");
            }

            if (!string.IsNullOrEmpty(Resgate))
            {
                stb.AppendFilter("((Acao = 'R' AND Cliente LIKE '%" + Resgate.ToSafeString() + "%') OR Acao = 'D') ");
            }

            if (!string.IsNullOrEmpty(ApresentacaoInicio))
            {
                if (!Utilitario.IsDateTime(ApresentacaoInicio, "dd/MM/yyyy"))
                {
                    throw new Exception("Preencha o campo Horário Inicial corretamente");
                }

                stb.AppendFilter("Horario > '" + DateTime.ParseExact(ApresentacaoInicio.Replace("/", ""), "ddMMyyyy", null, System.Globalization.DateTimeStyles.None).ToString("yyyyMMdd") + "000000'");
            }

            if (!string.IsNullOrEmpty(ApresentacaoFim))
            {
                if (!Utilitario.IsDateTime(ApresentacaoFim, "dd/MM/yyyy"))
                {
                    throw new Exception("Preencha o campo Horário Final corretamente");
                }

                stb.AppendFilter("Horario < '" + DateTime.ParseExact(ApresentacaoFim.Replace("/", ""), "ddMMyyyy", null, System.Globalization.DateTimeStyles.None).AddDays(1).ToString("yyyyMMdd") + "000000'");
            }

            return(stb.ToString());
        }
Esempio n. 24
0
        public List <Vehiculo> Buscar(string matricula)
        {
            List <Vehiculo> lista = new List <Vehiculo>();

            Conexion.Conectar();
            SqlCommand cmd = new SqlCommand("BuscarAuto", Conexion.cnn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("matricula", matricula));

            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Auto objAuto = new Auto(dr["matricula"].ToString(), dr["marca"].ToString(), dr["modelo"].ToString(), Convert.ToInt32(dr["anio"].ToString()), Convert.ToInt32(dr["cantidad_puertas"].ToString()), Convert.ToDecimal(dr["costo_diario"].ToString()), dr["tipo_anclaje"].ToString());
                lista.Add(objAuto);
            }

            Conexion.Desconectar();
            Conexion.Conectar();

            cmd             = new SqlCommand("BuscarUtilitario", Conexion.cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("matricula", matricula));

            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Utilitario objUtilitario = new Utilitario(dr["matricula"].ToString(), dr["marca"].ToString(), dr["modelo"].ToString(), Convert.ToInt32(dr["anio"].ToString()), Convert.ToInt32(dr["cantidad_puertas"].ToString()), Convert.ToDecimal(dr["costo_diario"].ToString()), Convert.ToInt32(dr["capacidad_carga"].ToString()), dr["tipo"].ToString());
                lista.Add(objUtilitario);
            }

            Conexion.Desconectar();

            return(lista);
        }
Esempio n. 25
0
        public void Modificar(Utilitario utilitario)
        {
            perUtilitario pu = new perUtilitario();

            int r = pu.Modificar(utilitario);

            switch (r)
            {
            case -1:
            {
                throw new Exception("No existe el utilitario.");
            }

            case 0:
            {
                break;
            }

            default:
            {
                throw new Exception("Error desconocido.");
            }
            }
        }
Esempio n. 26
0
        private void Preencher_Combo_Loja()
        {
            try
            {
                if (Root.Permissao.Obter_Permissao_Do_Usuario(Root.Funcionalidades.Usuario_Ativo, Root.Loja_Ativa.ID, this.Name, Acao_Formulario.Alterar_Loja_Ativa.ToString()))
                {
                    Utilitario.Preencher_ComboBox_Lojas_Ativas(ref this.cboLoja, Utilitario.Colunas_Loja.Lojas_Tipo, "Loja", true, "Todas", true, Root.Loja_Ativa.ID);
                }
                else
                {
                    Utilitario.Preencher_ComboBox_Lojas_Ativas(ref this.cboLoja, Utilitario.Colunas_Loja.Lojas_Tipo, "Loja", false, string.Empty, true, Root.Loja_Ativa.ID);
                }

                if (((DataTable)this.cboLoja.DataSource).Select("Lojas_ID=" + Root.Loja_Ativa.ID.ToString()).Length == 0)
                {
                    ((UtilidadesForm) new UtilidadesForm()).DesabilitaForm(this);
                    MessageBox.Show("O cadastro não pode ser aberto na loja " + ((LojasDO)Root.Loja_Ativa_NEW).Nome + ". Faça o login com outra loja.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 public void Titulo()
 {
     Utilitario.Mensagem("Aprendeno string...");
 }
 public void Titulo()
 {
     Utilitario.Mensagem("Aprendendo if else");
 }
        public object RelatorioRecebimentoPeriodo(int assinaturaTipoID, int temporada, EnumFiltro filtro, string DataInicial, string DataFinal)
        {
            try
            {
                DateTime dataInicial = DateTime.MaxValue;
                DateTime dataFinal   = DateTime.MaxValue;


                if (filtro == EnumFiltro.Mensal)
                {
                    if (!string.IsNullOrEmpty(DataInicial) && Utilitario.IsDateTime(DataInicial, "dd/MM/yyyy"))
                    {
                        var mesInicial = DataInicial.Split('/');
                        mesInicial[0] = "01";
                        dataInicial   = DateTime.ParseExact(mesInicial[0] + mesInicial[1] + mesInicial[2], "ddMMyyyy", System.Globalization.CultureInfo.InvariantCulture);
                    }

                    if (!string.IsNullOrEmpty(DataFinal) && Utilitario.IsDateTime(DataFinal, "dd/MM/yyyy"))
                    {
                        var mesFinal = DataFinal.Split('/');
                        mesFinal[0] = "01";
                        string anoNovo = (Convert.ToInt32(mesFinal[2]) + 1).ToString();
                        mesFinal[2] = mesFinal[1] == "12" ? anoNovo : mesFinal[2];

                        int mesNovo = Convert.ToInt32(mesFinal[1]) + 1;
                        mesFinal[1] = mesFinal[1] == "12" ? "01" : mesNovo > 9 ? mesNovo.ToString() : "0" + mesNovo;

                        dataFinal = DateTime.ParseExact(mesFinal[0] + mesFinal[1] + mesFinal[2], "ddMMyyyy", System.Globalization.CultureInfo.InvariantCulture).AddDays(-1);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(DataInicial) && Utilitario.IsDateTime(DataInicial, "dd/MM/yyyy"))
                    {
                        dataInicial = DateTime.ParseExact(DataInicial.Replace("/", ""), "ddMMyyyy", System.Globalization.CultureInfo.InvariantCulture);
                    }

                    if (!string.IsNullOrEmpty(DataFinal) && Utilitario.IsDateTime(DataFinal, "dd/MM/yyyy"))
                    {
                        dataFinal = DateTime.ParseExact(DataFinal.Replace("/", ""), "ddMMyyyy", System.Globalization.CultureInfo.InvariantCulture).AddDays(1);
                    }
                }


                string strDataInicial = dataInicial.ToString("yyyyMMddHHmmss");

                string strDataFinal = dataFinal.ToString("yyyyMMddHHmmss");



                switch (filtro)
                {
                case EnumFiltro.Mensal:
                    bd.Consulta("EXEC TotalFinanceiroPorSerieFormaPagamentoDataPorData " + assinaturaTipoID + ", 0, '" + temporada + "' , '" + strDataInicial + "' , '" + strDataFinal + "'");
                    break;

                case EnumFiltro.PorData:
                    bd.Consulta("EXEC TotalFinanceiroPorSerieFormaPagamentoDataPorData " + assinaturaTipoID + ", 1, '" + temporada + "' , '" + strDataInicial + "' , '" + strDataFinal + "'");
                    break;

                default:
                    throw new Exception("Filtro inválido!");
                }

                if (!bd.Consulta().Read())
                {
                    throw new Exception("Não existem resultados a serem exibidos.");
                }

                switch (filtro)
                {
                case EnumFiltro.Mensal:
                    return(this.FiltroMensal(dataInicial, dataFinal));

                case EnumFiltro.PorData:
                    return(this.Total());

                default:
                    throw new Exception("Filtro inválido!");
                }
            }
            finally
            {
                bd.Fechar();
            }
        }
Esempio n. 30
0
 public void Titulo()
 {
     Utilitario.Mensagem("Aprendendo a converter dados");
 }