예제 #1
0
 private void CargarBusqueda()
 {
     try
     {
         var estList  = commB.GetList <Estudiante>().Where(p => p.Activo).ToList();
         var cursList = commB.GetList <Curso>().Where(c => c.Activo).ToList();
         if (estList.Count() > 0)
         {
             LocalData.searchEstudiantesList =
                 commB.GetEstudiantesSearchDtos(estList);
         }
         else
         {
             btnBuscarEstudiante.Enabled = false;
         }
         if (cursList.Count() > 0)
         {
             LocalData.searchCursosHorariosList =
                 commB.GetCursosHorarioSearchDtos();
         }
         else
         {
             btnBuscarCurso.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
예제 #2
0
 private void Cajas_Load(object sender, EventArgs e)
 {
     //var userB = new GeneralB(ventB.dbCtx);
     try
     {
         var cajListBind = commB.GetBindList <ControlEntity.Caja>();//.ToList();
         cajaBindingSource.DataSource       = cajListBind;
         cajaBindingNavigator.BindingSource = cajaBindingSource;
         //    if (prodListBind.Count > 0)
         //    {
         //        prodBl.searchList = GeneralDataAccess.SetProdSearchList(prodListBind.ToList()); // prepara busqueda
         //    }
         //    else
         //    {
         btnFind.Enabled = false;
         //    }
         var userList = commB.GetList <Usuario>();
         cboUsuarios.DataSource    = userList;
         cboUsuarios.DisplayMember = "Nombre";
         cboUsuarios.ValueMember   = "IdUsuario";
         cboUsuarios.DataBindings.Add("SelectedValue", cajaBindingSource, "IdUsuario", true);
     }
     catch (Exception ex)
     {
         ControlBusiness.BusinessHelpers.General.DoError(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
예제 #3
0
        private void Main_Load(object sender, EventArgs e)
        {
            Text += " - " + Tools.UserCredentials.UserName.Trim();
            SetMenu();
            confirmarSalirToolStripMenuItem.Checked = PromptOnExit;
            var selectedParameter = commB.GetList <Parametro>();

            toolStripStatusLabel1.Text = selectedParameter.FirstOrDefault().Nombre;
            if (!string.IsNullOrEmpty(selectedParameter.FirstOrDefault().RutaLogo))
            {
                if (File.Exists(selectedParameter.FirstOrDefault().RutaLogo))
                {
                    BackgroundImage = new Bitmap(selectedParameter.FirstOrDefault().RutaLogo);
                }
            }
        }
예제 #4
0
 private void ClientesMant_Load(object sender, EventArgs e)
 {
     try
     {
         var clieList = commB.GetBindList <Cliente>();//.ToList();
         clienteBindingSource.DataSource       = clieList;
         clienteBindingNavigator.BindingSource = clienteBindingSource;
         if (clieList.Count > 0)
         {
             ControlBusiness.BusinessHelpers.LocalData.searchClientesList =
                 credB.SetClienteSearchList(clieList.ToList()); // prepara busqueda
         }
         else
         {
             btnFind.Enabled = false;
         }
         var frecList = commB.GetList <ControlEntity.FrecuenciasPago>();
         idFrecuenciaPagoComboBox.DataSource    = frecList;
         idFrecuenciaPagoComboBox.DisplayMember = "Descripcion";
         idFrecuenciaPagoComboBox.ValueMember   = "IdFrecuenciaPago";
         idFrecuenciaPagoComboBox.DataBindings.Add("SelectedValue", clienteBindingSource, "IdFrecuenciaPago", true);
     }
     catch (Exception ex)
     {
         ControlBusiness.BusinessHelpers.General.DoError(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
예제 #5
0
        private void CargarFrecuencias()
        {
            var frecsList = commB.GetList <ControlEntity.FrecuenciasPago>();

            if (frecsList.Count() > 0)
            {
                cboFrecuencias.DataSource    = frecsList;
                cboFrecuencias.DisplayMember = "Descripcion";
                cboFrecuencias.ValueMember   = "IdFrecuenciaPago";
            }
            else
            {
                MessageBox.Show("No están definidas las frecuancias de pago para el crédito");
                cboFormasPago.Items.Remove("Credito");
                cboFrecuencias.Enabled = false;
            }
        }
예제 #6
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            ReportDataSource reportDataSource1 = new ReportDataSource();

            //this.bindingSource1.DataSource = typeof(CursosEntities.Entities.Curso);
            reportDataSource1.Name  = "DataSet1";
            reportDataSource1.Value = this.bindingSource1;
            var viewer = new Reports.ReportViewer();

            viewer.reportViewer1.LocalReport.DataSources.Add(reportDataSource1);
            viewer.reportViewer1.LocalReport.ReportEmbeddedResource = "Cursos.Presentation.Reports.Cursos.Cursos.rdlc";
            try
            {
                //var query = from u in commB.GetList<Curso>()
                //                select u;
                var query = commB.ReporteCursosDtos();
                if (!string.IsNullOrEmpty(txtIdCurso.Text))
                {
                    query = query.Where(q => q.IdCurso == Convert.ToInt32(txtIdCurso.Text));
                }
                if (!string.IsNullOrEmpty(txtIdProfesor.Text))
                {
                    query = query.Where(q => q.IdProfesor == Convert.ToInt32(txtIdProfesor.Text));
                }
                if (!string.IsNullOrEmpty(txtIdEstudiante.Text))
                {
                    query = query.Where(q => q.IdEstudiante == Convert.ToInt32(txtIdEstudiante.Text));
                }
                List <CursosDtos.ReporteCursosList> ls = query.ToList();
                //foreach (var item in ls)
                //{
                //    Debug.WriteLine(item.NombreCurso);
                //}
                List <ReportParameter> paramList = new List <ReportParameter>();
                string parameterNombre           = commB.GetList <Parametro>().FirstOrDefault().Nombre;
                paramList.Add(new ReportParameter("pParametrosNombre", @parameterNombre));
                viewer.reportViewer1.LocalReport.SetParameters(paramList);
                bindingSource1.DataSource = ls;
                viewer.ShowDialog();
                viewer.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
        private void CargarBusqueda()
        {
            try
            {
                var horaList = commB.GetList <Horario>().ToList();
                var cursList = commB.GetList <Curso>().Where(c => c.Activo).ToList();
                var aulaList = commB.GetList <Aula>().Where(a => a.Disponible).ToList();

                if (horaList.Count() > 0)
                {
                    LocalData.searchHorariosList =
                        commB.GetHorariosSearchDtos(horaList);
                }
                else
                {
                    btnBuscaHorario.Enabled = false;
                }

                if (cursList.Count() > 0)
                {
                    LocalData.searchCursosList =
                        commB.GetCursosSearchDtos(cursList);
                }
                else
                {
                    btnBuscaCurso.Enabled = false;
                }

                if (aulaList.Count() > 0)
                {
                    LocalData.searchAulasList =
                        commB.GetAulasSearchDtos(aulaList);
                }
                else
                {
                    btnBuscaAula.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
예제 #8
0
        private void SeguRestauraForm_Load(object sender, EventArgs e)
        {
            string parameterRutaSistema = commB.GetList <Parametro>().FirstOrDefault().RutaSistema;

            if (!string.IsNullOrWhiteSpace(parameterRutaSistema))
            {
                txtPath.Text = parameterRutaSistema.Trim() + "\\Cursos.bak";
            }
            else
            {
                txtPath.Text = Path.GetDirectoryName(Application.ExecutablePath) + "\\Cursos.bak";
            }
        }
예제 #9
0
        private void ProductosForm_Load(object sender, EventArgs e)
        {
            try
            {
                var prodListBind = commB.GetBindList <Producto>();
                productoBindingSource.DataSource       = prodListBind;
                productoBindingNavigator.BindingSource = productoBindingSource;

                if (prodListBind.Count > 0)
                {
                    ControlBusiness.BusinessHelpers.LocalData.prodSearchList = inventB.SetProdSearchList(prodListBind.ToList());
                }
                else
                {
                    btnFind.Enabled = false;
                }
                var provListBind = commB.GetBindList <Proveedore>();
                cboProveedores.DataSource    = provListBind;
                cboProveedores.DisplayMember = "Descripcion";
                cboProveedores.ValueMember   = "IdProveedor";
                cboProveedores.DataBindings.Add("SelectedValue", productoBindingSource, "IdProveedor", true);

                var catList = commB.GetList <Categoria>();
                cboCategorias.DataSource    = catList;
                cboCategorias.DisplayMember = "Descripcion";
                cboCategorias.ValueMember   = "IdCategoria";
                cboCategorias.DataBindings.Add("SelectedValue", productoBindingSource, "IdCategoria", true);

                var uniList = commB.GetList <UnidadesMedida>();
                cboUnidadesMedidas.DataSource    = uniList;
                cboUnidadesMedidas.DisplayMember = "Descripcion";
                cboUnidadesMedidas.ValueMember   = "IdUnidadMedida";
                cboUnidadesMedidas.DataBindings.Add("SelectedValue", productoBindingSource, "IdUnidadMedida", true);
            }
            catch (Exception ex)
            {
                ControlBusiness.BusinessHelpers.General.DoError(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
 private void CargarBusqueda()
 {
     try
     {
         var profList = commB.GetList <Profesore>().Where(p => p.Activo).ToList();
         if (profList.Count() > 0)
         {
             LocalData.searchProfesoresList =
                 commB.GetProfesoresSearchDtos(profList);
         }
         else
         {
             btnBuscaProfesor.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
예제 #11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
            this.UsuarioBindingSource.DataSource = typeof(ControlEntity.Usuario);
            reportDataSource1.Name  = "DataSet1";
            reportDataSource1.Value = this.UsuarioBindingSource;
            this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1);
            this.reportViewer1.LocalReport.ReportEmbeddedResource = "ReportTest.Report1.rdlc";

            try
            {
                var userListBind = commB.GetList <Usuario>();

                UsuarioBindingSource.DataSource = userListBind;

                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }
        }
예제 #12
0
        private void okButton1_Click(object sender, EventArgs e)
        {
            //var StrSql = "select * " +
            //    "from general.Usuarios Order By IdUsuario";
            /// linq query
            /// to datatable
            //var DtUsuarios = AdoDataMethods.CreateDataTable(ConfigurationManager.ConnectionStrings["ControlEntities"].ConnectionString,
            //    StrSql, "DtUsuarios");
            var usuarios   = commB.GetList <Usuario>();
            var DtUsuarios = usuarios.AsDataTable();

            DtUsuarios.TableName = "Usuarios";
            //var StrSqlDetail = "select * " +
            //    "from general.Bitacora Order By IdUsuario";
            //var DtBitacoras = AdoDataMethods.CreateDataTable(ConfigurationManager.ConnectionStrings["ControlEntities"].ConnectionString,
            //    StrSqlDetail, "DtBitacoras");

            var FormViewer = new Reports.ReportForm
            {
                ReportPath  = "ControlApp.Reports.General.Usuarios.rdlc",
                CurrentData = DtUsuarios,
                SourceName  = "DataSet1",
                //bindingSource1.DataSource = usuarios,
                //bindingSource1.DataMember = "Usuarios"
            };

            ////el parametro debe existir y permitir valores nulll
            //var MyParams = new Hashtable { { "pReport", "repClientes" } };
            //FormViewer.Parameters = MyParams;
            //// handler para el subreporte
            //FormViewer.SubSourceName = "DsBitacoras";
            //FormViewer.SubCurrentData = DtBitacoras;
            ////FormViewer.reportViewer1.LocalReport.SubreportProcessing +=
            ////    new SubreportProcessingEventHandler(FormViewer.SubreportProcessingEventHandler);
            FormViewer.ShowDialog();
        }
예제 #13
0
        static void Main(string[] args)
        {
            //respaldos como tarea de windows
            // para probarlo solo debe ejecutarse y

            /* task scheduler de windows
             * y si quiere que caiga en error, poner breakpoint línea:
             * DirectoryInfo df = new DirectoryInfo(rutaFinal); y alterar el valor del
             * directorio destino del backup
             * get cadena de conexion
             */
            CommonB biz  = new CommonB();
            var     conn = biz.GetConnection();
            // get parametros
            var cursosParams = biz.GetList <Parametro>().FirstOrDefault();
            // get ruta de parametros
            var parameterRutaSistema = cursosParams.RutaSistema;

            // get config for email
            port                  = cursosParams.PortCorreo;
            timeout               = cursosParams.TimeOutCorreo;
            host                  = cursosParams.HostCorreo;
            fromEmail             = cursosParams.FromCorreo;
            displayName           = cursosParams.DisplayNameCorreo;
            userName              = cursosParams.UserNameCorreo;
            password              = cursosParams.PasswordCorreo;
            destinoCorreoRespaldo = cursosParams.CorreoContactoRespaldos;
            var rutaFinal = "";

            if (!string.IsNullOrWhiteSpace(parameterRutaSistema))
            {
                rutaFinal = parameterRutaSistema.Trim();
            }
            else
            {
                rutaFinal = Path.GetDirectoryName(Directory.GetCurrentDirectory());
            }
            //verficiar que exista ruta
            var strBackup = "BACKUP DATABASE [Cursos] TO  DISK = N'" +
                            rutaFinal.Trim() + "\\Cursos.bak' WITH NOFORMAT, INIT,  NAME = N'Cursos-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10";

            if (!string.IsNullOrWhiteSpace(rutaFinal))
            {
                DirectoryInfo df = new DirectoryInfo(rutaFinal);
                try
                {
                    if (df.Exists)
                    {
                        // send backup
                        // usuario de bases de datos debe tener permisos db backupoperator, on user mapping, database role memebership
                        //int count = AdoDataMethods.ExecuteSql(commB.GetConnection(), strBackup);
                        Console.WriteLine("Haciendo respaldo...");
                        int count = AdoDataMethods.ExecuteSql(conn.Trim(), strBackup);
                        //int count = commB.ExecuteSql(strBackup);
                        //MessageBox.Show("Respaldo realizado!", "Backup", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        Console.WriteLine("Error en respaldo, intentanto enviar correo...");
                        SendErrorEmail("El folder seleccionado: " + rutaFinal +
                                       " para hacer los respaldos es inaccesible o no existe, " +
                                       "por favor verifique los parámetros.");

                        //MessageBox.Show("El folder seleccionado es inaccesible o no existe!", "Backup", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    }
                }
                catch (Exception ex)
                {
                    SendErrorEmail("No se puede hacer el respaldo de la base de datos" +
                                   "Cursos. Mensaje: " + ex.Message + System.Environment.NewLine +
                                   "Inner Exception: " + ex.InnerException + Environment.NewLine +
                                   "Stack: " + ex.StackTrace + Environment.NewLine +
                                   "por favor verifique la configuración en la base de datos.");
                    //General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
            //for (int i = 1; i <= 100; i++)
            //{
            //    if (i % 5 == 0 && i % 3 == 0)
            //    {
            //        Console.WriteLine("FizzBuzz");
            //    }
            //    else
            //    {
            //        if (i % 5 == 0)
            //        {
            //            Console.WriteLine("Buzz");
            //        }
            //        else
            //        {
            //            if (i % 3 == 0)
            //            {
            //                Console.WriteLine("Fizz");
            //            }
            //            else
            //            {
            //                Console.WriteLine(i);
            //            }
            //        }
            //    }
            //}

            //string p = "FINISHED FILES ARE THE RE- SULT OF YEARS OF SCIENTIF- IC STUDY COMBINED WITH THE EXPERIENCE OF YEARS ";
            //int total = 0;
            //for (var item=0;item < p.Length; item++)
            //{
            //    if (p[item].Equals("F")) total++;
            //}
            //Console.WriteLine(total);
            // From Data out

            //var oCustomers = obj.GetUsuario("Admin", "2");
            //Console.WriteLine(oCustomers.FirstOrDefault().Nombre);
            // Data in

            //GeneralB obj2 = new GeneralB();
            //obj2.CustomerCode = "c001";
            //obj2.CustomerName = "Shivprasad";
            //Console.ReadLine();

            /// test wcf host
            //RunService();


            ///// test wcf client
            //TestService();

            // create xml
            //ExecuteXmlTest1();
            //ExecuteXmlTest2();
            //Console.ReadLine();
        }
        private void ExistenciasForm_Load(object sender, EventArgs e)
        {
            CommonB commB = new CommonB();

            gridExistencias.DataSource = commB.GetList <Existencia>();
        }