public List <EstadoEntity> Listar(string uf) { var SQL = new StringBuilder(); SQL.AppendLine("SELECT tb_glo_loc_estados.uf AS Uf"); SQL.AppendLine(" ,tb_glo_loc_estados.pais_numcode AS PaisNumcode"); SQL.AppendLine(" ,tb_glo_loc_estados.regiao AS Regiao"); SQL.AppendLine(" ,tb_glo_loc_estados.nome AS Nome"); SQL.AppendLine(" ,tb_glo_loc_estados.nome_ptbr AS NomePtbr"); SQL.AppendLine(" ,tb_glo_loc_estados.capital AS Capital"); SQL.AppendLine(" ,tb_glo_loc_estados.id_utc AS UtcId"); SQL.AppendLine(" ,tb_glo_loc_estados.id_utc_verao AS UtcVeraoId"); SQL.AppendLine(" FROM db_global.dbo.tb_glo_loc_estados"); SQL.Append(" WHERE tb_glo_loc_estados.uf = '").Append(uf).AppendLine("'"); using (var dataTable = DataBase.Select(SQL)) { return(dataTable == null ? null : DataTableUtil.DataTableToList <EstadoEntity>(dataTable)); } }
private void BindData() { SecondhandProductModel model = bll.GetModel(SecondhandProductID); if (model.Status != (int)SecondhandProductStatus.尚未审核) { MessageBox.Show(this, "该商品已被审核,禁止编辑!"); Response.Redirect("List.aspx"); return; } DropDown_Usage.DataSource = DataTableUtil.GetEnumKeyValue(typeof(SecondhandProductUsageCondition)); DropDown_Usage.DataTextField = "key"; DropDown_Usage.DataValueField = "value"; DropDown_Usage.DataBind(); CategoryID = model.CateID; if (!String.IsNullOrEmpty(Request.QueryString["categoryid"])) { CategoryID = Convert.ToInt32(Request.QueryString["categoryid"]); } TextBox_Category.Text = new MagicCategoryBll().GetModel(CategoryID).CategoryName; TextBox_ProductName.Text = model.SecondhandProductName; TextBox_Price.Text = model.Price.ToString("0.00"); TextBox_Count.Text = model.Stock.ToString(); DropDown_Usage.SelectedValue = model.UsageCondition.ToString(); TextBox_Brief.Text = model.Brief; TextBox_TrueName.Text = model.TrueName; TextBox_Phone.Text = model.Phone; TextBox_CellPhone.Text = model.CellPhone; TextBox_PostCode.Text = model.PostCode; TextBox_Address.Text = model.Address; ucRegion.PresetRegionInfo(RegionInfo.GetRegionPathByName(model.Region.Split(' ')[model.Region.Split(' ').Length - 1])); }
public List <CepEntity> Listar(CepEntity model) { var SQL = new StringBuilder(); SQL.AppendLine("SELECT tb_glo_loc_cep.id_cep AS CepId"); SQL.AppendLine(" ,tb_glo_loc_cep.id_municipio AS MunicipioId"); SQL.AppendLine(" ,tb_glo_loc_cep.id_bairro AS BairroId"); SQL.AppendLine(" ,tb_glo_loc_cep.id_tipo_logradouro AS TipoLogradouroId"); SQL.AppendLine(" ,tb_glo_loc_cep.cep AS Cep"); SQL.AppendLine(" ,tb_glo_loc_cep.logradouro AS Logradouro"); SQL.AppendLine(" ,tb_glo_loc_cep.flag_sanitizado AS FlagSanitizado"); SQL.AppendLine(" FROM db_global.dbo.tb_glo_loc_cep"); if (model.CepId > 0) { SQL.Append(" WHERE tb_glo_loc_cep.id_cep = ").Append(model.CepId).AppendLine(); } else { SQL.Append(" WHERE tb_glo_loc_cep.cep = '").Append(model.Cep).AppendLine("'"); } using (var dataTable = DataBase.Select(SQL)) { return(dataTable == null ? null : DataTableUtil.DataTableToList <CepEntity>(dataTable)); } }
private void BindData() { DropDown_ParaType.DataSource = DataTableUtil.GetEnumKeyValue(typeof(CategoryParameterType)); DropDown_ParaType.DataTextField = "key"; DropDown_ParaType.DataValueField = "value"; DropDown_ParaType.DataBind(); }
public virtual string[] GetPropertiesByPage(string selectFieldName, WhereStatement whereStatement, out int recordCount, int pageIndex = 1, int pageSize = 50, OrderByStatement orderByStatement = null) { whereStatement.DbHelper = this.DbHelper; SelectQueryBuilder sqlBuilder = new SelectQueryBuilder(this.DbHelper); sqlBuilder.SetSelectColumns(selectFieldName); sqlBuilder.SetFromTable(this.CurrentTableName); sqlBuilder.AddWhere(whereStatement); DbParameter[] parameters = null; string sql = sqlBuilder.BuildSQL(out parameters); recordCount = Convert.ToInt32(this.DbHelper.ExecuteScalar(PagingBuilder.CreateCountingSql(sql), parameters)); if (orderByStatement == null) { orderByStatement = new OrderByStatement(this._iEntity.PrimaryKey, Sorting.Ascending); } string orderBySql = orderByStatement.BuildOrderByStatement(); string pagedSql = PagingBuilder.CreatePagingSql(recordCount, pageSize, pageIndex, sql, orderBySql); DataTable dataTable = new DataTable(this.CurrentTableName); dataTable = this.DbHelper.Fill(pagedSql, parameters); return(DataTableUtil.FieldToArray(dataTable, selectFieldName)); }
private void getDetail() { DataRow dr = gridView1.GetFocusedDataRow(); if (dr != null) { decimal id = Convert.ToDecimal(dr["ID"]); DataTable dt = billAppTreatMain.GetBAppDetailListShow(id); DataTableUtil.RemoveDBNull(ref dt); gridControl2.DataSource = dt; labelControlNo.Text = "No:" + dr["NO"].ToString(); imageComboBoxEditMainAccountType.EditValue = imageComboBoxEditAccountType.EditValue; labelControlTarget.Text = "申领仓库:" + dr["STO_NAME"].ToString(); textEditRemark.Text = dr["REMARK"].ToString(); labelControlInputEmp.Text = "申领人:" + dr["INPUT_NAME"].ToString(); labelControlInputTime.Text = "申领时间:" + dr["INPUT_TIME"].ToString(); } else { gridControl2.DataSource = null; labelControlNo.Text = "No:"; imageComboBoxEditMainAccountType.EditValue = null; labelControlTarget.Text = "申领仓库:"; textEditRemark.Text = string.Empty; labelControlInputEmp.Text = "申领人:"; labelControlInputTime.Text = "申领时间:"; } }
private void InsertButton_Click(object sender, EventArgs e) { int id = 0; //セマンティックリンクID int startNum = 0; //スタート地点NUM #region 仮想ログデータ(JST,車速,車間距離)を生成する処理 //ECOLOGテーブルから,SQLで指定した範囲のECOLOGデータをDataTable型で取得する処理 DataTable ECOLOGData = EcologSimulationDao.GetSelectedData(); //ソートされたリンク(線)を取得する処理 List <LinkData> linkList = getLinkList(id, startNum); //仮想ログデータを生成するメソッド DataTable logData = generateSimulationLog(ECOLOGData, linkList); #endregion DataTable EcologSimulationTable = new DataTable(); //仮想の走行ログから生成したECOLOGデータを格納するDataTableを作成 EcologSimulationTable = DataTableUtil.GetEcologTable(); //↑で生成したDataTableのスキーマをECOLOGテーブルの形にする //ECOLOG計算をして,仮想ECOLOGデータを生成するメソッド for (int i = 0; i < logData.Rows.Count; i++) { DataRow ecologRow = HagimotoEcologCalculator.CalcEcologSimulation(DataRow tripRow, InsertDatum datum, InsertConfig.GpsCorrection.Normal);//TODO: 仮想のGPSログを元にtripRow, Datumを設定 EcologSimulationTable.Rows.Add(ecologRow); } #region 仮想ECOLOGデータをデータベースインサートする処理 //仮想ECOLOGデータをECOLOG_SIMULATIONテーブルへインサートするメソッド EcologSimulationDao.Insert(EcologSimulationTable); #endregion }
public static void UserLogin(HttpContext context) { context.Response.ContentType = "text/plain"; UserLogin_Model model = new UserLogin_Model(); Hashtable Param = new Hashtable(); Param.Add("UserNo", URequest.RequestAll("UserNo")); Param.Add("UserImg", URequest.RequestAll("UserImg")); Param.Add("UserName", URequest.RequestAll("UserName")); DataSet ds = UserLogin_Dal.UserLogin(Param); foreach (DataTable dt in ds.Tables) { if (dt.TableName == "Table") { model.Code = DataTableUtil.GetInt(dt, "Code"); model.Message = DataTableUtil.GetString(dt, "Message").Trim(); } } context.Response.Write(StringUtil.CJson(model)); context.Response.End(); }
public static void InsertTripRaw(DataTable gpsRawTable, InsertConfig.GpsCorrection correction) { var tripsTable = DataTableUtil.GetTripsRawTable(); DataRow row = tripsTable.NewRow(); row.SetField(TripsRawDao.ColumnDriverId, gpsRawTable.Rows[0].Field <int>(AndroidGpsRawDao.ColumnDriverId)); row.SetField(TripsRawDao.ColumnCarId, gpsRawTable.Rows[0].Field <int>(AndroidGpsRawDao.ColumnCarId)); row.SetField(TripsRawDao.ColumnSensorId, gpsRawTable.Rows[0].Field <int>(AndroidGpsRawDao.ColumnSensorId)); row.SetField(TripsRawDao.ColumnStartTime, gpsRawTable.Rows[0].Field <DateTime>(AndroidGpsRawDao.ColumnJst)); row.SetField(TripsRawDao.ColumnStartLatitude, gpsRawTable.Rows[0].Field <double>(AndroidGpsRawDao.ColumnLatitude)); row.SetField(TripsRawDao.ColumnStartLongitude, gpsRawTable.Rows[0].Field <double>(AndroidGpsRawDao.ColumnLongitude)); row.SetField(TripsRawDao.ColumnEndTime, gpsRawTable.Rows[gpsRawTable.Rows.Count - 1].Field <DateTime>(AndroidGpsRawDao.ColumnJst)); row.SetField(TripsRawDao.ColumnEndLatitude, gpsRawTable.Rows[gpsRawTable.Rows.Count - 1].Field <double>(AndroidGpsRawDao.ColumnLatitude)); row.SetField(TripsRawDao.ColumnEndLongitude, gpsRawTable.Rows[gpsRawTable.Rows.Count - 1].Field <double>(AndroidGpsRawDao.ColumnLongitude)); tripsTable.Rows.Add(row); // GPSファイルごとの処理なので主キー違反があっても挿入されないだけ if (correction == InsertConfig.GpsCorrection.SpeedLPFMapMatching) { TripsRawSpeedLPF005MMDao.Insert(tripsTable); } else if (correction == InsertConfig.GpsCorrection.MapMatching) { TripsRawMMDao.Insert(tripsTable); } else { TripsRawDao.Insert(tripsTable); } }
private void BindData() { DropDown_ProductType.DataSource = DataTableUtil.GetEnumKeyValue(typeof(GroupShoppingProductType)); DropDown_ProductType.DataTextField = "key"; DropDown_ProductType.DataValueField = "value"; DropDown_ProductType.DataBind(); }
public static void AddRecordBill(HttpContext context) { context.Response.ContentType = "text/plain"; AddRecordBill_Model model = new AddRecordBill_Model(); Hashtable Param = new Hashtable(); Param.Add("UserNo", URequest.RequestAll("UserNo")); Param.Add("Date", URequest.RequestAll("Date")); Param.Add("Purpose", URequest.RequestAll("Purpose")); Param.Add("Money", URequest.RequestAll("Money")); Param.Add("Remark", URequest.RequestAll("Remark")); string BillNo = Guid.NewGuid().ToString("N"); Param.Add("BillNo", BillNo); DataSet ds = AddRecordBill_Dal.AddRecordBill(Param); foreach (DataTable dt in ds.Tables) { if (dt.TableName == "Table") { model.Code = DataTableUtil.GetInt(dt, "Code"); model.Message = DataTableUtil.GetString(dt, "Message").Trim(); } } context.Response.Write(StringUtil.CJson(model)); context.Response.End(); }
public List <MunicipioEntity> Listar(string uf) { var SQL = new StringBuilder(); SQL.AppendLine("SELECT tb_glo_loc_municipios.id_municipio AS MunicipioId"); SQL.AppendLine(" ,tb_glo_loc_municipios.uf AS Uf"); SQL.AppendLine(" ,tb_glo_loc_municipios.nome AS Nome"); SQL.AppendLine(" ,tb_glo_loc_municipios.nome_ptbr AS NomePtbr"); SQL.AppendLine(" ,tb_glo_loc_municipios.codigo_municipio AS CodigoMunicipio"); SQL.AppendLine(" ,tb_glo_loc_municipios.codigo_municipio_ibge AS CodigoMunicipioIbge"); SQL.AppendLine(" FROM db_global.dbo.tb_glo_loc_municipios"); SQL.Append(" WHERE tb_glo_loc_municipios.uf = '").Append(uf).AppendLine("'"); using (var dataTable = DataBase.Select(SQL)) { return(dataTable == null ? null : DataTableUtil.DataTableToList <MunicipioEntity>(dataTable)); } }
public static List <NfePrestadorAvulsoEntity> Listar(NfePrestadorAvulsoEntity model) { var SQL = new StringBuilder(); SQL.AppendLine("SELECT NfePrestadorAvulsoId"); SQL.AppendLine(" ,Cnpj"); SQL.AppendLine(" ,Nome"); SQL.AppendLine(" ,Token"); SQL.AppendLine(" FROM dbo.tb_dep_nfe_prestador_avulso"); if (model != null) { SQL.AppendLine(" WHERE 1 = 1"); if (model.NfePrestadorAvulsoId > 0) { SQL.Append(" AND NfeRegraId = ").Append(model.NfePrestadorAvulsoId).AppendLine(); } if (string.IsNullOrWhiteSpace(model.Cnpj)) { SQL.Append(" AND Cnpj = '").Append(model.Cnpj).AppendLine("'"); } } using (var dataTable = DataBase.Select(SQL)) { return(dataTable == null ? null : DataTableUtil.DataTableToList <NfePrestadorAvulsoEntity>(dataTable)); } }
private void BindData() { DropDown_ProductType.DataSource = DataTableUtil.GetEnumKeyValue(typeof(GroupShoppingProductType)); DropDown_ProductType.DataTextField = "key"; DropDown_ProductType.DataValueField = "value"; DropDown_ProductType.DataBind(); if (GroupProductID != 0) { GroupProductModel model = bll.GetModel(GroupProductID); TextBox_ProductName.Text = model.ProductName; DropDown_ProductType.SelectedValue = model.ProductType.ToString(); TextBox_ProductCode.Text = model.ProductCode; TextBox_MarketPrice.Text = model.MarketPrice.ToString("0.00"); TextBox_GroupPrice.Text = model.GroupPrice.ToString("0.00"); TextBox_PrePaidPrice.Text = model.PrePaidPrice.ToString("0.00"); TextBox_Detail.Text = model.Detail; TextBox_Brief.Text = model.Description; TextBox_SuccedLine.Text = model.SuccedLine.ToString(); CheclBox_Recommend.Checked = model.IsRecommend; Image_ProductImage.ImageUrl = GroupShoppingImageRule.GetImageUrl(model.SmallImage); } }
private void BindData() { DropDown_Type.DataSource = DataTableUtil.GetEnumKeyValue(typeof(SpecificationType)); DropDown_Type.DataTextField = "key"; DropDown_Type.DataValueField = "value"; DropDown_Type.DataBind(); }
public FileContentResult Export(string entityType) { var risks = GetListOfData <Risk>(entityType); var xlsByteArray = DataTableUtil.CreateDataTable(risks.Select(c => new { Id = c.id }), "Users").GetExcelBytes(); return(File(xlsByteArray, "application/octet-stream", $"{entityType}.{DateTime.Now:yyyy.MM.dd}.xlsx")); }
public void CreateDbAccessor() { var dba = DbAccessorFactory.CreateDbAccessor("TestDb"); var dt = dba.QueryDataTable("select top 10 * from sys_product"); Console.WriteLine(DataTableUtil.ToString(dt)); }
protected ActionResult OK(DataTable data) { ContentResult cr = new ContentResult(); cr.ContentType = "text/html"; cr.Content = "{\"Status\":1,\"Data\":" + DataTableUtil.SerializeToJson(data) + "}"; return(cr); }
public List <CnaeListaServicoParametroMunicipioEntity> Listar(CnaeListaServicoParametroMunicipioEntity model) { var SQL = new StringBuilder(); SQL.AppendLine("SELECT vw_gov_cnae_lista_servico_parametro_municipio.CnaeListaServicoId AS CnaeListaServicoId"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.CnaeId AS CnaeId"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.ListaServicoId AS ListaServicoId"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.MunicipioId AS MunicipioId"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.ParametroMunicipioId AS ParametroMunicipioId"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.CnaeCodigo AS CnaeCodigo"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.CnaeCodigoFormatado AS CnaeCodigoFormatado"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.CnaeDescricao AS CnaeDescricao"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.ListaServico AS ListaServico"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.ListaServicoDescricao AS ListaServicoDescricao"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.AliquotaIss AS AliquotaIss"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.Uf AS Uf"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.Municipio AS Municipio"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.CodigoMunicipioIbge AS CodigoMunicipioIbge"); SQL.AppendLine(" ,vw_gov_cnae_lista_servico_parametro_municipio.CodigoTributarioMunicipio AS CodigoTributarioMunicipio"); SQL.AppendLine(" FROM db_global.dbo.vw_gov_cnae_lista_servico_parametro_municipio"); SQL.AppendLine(" WHERE 1 = 1"); if (model.CnaeId > 0) { SQL.Append(" AND vw_gov_cnae_lista_servico_parametro_municipio.CnaeId = ").Append(model.CnaeId).AppendLine(); } if (model.ListaServicoId > 0) { SQL.Append(" AND vw_gov_cnae_lista_servico_parametro_municipio.ListaServicoId = ").Append(model.ListaServicoId).AppendLine(); } if (!string.IsNullOrWhiteSpace(model.CodigoMunicipioIbge)) { SQL.Append(" AND vw_gov_cnae_lista_servico_parametro_municipio.CodigoMunicipioIbge = '").Append(model.CodigoMunicipioIbge).AppendLine("'"); } using (var dataTable = DataBase.Select(SQL)) { return(dataTable == null ? null : DataTableUtil.DataTableToList <CnaeListaServicoParametroMunicipioEntity>(dataTable)); } }
public List <EnderecoCompletoEntity> Listar(EnderecoCompletoEntity model) { var SQL = new StringBuilder(); SQL.AppendLine("SELECT vw_glo_consultar_endereco_completo.id_cep AS CepId"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.id_municipio AS MunicipioId"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.id_bairro AS BairroId"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.id_tipo_logradouro AS TipoLogradouroId"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.CEP AS CEP"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.tipo_logradouro AS TipoLogradouro"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.logradouro AS Logradouro"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.bairro AS Bairro"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.bairro_ptbr AS BairroPtbr"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.municipio AS Municipio"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.municipio_ptbr AS MunicipioPtbr"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.codigo_municipio AS CodigoMunicipio"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.codigo_municipio_ibge AS CodigoMunicipioIbge"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.estado AS Estado"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.estado_ptbr AS EstadoPtbr"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.uf AS Uf"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.regiao AS Regiao"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.regiao_nome AS RegiaoNome"); SQL.AppendLine(" ,vw_glo_consultar_endereco_completo.flag_sanitizado AS FlagSanitizado"); SQL.AppendLine(" FROM db_global.dbo.vw_glo_consultar_endereco_completo"); if (model.CepId > 0) { SQL.Append(" WHERE vw_glo_consultar_endereco_completo.id_cep = ").Append(model.CepId).AppendLine(); } else { SQL.Append(" WHERE vw_glo_consultar_endereco_completo.cep = '").Append(model.Cep).AppendLine("'"); } using (var dataTable = DataBase.Select(SQL)) { return(dataTable == null ? null : DataTableUtil.DataTableToList <EnderecoCompletoEntity>(dataTable)); } }
public List <NfeEntity> Listar(NfeEntity model, bool selecionarNotaFiscalCancelada = false) { var SQL = new StringBuilder(); SQL.AppendLine("SELECT tb_dep_nfe.NfeId"); SQL.AppendLine(" ,tb_dep_nfe.GrvId"); SQL.AppendLine(" ,tb_dep_nfe.IdentificadorNota"); SQL.AppendLine(" ,tb_dep_nfe.NfeComplementarId"); SQL.AppendLine(" ,tb_dep_nfe.UsuarioCadastroId"); SQL.AppendLine(" ,tb_dep_nfe.Cnpj"); SQL.AppendLine(" ,tb_dep_nfe.Numero"); SQL.AppendLine(" ,tb_dep_nfe.CodigoVerificacao"); SQL.AppendLine(" ,tb_dep_nfe.CodigoRetorno"); SQL.AppendLine(" ,tb_dep_nfe.Url"); SQL.AppendLine(" ,tb_dep_nfe.Status"); SQL.AppendLine(" ,tb_dep_nfe.StatusNfe"); SQL.AppendLine(" ,tb_dep_nfe.DataEmissao"); SQL.AppendLine(" ,tb_dep_nfe.DataCadastro"); SQL.AppendLine(" ,tb_dep_nfe.DataAlteracao"); SQL.AppendLine(" FROM dbo.tb_dep_nfe"); SQL.AppendLine(" WHERE 1 = 1"); if (!string.IsNullOrWhiteSpace(model.IdentificadorNota)) { SQL.Append(" AND IdentificadorNota = '").Append(model.IdentificadorNota).AppendLine("'"); } else { SQL.Append(" AND GrvId = ").Append(model.GrvId).AppendLine(); } if (!selecionarNotaFiscalCancelada) { SQL.AppendLine(" AND Status NOT IN ('N','E','I')"); } using (var dataTable = DataBase.Select(SQL)) { return(dataTable == null ? null : DataTableUtil.DataTableToList <NfeEntity>(dataTable)); } }
public void DynamicClauseTest() { var dt = _dba.QueryDataTable("select count(*) from sys_product where {? 1=#AA# }", new { AA = 1 }); Console.WriteLine(DataTableUtil.ToString(dt)); var dt2 = _dba.QueryDataTable("select count(*) from sys_product where {?? 1=#AA# }", new { AA = 1 }); Console.WriteLine(DataTableUtil.ToString(dt2)); }
public void Trace() { DbAccessor dba = DbAccessor.Create(); dba.PreCommandExecute += new TraceHandler().PrintSqlByConsole; var dt = _dba.QueryDataTable("select top 10 * from sys_product"); Console.WriteLine(DataTableUtil.ToString(dt)); }
public void ConfigFileNameWithDbProviderName() { var dt = _dba.QueryDataTable("top8"); Console.WriteLine(DataTableUtil.ToString(dt)); dt = _dba.QueryDataTable("SysProduct.top8"); Console.WriteLine(DataTableUtil.ToString(dt)); }
protected override void Execute(CodeActivityContext context) { var dt = ReferenceDataTable.Get(context); foreach (var colIndex in DataTableUtil.IdentifyDataColumns(dt, Columns.Get(context)).OrderByDescending(v => v).ToArray()) { dt.Columns.RemoveAt(colIndex); } ReferenceDataTable.Set(context, dt); }
public void ToDataTableTest() { DataTable dt = new WorkbookDataAdapter(new HSSFWorkbook(new FileStream(@"C:\npoitest.xls", FileMode.Open, FileAccess.Read))) .AddOnRowAdapt(c => { bool result = true; return(result); }).ToDataTable(); Console.WriteLine(DataTableUtil.ToString(dt)); }
private void BindDropDownData() { DropDown_Type.DataSource = DataTableUtil.GetEnumKeyValue(typeof(SpecificationType)); DropDown_Type.DataTextField = "key"; DropDown_Type.DataValueField = "value"; DropDown_Type.DataBind(); if (TheSubmitType != -1) { DropDown_Type.SelectedValue = TheSubmitType.ToString(); } }
public List <NfeViewFaturamentoComposicaoAgrupadoDescricaoEntity> Listar(int grvId) { var SQL = new StringBuilder(); SQL.AppendLine("SELECT vw_dep_nfe_faturamento_composicao_agrupado_descricao.NumeroFormularioGrv"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.GrvId"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.AtendimentoId"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.CnaeId"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.Cnae"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.ListaServicoId"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.Servico"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.DescricaoConfiguracaoNfe"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.FlagEnviarValorIss"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.FlagEnviarInscricaoEstadual"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.QuantidadeComposicao"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.ValorTipoComposicao"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.ValorCalculadoSemDesconto"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.TipoDesconto"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.QuantidadeDesconto"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.ValorDesconto"); SQL.AppendLine(" ,vw_dep_nfe_faturamento_composicao_agrupado_descricao.TotalComDesconto"); SQL.AppendLine(" FROM dbo.vw_dep_nfe_faturamento_composicao_agrupado_descricao"); SQL.Append(" WHERE vw_dep_nfe_faturamento_composicao_agrupado_descricao.GrvId = ").Append(grvId).AppendLine(); using (var dataTable = DataBase.Select(SQL)) { if (dataTable == null) { return(null); } return(DataTableUtil.DataTableToList <NfeViewFaturamentoComposicaoAgrupadoDescricaoEntity>(dataTable)); } }
public void Delete() { SysProduct pro = new SysProduct(); pro.ProductId = 58; _dba.Delete(pro); var dt = _dba.QueryDataTable("select * from sys_product where ProductName=@ProductName", new { ProductName = "zwb" }); Console.WriteLine(DataTableUtil.ToString(dt)); }
private Func <DataRow, bool> GetCustomModeHandler(CodeActivityContext context, DataTable dt, Func <object, bool> predicate) { var indexes = DataTableUtil.IdentifyDataColumns(dt, Columns?.Get(context)); IEnumerable <object> filter(DataRow dr) => dr.ItemArray.Where((_, index) => indexes.Contains(index)); if (Operator == ConditionOperator.And) { return((DataRow dr) => filter(dr).Any(predicate)); } return((DataRow dr) => filter(dr).All(predicate)); }