public Boolean GuardarDB(tb_transportista_Info Info, ref decimal IdTransportista) { try { using (EntitiesGeneral oEnti = new EntitiesGeneral()) { var consulta = from q in oEnti.tb_transportista where q.IdEmpresa == Info.IdEmpresa && q.Cedula == Info.Cedula select q; if (consulta.ToList().Count == 0) { var registo = new tb_transportista(); registo.IdEmpresa = Info.IdEmpresa; registo.IdTransportista = Info.IdTransportista = IdTransportista = GetIdTransportista(Info.IdEmpresa); registo.Nombre = Info.Nombre; registo.Cedula = Info.Cedula; registo.Estado = Info.Estado; registo.Placa = Info.Placa; oEnti.tb_transportista.Add(registo); oEnti.SaveChanges(); } } return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
private void UCFa_Menu_Reportes_Load(object sender, EventArgs e) { try { dtpDesde.EditValue = DateTime.Now.AddMonths(-1); dtpHasta.EditValue = DateTime.Now.Date; Info_Nota.IdCatalogo = ""; Info_Nota.Nombre = "TODOS"; Info_Vendedor.IdVendedor = 0; Info_Vendedor.Ve_Vendedor = "TODOS"; lstSucuInfo = busSucursal.Get_List_Sucursal_Todos(param.IdEmpresa); gridSucursal.DataSource = lstSucuInfo; lstCatalogo = CatalogoBus.Get_List_catalogo(8); gridTipoDocumento.DataSource = lstCatalogo; lstNota = CatalogoBus.Get_List_catalogo(12); lstNota.Add(Info_Nota); cmbTipoNota.DataSource = lstNota; lstCliente = busCliente.Get_List_Cliente(param.IdEmpresa); gridViewCliente.DataSource = lstCliente; lstTipoNota = busTipoNota.Get_List_TipoNota_Todos(); gridViewMotivo.DataSource = lstTipoNota; lst_tipoNota = new List <string>(); foreach (var item in lstTipoNota) { if (item.no_Descripcion != "TODOS") { string tipo_nota = item.no_Descripcion + " */" + item.IdTipoNota.ToString("0000"); lst_tipoNota.Add(tipo_nota); } } checkedCombo_TipoNota.DataSource = lst_tipoNota; lstInfoMotiVta = busMotiVta.Get_List_fa_motivo_venta(param.IdEmpresa); gridViewTipoItem.DataSource = lstInfoMotiVta; ListVendedor = BusVendedor.Get_List_Vendedores(param.IdEmpresa); ListVendedor.Add(Info_Vendedor); cmb_Vendedor.DataSource = ListVendedor; lst_punto_Cargo_grupo = bus_punto_cargo_grupo.Get_List_punto_cargo_grupo(param.IdEmpresa, ref MensajeError); ct_punto_cargo_Info info_pc = new ct_punto_cargo_Info(); info_pc.nom_punto_cargo = "TODOS"; lst_punto_cargo.Add(info_pc); cmb_grupo.DataSource = lst_punto_Cargo_grupo; lst_punto_cargo = bus_punto_cargo.Get_List_PuntoCargo(param.IdEmpresa); ct_punto_cargo_grupo_Info info_pcg = new ct_punto_cargo_grupo_Info(); info_pcg.nom_punto_cargo_grupo = "TODOS"; cmb_punto_cargo.DataSource = lst_punto_cargo; listaPeriodo = bus_periodo.Get_List_Periodo(param.IdEmpresa, ref MensajeError); cmb_periodo_fin.DataSource = listaPeriodo; cmb_periodo_ini.DataSource = listaPeriodo; int IdPeriodo = Convert.ToInt32(DateTime.Now.Date.ToString("yyyy") + DateTime.Now.Date.ToString("MM")); bei_periodo_ini.EditValue = IdPeriodo; bei_periodo_fin.EditValue = IdPeriodo; lst_transportista = bus_transportista.Get_List_transportista(param.IdEmpresa); tb_transportista_Info info_tran = new tb_transportista_Info(); info_tran.Nombre = "TODOS"; lst_transportista.Add(info_tran); cmb_transportista.DataSource = lst_transportista; lst_centro_costo = bus_centro_costo.Get_list_Centro_Costo(param.IdEmpresa, ref MensajeError); cmb_CentroCosto.DataSource = lst_centro_costo; } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(ex.ToString()); } }