Esempio n. 1
0
        public async Task <List <DVRDto> > PostExcelToDVRInfoAsync(IFormFile files)
        {
            if (files.Length == 0 || Path.GetExtension(files.FileName) != ".xlsx")
            {
                throw new Exception("上传文件格式错误");
                //return null;
            }

            DataTable dt = new DataTable();



            //  var dvr25 = await _dVRAppService.GetListAsync();

            var           data    = ExcelHelper.ExcelToDataTable(files.OpenReadStream(), Path.GetExtension(files.FileName), "Sheet", true);
            var           list    = ListToDataTable.tolist <UpdateDVRDto>(data);
            List <DVRDto> listdvr = new List <DVRDto>();

            foreach (var item in list)
            {
                var dvr = await _dVRAppService.GetListByCondition(null, null, null, item.DVR_ID);

                if (dvr.TotalCount == 0)
                {
                    var dvrdata = await _dVRAppService.CreateAsync(item);

                    listdvr.Add(dvrdata);
                }
            }
            return(listdvr);
        }
Esempio n. 2
0
 public DataTable historial_compras(UEUsuario user, int estado)
 {
     using (var db = new Mapeo("public"))
     {
         var data = (from v in db.ventas
                     from e in db.empre
                     from p in db.productos where v.IdProducto == p.Id &&
                     p.IdEmpresa == e.Id && v.IdUsr == user.IdUsr &&
                     v.EstadoVenta == estado select new vista_Historial_vent {
             idVenta = v.IdVenta,
             fechaVenta = v.FechaVent,
             idUsuario = v.IdUsr,
             fechaEntrega = v.FechaEntr,
             cantVenta = v.Cantidad,
             estadoVenta = v.EstadoVenta,
             valorVenta = v.Valor,
             nomProducto = p.Nombre,
             nomEmpresa = e.Nombre,
             idEmpresa = e.Id,
             calificacionEmpresa = e.Calificacion
         }).Distinct();
         ListToDataTable conv    = new ListToDataTable();
         DataTable       retorno = conv.ToDataTable <vista_Historial_vent>(data.ToList <vista_Historial_vent>());
         return(retorno);
     }
 }
Esempio n. 3
0
        private void Fill()
        {
            DocumentPaymentsLogic payments = new DocumentPaymentsLogic(manager);

            DataGV.AutoGenerateColumns = false;
            ListToDataTable    listToDataTable = new ListToDataTable();
            List <ViewPayment> paymentsList    = new List <ViewPayment>();

            if (documentId == null)
            {
                paymentsList = payments.GetAllViewByPeriod(StartDateDTP.Value, EndDateDTP.Value);
            }
            else
            {
                paymentsList         = payments.GetAllViewByDocumentID(Convert.ToInt32(documentId));
                StartDateDTP.Enabled = false;
                EndDateDTP.Enabled   = false;
            }
            DataGV.DataSource = listToDataTable.ToDataTable <ViewPayment>(paymentsList);
            DgvFilterManager filterManager = new DgvFilterManager(DataGV);

            DataGV.Update();

            SummaryDataGV.AutoGenerateColumns = true;
            var groupResult = from p in paymentsList
                              group p by new { p.FullEmployeeName, p.PaymentTypeName }
            into myGroup
            where myGroup.Count() > 0
            select new { myGroup.Key.FullEmployeeName, myGroup.Key.PaymentTypeName, Count = myGroup.Count(), Suma = myGroup.Sum(a => a.Suma) };

            SummaryDataGV.DataSource = groupResult.ToList();
            SummaryDataGV.Update();
        }
Esempio n. 4
0
        public DataTable GetData()
        {
            var data  = LogDBConnector.GetAll();
            var tabel = ListToDataTable.Convert(data);

            return(tabel);
        }
Esempio n. 5
0
 public DataTable ProductosBajoI(int id_empresa)
 {
     using (var db = new Mapeo("public"))
     {
         var inf = from producto in db.productos
                   join catego in db.categ on producto.Categoria equals catego.Id_cate
                   join empresa in db.empre on producto.IdEmpresa equals empresa.Id
                   where empresa.Id == id_empresa && producto.Estado_producto == 1 && producto.Cantidad <= producto.BajoInventario
                   select new vistaProductoSingle
         {
             nomProducto    = producto.Nombre,
             idProducto     = producto.Id,
             canProducto    = producto.Cantidad,
             precioProducto = producto.Precio,
             desProducto    = producto.Descripcion,
             estadoProducto = producto.Estado_producto,
             bajoInventario = producto.BajoInventario,
             idEmpresa      = producto.IdEmpresa,
             nomCategoria   = catego.nomCategoria,
             nomEmpresa     = empresa.Nombre,
             idCategoria    = producto.Categoria,
             nomArchivo     = empresa.Nombre
         };
         ListToDataTable conv      = new ListToDataTable();
         DataTable       respuesta = conv.ToDataTable <vistaProductoSingle>(inf.ToList <vistaProductoSingle>());
         return(respuesta);
     }
 }
Esempio n. 6
0
        public DataTable MostrarVentasPorEmpresa()
        {
            using (var db = new Mapeo("public"))
            {
                var data = (from empresa in db.empre
                            join producto in db.productos on empresa.Id equals producto.IdEmpresa
                            join venta in db.ventas on producto.Id equals venta.IdProducto
                            where venta.EstadoVenta == 4
                            select new vistaMostraVentByEmp
                {
                    nitEmpresa = empresa.Nit,
                    nomEmpresa = empresa.Nombre,
                    calificacionEmpresa = empresa.Calificacion,
                    valorAux = (from venta in db.ventas
                                where venta.EstadoVenta == 4 && venta.IdProducto == producto.Id &&
                                producto.IdEmpresa == empresa.Id && venta.EstadoVenta == 4 select venta.Valor).Sum(),
                    ventas = (from venta in db.ventas
                              where venta.IdProducto == producto.Id && producto.IdEmpresa == empresa.Id &&
                              venta.EstadoVenta == 4
                              select venta.IdVenta).Count(),
                    rutaArchivo = empresa.RutaArchivo + empresa.NomArchivo
                }).Distinct();
                List <vistaMostraVentByEmp> infList = data.ToList <vistaMostraVentByEmp>();
                foreach (vistaMostraVentByEmp aux in infList)
                {
                    aux.valor = aux.valorAux.ToString("C");
                }

                ListToDataTable conv = new ListToDataTable();
                DataTable       res  = conv.ToDataTable <vistaMostraVentByEmp>(infList);
                return(res);
            }
        }
Esempio n. 7
0
 //METODO PARA TRAER LOS REPORTES
 public DataTable Reportes()
 {
     using (var db = new Mapeo("public"))
     {
         var data = (from Empresa in db.empre
                     join Producto in db.productos on Empresa.Id equals Producto.IdEmpresa
                     join Reporte in db.reporte_T on Producto.Id equals Reporte.idProducto
                     join Usuario in db.user on Reporte.idUsuario equals Usuario.IdUsr
                     join MotivoR in db.report on Reporte.idMotivoR equals MotivoR.IdMoti
                     select new vista_reportesAdministrador
         {
             rutaArchivo = Empresa.RutaArchivo + Empresa.NomArchivo,
             nomEmpresa = Empresa.Nombre,
             nomUsuario = Usuario.NomUsr,
             nomProducto = Producto.Nombre,
             desMotivo = MotivoR.DesMotiv,
             fechaReporte = Reporte.fechaReporte,
             correoEmpresa = Empresa.Correo,
             idProducto = Reporte.idProducto
         });
         List <vista_reportesAdministrador> res = data.ToList <vista_reportesAdministrador>();
         ListToDataTable conv    = new ListToDataTable();
         DataTable       retorno = conv.ToDataTable <vista_reportesAdministrador>(res);
         return(retorno);
     }
 }
Esempio n. 8
0
 //SHOW COMPANY
 public DataTable MostrarEmpresaId(int id)
 {
     using (var db = new Mapeo("public"))
     {
         var data = (from v in db.ventas
                     from e in db.empre
                     from p in db.productos
                     where v.IdProducto == p.Id && p.IdEmpresa == e.Id
                     select new vistaHistorialCompra
         {
             idVenta = v.IdVenta,
             fechaVenta = v.FechaVent,
             idUsuario = v.IdUsr,
             fechaEntrega = v.FechaEntr,
             cantVenta = v.Cantidad,
             estadoVenta = v.EstadoVenta,
             valorVenta = v.Valor,
             nomProducto = p.Nombre,
             nomEmpresa = e.Nombre,
             idEmpresa = e.Id,
             calificacionEmpresa = e.Calificacion
         }).Distinct();
         ListToDataTable conv = new ListToDataTable();
         DataTable       res  = conv.ToDataTable <vistaHistorialCompra>(data.ToList <vistaHistorialCompra>());
         return(res);
     }
 }
Esempio n. 9
0
        /// <summary>
        ///     使用SqlBulkCopy方式插入数据
        /// </summary>
        /// <returns></returns>
        private static void SqlBulkCopyInsert <T>(IList <T> list)
        {
            var ltt       = new ListToDataTable();
            var dataTable = ltt.ConvertTo(list);

            ltt.Dispose();
            var sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["DB"].ConnectionString);

            sqlcon.Open();
            var sqlBulkCopy = new SqlBulkCopy(sqlcon);

            sqlBulkCopy.DestinationTableName = "tg_task";

            if (dataTable != null && dataTable.Rows.Count != 0)
            {
                sqlBulkCopy.ColumnMappings.Add("task_id", "task_id");
                sqlBulkCopy.ColumnMappings.Add("id", "id");
                sqlBulkCopy.ColumnMappings.Add("user_id", "user_id");
                sqlBulkCopy.ColumnMappings.Add("task_type", "task_type");
                sqlBulkCopy.ColumnMappings.Add("task_state", "task_state");
                sqlBulkCopy.ColumnMappings.Add("task_step_type", "task_step_type");
                sqlBulkCopy.ColumnMappings.Add("task_step_data", "task_step_data");
                sqlBulkCopy.ColumnMappings.Add("task_starttime", "task_starttime");
                sqlBulkCopy.ColumnMappings.Add("task_endtime", "task_endtime");
                sqlBulkCopy.ColumnMappings.Add("rid", "rid");
                sqlBulkCopy.ColumnMappings.Add("task_base_identify", "task_base_identify");
                sqlBulkCopy.ColumnMappings.Add("is_lock", "is_lock");
                sqlBulkCopy.ColumnMappings.Add("is_special", "is_special");
                sqlBulkCopy.ColumnMappings.Add("task_coolingtime", "task_coolingtime");
                sqlBulkCopy.WriteToServer(dataTable);
            }
            sqlBulkCopy.Close();
            sqlcon.Close();
            sqlcon.Dispose();
        }
Esempio n. 10
0
        private void Fill()
        {
            DocumentPaymentsLogic payments = new DocumentPaymentsLogic(manager);
            DataGV.AutoGenerateColumns = false;
            ListToDataTable listToDataTable = new ListToDataTable();
            List<ViewPayment> paymentsList = new List<ViewPayment>();
            if (documentId == null)
                paymentsList = payments.GetAllViewByPeriod(StartDateDTP.Value, EndDateDTP.Value);
            else
            {
                paymentsList = payments.GetAllViewByDocumentID(Convert.ToInt32(documentId));
                StartDateDTP.Enabled = false;
                EndDateDTP.Enabled = false;
            }
            DataGV.DataSource = listToDataTable.ToDataTable<ViewPayment>(paymentsList);
            DgvFilterManager filterManager = new DgvFilterManager(DataGV);
            DataGV.Update();

            SummaryDataGV.AutoGenerateColumns = true;
            var groupResult = from p in paymentsList
                              group p by new { p.FullEmployeeName, p.PaymentTypeName }
                                  into myGroup
                                  where myGroup.Count() > 0
                                  select new { myGroup.Key.FullEmployeeName, myGroup.Key.PaymentTypeName, Count = myGroup.Count(), Suma = myGroup.Sum(a => a.Suma) };
            SummaryDataGV.DataSource = groupResult.ToList();
            SummaryDataGV.Update();
        }
Esempio n. 11
0
        public DataTable ToDatatable()
        {
            List <TreeData> lt = GetDepartment();
            DataTable       dt = new DataTable();

            return(ListToDataTable.ToDataTable <TreeData>(lt, null));
        }
Esempio n. 12
0
        public async Task <List <CameraDto> > PostExcelToCameraInfoAsync(IFormFile files)
        {
            if (files.Length == 0)
            {
                return(null);
            }

            DataTable dt = new DataTable();


            var data = ExcelHelper.ExcelToDataTable(files.OpenReadStream(), Path.GetExtension(files.FileName), "Sheet", true);

            var list = ListToDataTable.tolist <UpdateCameraDto>(data);
            List <CameraDto> listcamera = new List <CameraDto>();

            foreach (var item in list)
            {
                var camera = await _cameraAppService.GetListByCondition(new CameraCondition()
                {
                    Camera_ID = item.Camera_ID
                }, null);



                if (camera.TotalCount == 0)
                {
                    var Cameradata = await _cameraAppService.CreateAsync(item);

                    listcamera.Add(Cameradata);
                }
            }


            return(listcamera);
        }
Esempio n. 13
0
        //METODO PARA TRAER EL PQR DE LAS EMPRESAS
        public DataTable pqr_empresa()
        {
            using (var db = new Mapeo("public"))
            {
                var data = (from qj in db.inf_quejas
                            join emp in db.empre on qj.IdEmpre equals emp.Id
                            join usr in db.user on qj.Id_user equals usr.IdUsr
                            join Mq in db.quejas on qj.Id_Moti_Quej equals Mq.Id_queja
                            where qj.IdEmpre != null
                            where qj.ReceptorQ == 2
                            select new vistaPQRempresa
                {
                    desQueja = qj.DesQuej,
                    fechaQueja = qj.FechaQuj,
                    nomQueja = Mq.Nom_queja,
                    Emisor = usr.NomUsr,
                    foto = emp.RutaArchivo + emp.NomArchivo
                }).Distinct();

                List <vistaPQRempresa> datos = data.ToList <vistaPQRempresa>();
                ListToDataTable        conv  = new ListToDataTable();
                DataTable respuesta          = conv.ToDataTable <vistaPQRempresa>(datos);
                return(respuesta);
            }
        }
        public DataTable getDetails(string filePath, string ObjAttr)
        {
            string jsonString = File.ReadAllText(fileName);
            //JArray jsonArr = JArray.Parse(jsonString);
            List <CharModel> obj = JsonConvert.DeserializeObject <List <CharModel> >(jsonString);
            //dynamic modelJson;
            ListToDataTable converter = new ListToDataTable();

            //CharModel modelObj = new CharModel();
            foreach (CharModel o in obj.Where(item => item.charName == modelName))
            {
                switch (ObjAttr)
                {
                case "model":
                    //CharModel modelJson = o;
                    collection = converter.ClassToDataTable <CharModel>(o);
                    break;

                case "action":
                    //List<Models.Action> modelJson = o.actions;
                    collection = converter.ToDataTable(o.actions);
                    break;

                case "sa":
                    //modelJson = o.specialAbilities;
                    collection = converter.ToDataTable(o.specialAbilities);
                    break;
                }
            }
            return(collection);
        }
Esempio n. 15
0
 //METODO PARA TRAER LOS PRODUCTOS ESCRITOS EN LA BUSQUEDA
 public DataTable find_products(string busqueda)
 {
     using (var db = new Mapeo("public"))
     {
         var data = (from x in db.empre
                     join h in db.productos on x.Id equals h.IdEmpresa
                     join l in db.categ on h.Categoria equals l.Id_cate
                     where h.Estado_producto == 1 && h.Nombre.Contains(busqueda)
                     select new UEUVista_Tot_Prod
         {
             _nomcategoria = l.nomCategoria,
             _idproducto = h.Id,
             _nomproducto = h.Nombre,
             _desproducto = h.Descripcion,
             _precioproducto = h.Precio,
             _canproducto = h.Cantidad,
             _nomempresa = x.Nombre,
             _idempresa = x.Id,
             _foto = (from k in db.fotosPro where h.Id == k.Id_Product && h.Estado_producto == 1 select k).Take(1).FirstOrDefault().NomArchi.ToString()
         });
         List <UEUVista_Tot_Prod> res = data.ToList <UEUVista_Tot_Prod>();
         foreach (UEUVista_Tot_Prod aux in res)
         {
             if (aux._foto.Equals(""))
             {
                 aux._foto = "default.png";
             }
             aux._foto.ToString();
         }
         ListToDataTable convert = new ListToDataTable();
         DataTable       retorno = convert.ToDataTable <UEUVista_Tot_Prod>(res);
         return(retorno);
     }
 }
Esempio n. 16
0
        public async Task <List <AlarmDto> > PostExcelToDVRInfoAsync(IFormFile files)
        {
            if (files.Length == 0 || Path.GetExtension(files.FileName) != ".xlsx")
            {
                throw new Exception("上传文件格式错误");
                //return null;
            }

            DataTable dt = new DataTable();



            PagedAndSortedResultRequestDto resultRequestDto = new PagedAndSortedResultRequestDto()
            {
                MaxResultCount = 200000, SkipCount = 0, Sorting = "Id"
            };

            var             data      = ExcelHelper.ExcelToDataTable(files.OpenReadStream(), Path.GetExtension(files.FileName), "Sheet", true);
            var             list      = ListToDataTable.tolist <UpdateAlarmDto>(data);
            List <AlarmDto> listdvr   = new List <AlarmDto>();
            var             alarmdata = await _alarmAppService.GetListAsync(resultRequestDto);

            foreach (var item in list)
            {
                var dvr = alarmdata.Items.Where(u => u.Alarm_ID == item.Alarm_ID);
                if (dvr.Count() == 0)
                {
                    var dvrdata = await _alarmAppService.CreateAsync(item);

                    listdvr.Add(dvrdata);
                }
            }
            return(listdvr);
        }
Esempio n. 17
0
 public DataTable PeticionesHechas(int idEmpresa)
 {
     using (var db = new Mapeo("public"))
     {
         var data = (from prod in db.productos
                     join vent in db.ventas on prod.Id equals vent.IdProducto
                     join usuario in db.user on vent.IdUsr equals usuario.IdUsr
                     join empresa in db.empre on prod.IdEmpresa equals empresa.Id
                     where vent.EstadoVenta == 5 && empresa.Id == idEmpresa
                     select new vistaMostrarVenta
         {
             idVenta = vent.IdVenta,
             fechaVenta = vent.FechaVent,
             estadoVenta = vent.EstadoVenta,
             valorVenta = vent.Valor,
             nomUsuario = usuario.NomUsr,
             apeUsuario = usuario.ApelUsr,
             telUsuario = usuario.TelUsr,
             correoUsuario = usuario.CorreoUsr,
             dirUsuario = usuario.DirUsr,
             idEmpresa = empresa.Id,
             calificacionUsuario = usuario.Calificacion2,
             canProducto = prod.Cantidad,
             cantVenta = vent.Cantidad,
             nomProducto = prod.Nombre
         });
         ListToDataTable conv   = new ListToDataTable();
         DataTable       retorn = conv.ToDataTable <vistaMostrarVenta>(data.ToList <vistaMostrarVenta>());
         return(retorn);
     }
 }
Esempio n. 18
0
 //METODO PARA OBTENER UN PRODUCTO
 public DataTable obtener_producto(int id_produ)
 {
     using (var db = new Mapeo("public"))
     {
         var datos = (from p in db.productos join c in db.categ on p.Categoria equals c.Id_cate
                      join e in db.empre on p.IdEmpresa equals e.Id
                      select new vistaProductoSingle  {
             nomProducto = p.Nombre,
             idProducto = p.Id,
             canProducto = p.Cantidad,
             precioProducto = (double)p.Precio,
             desProducto = p.Descripcion,
             estadoProducto = p.Estado_producto,
             bajoInventario = p.BajoInventario,
             idEmpresa = p.IdEmpresa,
             nomCategoria = c.nomCategoria,
             nomEmpresa = e.Nombre,
             idCategoria = p.Categoria,
             nomArchivo = e.NomArchivo
         });
         datos = (from d in datos where d.idProducto == id_produ select d);
         ListToDataTable conv = new ListToDataTable();
         DataTable       data = conv.ToDataTable <vistaProductoSingle>(datos.ToList <vistaProductoSingle>());
         data.Rows[0]["nomProducto"].ToString();
         return(data);
     }
 }
Esempio n. 19
0
        public UEUProducto Prueba1_ItemCommand(String comandName, DataTable Empresa, List <UEUProducto> products, int itemIndex)
        {
            ListToDataTable conv      = new ListToDataTable();
            DataTable       Productos = conv.ToDataTable <UEUProducto>(products);
            UEUProducto     response  = new UEUProducto();

            if (comandName == "Delete")
            {
                this.BorrarProducto(int.Parse(Productos.Rows[itemIndex]["Id"].ToString()), Empresa.Rows[0]["nomEmpresa"].ToString());
                response.Id          = 0;
                response.Redireccion = "0";
                throw new System.ArgumentException("Valido");
            }

            if (comandName == "Select")
            {
                //CAMBIAR CUANDO SE CAMBIE EL TRAER PRODUCTOS
                response.Id             = int.Parse(Productos.Rows[itemIndex]["Id"].ToString());
                response.Nombre         = Productos.Rows[itemIndex]["Nombre"].ToString();
                response.Cantidad       = int.Parse(Productos.Rows[itemIndex]["Cantidad"].ToString());
                response.Precio         = int.Parse(Productos.Rows[itemIndex]["Precio"].ToString());
                response.Descripcion    = Productos.Rows[itemIndex]["Descripcion"].ToString();
                response.Categoria      = int.Parse(Productos.Rows[itemIndex]["Categoria"].ToString());
                response.BajoInventario = int.Parse(Productos.Rows[itemIndex]["BajoInventario"].ToString());
                //Session["IdProducto"] = Productos.Rows[itemIndex]["idProducto"].ToString();
                response.Redireccion = "98";
                return(response);
            }
            response.Redireccion = "98";
            return(response);
        }
Esempio n. 20
0
 //METODO QUE ME TRAE TODAS LAS SOLICITUDES PENDIENTES
 public DataTable traer_pendiente()
 {
     using (var db = new Mapeo("public"))
     {
         var data = (from emp in db.empre
                     join solicit in db.sol_reg on emp.Id equals solicit.Id_empresa
                     where solicit.Estado_solici == 1
                     select new UEUVista_Soil_Acep
         {
             nomEmpresa = emp.Nombre,
             telEmpresa = emp.Numero,
             correoEmpresa = emp.Correo,
             dirEmpresa = emp.Direccion,
             nitEmpresa = emp.Nit,
             rutaArchivo = emp.RutaArchivo + emp.NomArchivo,
             estadoEmpresa = emp.EstadoEmpre,
             calificacionEmpresa = emp.Calificacion,
             fechaCreacion_empresa = emp.Fecha_Crea,
             idSolicitud_registro = solicit.Id_solici,
             estadoSolicitud = solicit.Estado_solici
         });
         ListToDataTable conv    = new ListToDataTable();
         DataTable       retorno = conv.ToDataTable <UEUVista_Soil_Acep>(data.ToList <UEUVista_Soil_Acep>());
         return(retorno);
     }
 }
Esempio n. 21
0
        public void CrawlerAll()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(category.Url))
                {
                    Console.WriteLine($"分类的链接为空{category.Name}{category.CategoryLevel}");
                }
                else
                {
                    string html = HttpHelper.DownLoad(category.Url, Encoding.UTF8);

                    //解析网页
                    HtmlDocument document = new HtmlDocument();
                    document.LoadHtml(html);
                    //通过xpath解析

                    string             pageXPath = "/html/body/section[1]/div/div[6]/a[@class='page-btn']";
                    HtmlNodeCollection pageNodes = document.DocumentNode.SelectNodes(pageXPath);
                    int pageCount = pageNodes.Select(a => Convert.ToInt32(a.InnerText)).OrderByDescending(a => a).FirstOrDefault();

                    List <CourseEntity> courses = new List <CourseEntity>();
                    for (int i = 1; i <= pageCount; i++)
                    {
                        string pageUrl = $"{category.Url}&page={i}";
                        html = HttpHelper.DownLoad(pageUrl, Encoding.UTF8);
                        //解析网页
                        HtmlDocument pageDocument = new HtmlDocument();
                        pageDocument.LoadHtml(html);
                        string             liXPath        = "/html/body/section[1]/div/div[4]/ul/li";
                        HtmlNodeCollection pageLiNodeList = pageDocument.DocumentNode.SelectNodes(liXPath);
                        foreach (var liNode in pageLiNodeList)
                        {
                            var course = GetOneCourse(liNode);
                            courses.Add(course);
                        }
                        if (i == 3)
                        {
                            break;
                        }
                    }
                    string direct    = $"{System.AppDomain.CurrentDomain.BaseDirectory}CrawlerFile\\";;
                    string sheetName = "course";
                    string Name      = $"{sheetName}{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";// sheetName  + DateTime.Now.ToString("yyyyMMddHHmmss") + ").xls";

                    if (!Directory.Exists(direct))
                    {
                        Directory.CreateDirectory(direct);
                    }
                    ExcelHelper eh        = new ExcelHelper(direct + Name);
                    DataTable   dtCourses = ListToDataTable.ToDataTable <CourseEntity>(courses);
                    eh.DataTableToExcel(dtCourses, sheetName, true);
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Crawler抓取异常");
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        protected void btnExportExcel_Click(object sender, EventArgs e)
        {
            int       count    = 0;
            var       DataList = _logService.GetPagedList <DateTime?>(CtrPageIndex.CurrentPageIndex, CtrPageIndex.PageSize, ref count, null, c => c.LoginDate, false);
            DataTable dt       = ListToDataTable.ListToTable <sys_LoginLog>(DataList);

            ExcelUtil.RenderToExcel(dt, Context, "日志.xls");
        }
Esempio n. 23
0
        private void Fill()
        {
            CWCarsLogic cars = new CWCarsLogic(manager);
            DataGV.AutoGenerateColumns = false;

            ListToDataTable listToDataTable = new ListToDataTable();
            DataGV.DataSource = listToDataTable.ToDataTable<CWCarView>(cars.GetAllView().ToList());
            DgvFilterManager filterManager = new DgvFilterManager(DataGV);
        }
Esempio n. 24
0
        /// <summary>
        /// 导出EXCEL
        /// </summary>
        /// <param name="day"></param>
        /// <param name="pay_state"></param>
        /// <param name="order_state"></param>
        public void ExportExcel(int day, int pay_state, int order_state)
        {
            var order_list = OrderCache($"orderlist_{day}", day);

            if (order_list.Any())
            {
                order_list = order_list.Where(n => n.pay_state == pay_state && n.order_state == order_state).ToList();
                List <dynamic> list = new List <dynamic>();
                if (order_list.Any())
                {
                    foreach (var item in order_list)
                    {
                        var one = new
                        {
                            item.id,
                            product_name = item.product.name,
                            pay_state    = Enum.GetName(typeof(Pay_state), item.pay_state),
                            order_state  = Enum.GetName(typeof(Order_state), item.order_state),
                            user_name    = item.user.name,
                            item.order_number,
                            item.wx_order_num,
                            item.user_remark,
                            item.add_time,
                            item.pay_time,
                            item.refund_number,
                            item.pay_account,
                            item.count,
                            item.product.price,
                            item.order_money
                        };
                        list.Add(one);
                    }
                    if (list.Any())
                    {
                        DataTable dt = ListToDataTable.List2DataTable <dynamic>(list);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            dt.Columns["id"].ColumnName            = "id";
                            dt.Columns["product_name"].ColumnName  = "产品名称";
                            dt.Columns["user_name"].ColumnName     = "用户名称";
                            dt.Columns["count"].ColumnName         = "产品个数";
                            dt.Columns["price"].ColumnName         = "产品价格";
                            dt.Columns["order_money"].ColumnName   = "订单金额";
                            dt.Columns["pay_state"].ColumnName     = "支付状态";
                            dt.Columns["order_state"].ColumnName   = "订单状态";
                            dt.Columns["order_number"].ColumnName  = "订单号";
                            dt.Columns["wx_order_num"].ColumnName  = "微信订单号";
                            dt.Columns["add_time"].ColumnName      = "下单时间";
                            dt.Columns["pay_time"].ColumnName      = "支付时间";
                            dt.Columns["pay_account"].ColumnName   = "付款账号";
                            dt.Columns["refund_number"].ColumnName = "退单号";
                        }
                        bool hh = OfficeHelper.ExportExcelWithAspose(dt, $"{day}天内订单信息{DateTime.Now.ToString("yyyy年MM月dd日HH时mm分ss秒")}", "", true);
                    }
                }
            }
        }
Esempio n. 25
0
 public DataTable formularios()
 {
     using (var db = new Mapeo("idioma"))
     {
         ListToDataTable         conv = new ListToDataTable();
         List <UEUFormula_Idiom> data = db.form_idioma.ToList <UEUFormula_Idiom>();
         return(conv.ToDataTable <UEUFormula_Idiom>(data));
     }
 }
Esempio n. 26
0
 public DataTable get_picture_product(int id_produ)
 {
     using (var db = new Mapeo("public"))
     {
         var             pictures = db.fotosPro.Where(x => x.Id_Product == id_produ).ToList <UEUFotoProd>();
         ListToDataTable conv     = new ListToDataTable();
         return(conv.ToDataTable <UEUFotoProd>(pictures));
     }
 }
Esempio n. 27
0
 //CONTEMPLA EL ESTADO DE LA DICHOSA MEMBRESIA
 public DataTable MostrarActual2(int idEmpresa)
 {
     using (var db = new Mapeo("public"))
     {
         var             data = (from mem in db.membresia where mem.Id_empresa == idEmpresa && mem.Estado_mem == 1  select mem);
         ListToDataTable conv = new ListToDataTable();
         return(conv.ToDataTable <UEUMembresia>(data.ToList <UEUMembresia>()));
     }
 }
Esempio n. 28
0
 public DataTable verificar_categoria(string consulta)
 {
     using (var db = new Mapeo("public"))
     {
         consulta = consulta.ToUpper();
         var             data = from cat in db.categ where cat.nomCategoria.ToUpper().Contains(consulta) select cat;
         ListToDataTable conv = new ListToDataTable();
         return(conv.ToDataTable <UEUCategoria>(data.ToList <UEUCategoria>()));
     }
 }
Esempio n. 29
0
 //METODO PARA VERFICAR LA QUEJA
 public DataTable verficarQueja(string nomQueja)
 {
     using (var db = new Mapeo("public"))
     {
         nomQueja = nomQueja.ToUpper();
         var             consulta = (from motiQ in db.quejas where motiQ.Nom_queja.ToUpper().Contains(nomQueja) select motiQ);
         ListToDataTable conv     = new ListToDataTable();
         return(conv.ToDataTable <UEUQueja>(consulta.ToList <UEUQueja>()));
     }
 }
Esempio n. 30
0
 public DataTable MostrarCategoria()
 {
     using (var db = new Mapeo("public"))
     {
         var             data = db.categ.OrderBy(x => x.Id_cate);
         ListToDataTable conv = new ListToDataTable();
         DataTable       res  = conv.ToDataTable <UEUCategoria>(data.ToList <UEUCategoria>());
         return(res);
     }
 }
        /*change the object to a DataTable for displaying purpose*/
        public DataTable getNames(string fileName)
        {
            var jsonString = File.ReadAllText(fileName);

            modelCollectionList = JsonConvert.DeserializeObject <List <CharModel> >(jsonString);
            ListToDataTable converter  = new ListToDataTable();
            DataTable       collection = converter.ToDataTable(modelCollectionList);

            return(collection);
        }
Esempio n. 32
0
        private void GetData()
        {
            string url = "api/News/GetNewsTitleList";
            List <GetNewsListReturnDTO> resultDto = _apiAdaptor.Get <List <GetNewsListReturnDTO> >(url);

            DataTable dt = new DataTable();

            dt = ListToDataTable.ConvertToDataTable(resultDto);
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
Esempio n. 33
0
        public void FillResultsFilter()
        {
            List<ViewWare> viewList = new List<ViewWare>();
            List<WareCode> codeList = new List<WareCode>();

            viewList = view.Where(a => (
                ((a.Name.ToUpper().Contains(NameTB.Text.ToUpper()) == true) ||
                a.WareCategoryName.ToUpper().Contains(NameTB.Text.ToUpper())) &
                a.WareCode.ToUpper().Contains(CodeTB.Text.ToUpper())

                )).ToList();

            SortableBindingList<ViewWare> filteredView = new SortableBindingList<ViewWare>(viewList);

            //DataGV.DataSource = filteredView;

            ListToDataTable listToDataTable = new ListToDataTable();
            DataGV.DataSource = listToDataTable.ToDataTable<ViewWare>(viewList);

            DataGV.Update();
        }
Esempio n. 34
0
        private void Fill(string columnName)
        {
            DateTime start = DateTime.Now;
            WaresLogic wares = new WaresLogic(manager);
            DataGV.AutoGenerateColumns = false;
            int? categoryId = null;
            int? manufacturerId = null;
            int? unitId = null;
            //string name = wareFilterUC1.WareName;
            if(categoriesFilterUC1.SelectedCategoryID >= 0)
                categoryId = categoriesFilterUC1.SelectedCategoryID;
            //manufacturerId = wareFilterUC1.ManufacturerID;
            //unitId = wareFilterUC1.UnitID;
            BindingSource bs = new BindingSource();

            var waresList = wares.GetAllView("", categoryId, manufacturerId, unitId);
            //    .Select(a => new
            //{
            //    a.ID,
            //    Name = a.Name,
            //    UnitName = a.WareUnit != null ? a.WareUnit.Name : "",
            //    ManufacturerName = a.WareManufacturer != null ? a.WareManufacturer.Name : "",
            //    CategoryName = a.WareCategory != null ? a.WareCategory.Name : "",
            //    CategoryID = a.CategoryID,
            //    SecondaryUnitID = a.SecondaryUnitID != null ? a.SecondaryUnitID : null,

            //   SecondaryUnitName = a.WareUnit1 != null ? a.WareUnit1.Name : "",
            //   SecondaryUnitQuantity = a.SecondaryUnitQuantity != null ? a.SecondaryUnitQuantity : null,
            //   a.WareCodes,
            //   a.WareTimeLimits
            //});//.OrderBy(a => a.CategoryName).ThenBy(a=> a.Name).ToList();
            //List<WareView> viewList = new List<WareView>();

            DateTime start0 = DateTime.Now;

            //foreach (var a in waresList)
            //{
            //    WareView wv = new WareView();
            //    wv.ID = a.ID;
            //    wv.CategoryID = a.CategoryID;
            //    wv.Name = a.Name;
            //    wv.CategoryName = a.CategoryName;
            //    wv.ManufacturerName = a.ManufacturerName;
            //    wv.UnitName = a.UnitName;
            //    wv.SecondaryUnitID = a.SecondaryUnitID;
            //    wv.SecondaryUnitName = a.SecondaryUnitName;
            //    wv.SecondaryUnitQuantity = a.SecondaryUnitQuantity;
            //    //wv.WareCodes = a.WareCodes.ToList();

            //    //var lastTimeLimit = (from aa in a.WareTimeLimits
            //    //                     where aa.Active == true
            //    //                     select aa).FirstOrDefault();
            //    //if (lastTimeLimit != null)
            //    //    wv.TimeLimit = lastTimeLimit.TimeLimit;
            //    //else
            //    //    wv.TimeLimit = 0;

            //    viewList.Add(wv);
            //}
            DateTime start1 = DateTime.Now;
            //BindingListView<WareView> view = new BindingListView<WareView>(viewList);
            //bs.DataSource = view;
            //bs.Sort = columnName;

            view = new SortableBindingList<ViewWare>(waresList);

            ListToDataTable listToDataTable = new ListToDataTable();
            DataGV.DataSource = listToDataTable.ToDataTable<ViewWare>(waresList);

            //DataGV.DataSource = view;
            DataGV.Update();
            DgvFilterManager filterManager = new DgvFilterManager(DataGV);
            DateTime start2 = DateTime.Now;
            //MessageBox.Show(start.ToString() + " " + start0.ToString() + " " + start1.ToString() + " " + start2.ToString());
        }
Esempio n. 35
0
        private void FillDataGV()
        {
            Compas.Logic.Config.ConfigurationParametersLogic configurationsLogic = new ConfigurationParametersLogic(manager);
            ListToDataTable listToDataTable = new ListToDataTable();

            DataGV.AutoGenerateColumns = false;
            DataGV.DataSource = listToDataTable.ToDataTable<ViewConfigurationParameter>(configurationsLogic.GetAllView());
            DgvFilterManager filterManager = new DgvFilterManager(DataGV);
            DataGV.Update();
        }