Beispiel #1
0
        public List <EPeriodo> getPerBloqueado(string bloqueado)
        {
            List <EPeriodo> lstPeriodos = new List <EPeriodo>();
            string          sql         = "SELECT * FROM bloq_per WHERE bloqueado = '" + bloqueado + "'  AND periodo <> '00' ORDER BY periodo";

            using (conexion cnx = new conexion())
            {
                cnx.cadena = Configuracion.Instanciar.conexionBD();
                using (MySqlCommand cmd = new MySqlCommand())
                {
                    cmd.CommandText = sql;
                    cmd.Connection  = cnx.getConexion();

                    if (cnx.abrirConexion())
                    {
                        MySqlDataReader dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            EPeriodo objPer = new EPeriodo();
                            objPer.periodo   = dr.GetString("periodo");
                            objPer.bloqueado = dr.GetChar("bloqueado");
                            lstPeriodos.Add(objPer);
                        }
                        cnx.cerrarConexion();
                    }
                }
            }
            return(lstPeriodos);
        }
Beispiel #2
0
        public string abrirPeriodo(string periodo)
        {
            CompanyDAO cDao = new CompanyDAO();

            if (Inicializar.codCompany.HasValue)
            {
                EPeriodo objPer = cDao.getPeriodo(Inicializar.codCompany);
                int      nReg   = 0;
                if (objPer == null)
                {
                    nReg = cDao.guardarPeriodo(periodo, "Nuevo", Inicializar.codCompany);
                }
                else
                {
                    nReg = cDao.guardarPeriodo(periodo, "Actualizar", Inicializar.codCompany);
                }

                if (nReg > 0)
                {
                    string       ruta       = AppDomain.CurrentDomain.BaseDirectory + "\\" + Inicializar.company + ".txt";
                    StreamWriter swEscritor = new StreamWriter(ruta, false);
                    swEscritor.Write(periodo.Trim());
                    swEscritor.Close();
                    return("Correcto");
                }
                else
                {
                    return("Error al Abrir Periodo.. ");
                }
            }
            else
            {
                return("El período no se pudo abrir porque la compañia no existe, verifique... ");
            }
        }
Beispiel #3
0
        public EPeriodo getPeriodo(int?codigo)
        {
            EPeriodo objPer = null;
            string   sql    = "SELECT * FROM periodos WHERE codigo=" + codigo + "";

            using (conexion cnx = new conexion())
            {
                cnx.cadena = ConfigSAE.Instanciar.cadenaSAE();
                using (MySqlCommand cmd = new MySqlCommand())
                {
                    cmd.CommandText = sql;
                    cmd.Connection  = cnx.getConexion();

                    if (cnx.abrirConexion())
                    {
                        MySqlDataReader dr = cmd.ExecuteReader();
                        if (dr.HasRows == true)
                        {
                            dr.Read();
                            objPer         = new EPeriodo();
                            objPer.activo  = dr.GetString("activo");
                            objPer.codigo  = dr.GetInt16("codigo");
                            objPer.inicio  = dr.GetString("inicio");
                            objPer.periodo = dr.GetString("periodo");
                        }
                        cnx.cerrarConexion();
                    }
                }
            }
            return(objPer);
        }
 public Agendamento(Cliente cliente, DateTime dataHora, EPeriodo periodo, Login login)
 {
     Cliente   = cliente;
     DataHora  = dataHora;
     Periodo   = periodo;
     Login     = login;
     _servicos = new List <Servico>();
     AddNotifications(Cliente, new Contract());
 }
Beispiel #5
0
        public string buscarPeriodo()
        {
            string       mensaje = "";
            PrincipalBLL bllPrin = new PrincipalBLL();
            ECompany     company = buscar();

            if (company == null) // Verificando la Compañia
            {
                mensaje = "El período no se pudo abrir porque la compañia no existe, verifique";
                bllPrin.iniciarPeriodo("(ninguno)");
            }
            else
            {
                string per = llenarPeriodo();
                if (per == "Error")
                {
                    EPeriodo ObjPer = getPeriodo(company.codigo);
                    if (ObjPer == null)
                    {
                        bllPrin.iniciarPeriodo("(ninguno)");
                        mensaje = "No hay periodos usados, Verifique.";
                    }
                    else
                    {
                        bllPrin.iniciarPeriodo(ObjPer.periodo);
                    }

                    // Crear Archivo con el periodo actual
                    try
                    {
                        string       ruta       = AppDomain.CurrentDomain.BaseDirectory + "\\" + Inicializar.company + ".txt";
                        StreamWriter swEscritor = new StreamWriter(ruta, false);
                        swEscritor.Write(Inicializar.periodo.Trim());
                        swEscritor.Close();
                    }
                    catch (Exception ex)
                    {
                        return(ex.Message.ToString());
                    }
                }
                else
                {
                    bllPrin.iniciarPeriodo(per);
                }
                string BDato = "sae" + Inicializar.company.ToLower() + Inicializar.periodo.Substring(3, 4);
                bllPrin.inicializarBD(BDato);
            }
            return(mensaje);
        }
Beispiel #6
0
        public decimal TotalSoportado(EPeriodo periodo)
        {
            decimal total = 0;

            foreach (ModeloInfo item in this)
            {
                switch (periodo)
                {
                case EPeriodo.Anual: total += item.TotalSoportado; break;

                case EPeriodo.Periodo1T: total += item.TotalSoportado1T; break;

                case EPeriodo.Periodo2T: total += item.TotalSoportado2T; break;

                case EPeriodo.Periodo3T: total += item.TotalSoportado3T; break;

                case EPeriodo.Periodo4T: total += item.TotalSoportado4T; break;
                }
            }

            return(total);
        }
Beispiel #7
0
        public decimal Base(EPeriodo periodo)
        {
            decimal total = 0;

            foreach (ModeloInfo item in this)
            {
                switch (periodo)
                {
                case EPeriodo.Anual: total += item.Base; break;

                case EPeriodo.Periodo1T: total += item.Base1T; break;

                case EPeriodo.Periodo2T: total += item.Base2T; break;

                case EPeriodo.Periodo3T: total += item.Base3T; break;

                case EPeriodo.Periodo4T: total += item.Base4T; break;
                }
            }

            return(total);
        }
 private void Periodo_CB_SelectedIndexChanged(object sender, EventArgs e)
 {
     _periodo = (EPeriodo)((long)Periodo_CB.SelectedValue);
     UpdateFechas();
 }