예제 #1
0
        private void bntExport_Click(object sender, EventArgs e)
        {
            //Configuration file header y declare variable;
            string headerCsv, path = string.Empty;

            headerCsv = "Descripcion,Estado,Activo";

            //open dialog and get pathDirectory
            path = Util.OpenSaveFileDialog();

            if (path != null && !string.IsNullOrWhiteSpace(path))
            {
                ExportCsv exportCsv = new ExportCsv(path);
                exportCsv.WriteFileHeader(headerCsv);
                var brands = audiovisualEntities.Brands.ToList();
                foreach (Brand data in brands)
                {
                    //Data to insert into body
                    string linea = string.Format("{0},{1},{2}",
                                                 data.Description,
                                                 data.BrandsState.Description,
                                                 data.Enabled);

                    exportCsv.WriteFileLine(linea);
                }
            }
            ;
        }
예제 #2
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            //Configuration file header y declare variable;
            string headerCsv, path = string.Empty;

            headerCsv = "Nombre,Apellido,Cedula,Turno de trabajo,Fecha de contratación,Estado,Activo";

            //open dialog and get pathDirectory
            path = Util.OpenSaveFileDialog();

            if (path != null && !string.IsNullOrWhiteSpace(path))
            {
                ExportCsv exportCsv = new ExportCsv(path);
                exportCsv.WriteFileHeader(headerCsv);
                var dataToExport = audiovisualEntities.Employees.ToList();
                foreach (Employee data in dataToExport)
                {
                    //Data to insert into body
                    string linea = string.Format("{0},{1},{2},{4},{5},{6}",
                                                 data.FirstName,
                                                 data.LastName,
                                                 data.IdentificationCard,
                                                 data.Workshift,
                                                 data.HiredDate,
                                                 data.EmployeesState.Description,
                                                 data.Enabled
                                                 );

                    exportCsv.WriteFileLine(linea);
                }
            }
            ;
        }
예제 #3
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            //Configuration file header y declare variable;
            string headerCsv, path = string.Empty;

            headerCsv = "Nombre,Apellido,Cedula,Carnet,Tipo de personal,Tipo usuario,Estado,Activo";

            //open dialog and get pathDirectory
            path = Util.OpenSaveFileDialog();

            if (path != null && !string.IsNullOrWhiteSpace(path))
            {
                ExportCsv exportCsv = new ExportCsv(path);
                exportCsv.WriteFileHeader(headerCsv);
                var dataToExport = audiovisualEntities.Users.ToList();
                foreach (User data in dataToExport)
                {
                    //Data to insert into body
                    string linea = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}",
                                                 data.FirstName,
                                                 data.LastName,
                                                 data.IdentificationCard,
                                                 data.Carnet,
                                                 data.PersonalType.Description,
                                                 data.UsersType.Description,
                                                 data.UsersState.Description,
                                                 data.Enabled);

                    exportCsv.WriteFileLine(linea);
                }
            }
            ;
        }
예제 #4
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            //Configuration file header y declare variable;
            string headerCsv, path = string.Empty;

            headerCsv = "Descripcion,Serial,Tag Servicio,Modelo,Marca,Tecnologia Conexion,Estado,Activo";

            //open dialog and get pathDirectory
            path = Util.OpenSaveFileDialog();

            if (path != null && !string.IsNullOrWhiteSpace(path))
            {
                ExportCsv exportCsv = new ExportCsv(path);
                exportCsv.WriteFileHeader(headerCsv);
                var dataToExport = audiovisualEntities.Equiments.ToList();
                foreach (Model.Equiment data in dataToExport)
                {
                    //Data to insert into body
                    string linea = string.Format("{0},{1},{2},{3},{4},{5},{6}",
                                                 data.Description,
                                                 data.Serial,
                                                 data.ServiceTag,
                                                 data.Model.Description,
                                                 data.Brand.Description,
                                                 data.TechnologiesConnection.Description,
                                                 data.EquimentsState.Description
                                                 );

                    exportCsv.WriteFileLine(linea);
                }
            }
            ;
        }