private void FrmConsultor_Load(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { AutoCompleteStringCollection buscar2 = new AutoCompleteStringCollection(); List <GIT_Consultor> Li = context.GIT_Consultor.ToList(); foreach (var item in Li) { buscar2.Add(item.co_consultor.Trim()); } txtBuscar.AutoCompleteCustomSource = buscar2; } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } Navegar(0); }
private void txtUsuario_Leave(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { var usu = context.Usuarios.First(u => u.co_usuario == txtUsuario.Text.Trim()); if (usu == null) { txtDes_Usuario.Text = "NO ECONTRADO"; } else { txtDes_Usuario.Text = usu.nombre.Trim(); } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtAlmacen_Leave(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { var a = context.pSeleccionarAlmacenEmpresa(txtAlmacen.Text.Trim(), txtEmpresa.Text.Trim()).First(); if (a == null) { txtDes_Alm.Text = "NO ENCONTRADO"; } else { txtDes_Alm.Text = a.alm_des.Trim(); } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { if (Nuevo == true) { context.pInsertarLim_Credito(txtGrupo.Text.Trim(), txtTipo_cli.Text.Trim(), txtAutorizaN1.Text.Trim(), txtAutorizaN2.Text.Trim(), Convert.ToDecimal(txtDesdeUSD.Value), Convert.ToDecimal(txtHastaUSD.Value)); } else { context.pActualizarLim_Credito(txtGrupo.Text.Trim(), txtTipo_cli.Text.Trim(), txtAutorizaN1.Text.Trim(), txtAutorizaN2.Text.Trim(), Convert.ToDecimal(txtDesdeUSD.Value), Convert.ToDecimal(txtHastaUSD.Value), Validador); } } Navegar(5); MessageBox.Show(this, "Se ha guardado la informacion satisfactoriamente.", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { if (grdDatos.RowCount > 0) { Int32 i = grdDatos.CurrentCell.RowIndex; using (Profit_RGEntities context = new Profit_RGEntities()) { if (MessageBox.Show("Desea eliminar este registro?", "Profit Expansion", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes && Lh[i].fecha.Date >= System.DateTime.Today) { context.pEliminarExcepcion_P(Lh[i].rowguid); ActualizarDatos(); } else { MessageBox.Show("Solo puede eliminar registros futuros o del dia en curso!", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtCo_naviera_Leave(object sender, EventArgs e) { try { if (txtCo_naviera.Text.Trim().Length > 0) { pSeleccionarNaviera_Result naviera = new pSeleccionarNaviera_Result(); using (Profit_RGEntities context = new Profit_RGEntities()) { naviera = context.pSeleccionarNaviera(txtCo_naviera.Text.Trim()).FirstOrDefault(); } if (naviera == null) { txtNavi_des.Text = "NO ENCONTRADO"; } else { txtNavi_des.Text = naviera.navi_des.Trim(); } } } catch (DataException ex0) { MessageBox.Show(ex0.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGenerar_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Desea generar una nueva clave?", "Profit Expansion", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { string Clave = Passwords.GeneradorPassword.GetPassword(); Clipboard.SetDataObject(Clave); using (Profit_RGEntities context = new Profit_RGEntities()) { context.pInsertarGene_Claves(Clave.Trim(), cboUsuario.SelectedValue.ToString().Trim(), cboEmpresa.SelectedValue.ToString().Trim(), txtFec_Venc.Value, txtCantidad.Value); GrdDatos.AutoGenerateColumns = false; GrdDatos.DataSource = context.pSeleccionarGene_Claves().ToList(); GrdDatos.CurrentCell = GrdDatos[0, GrdDatos.RowCount - 1]; } } } catch (EntityException ex0) { MessageBox.Show(ex0.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAgregarR_Click(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { grdDatos.DataSource = ""; mtto55.Add(new RenglonesDG2 { codigoM = 0, idactivo = lActivo.Trim(), fec_emis = new DateTime(DateTime.Now.Ticks), observacion = "", valor = "", asesor = "", consultor = "", problema = "", solucion = "" }); grdDatos.DataSource = mtto55; grdDatos.AutoGenerateColumns = false; grdDatos.Refresh(); } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnQuitar_Click(object sender, EventArgs e) { try { if (mtto55.Count > 0) { if (MessageBox.Show(this, "Desea eliminar este renglón?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { foreach (var item in mtto55) { var i = grdDatos.CurrentRow.Cells[9].Value; using (var context = new Profit_RGEntities()) { mtto55.RemoveAt(grdDatos.CurrentCell.RowIndex); context.pGIT_MantenimientoEliminar(Guid.Parse(i.ToString())); grdDatos.DataSource = ""; grdDatos.DataSource = mtto55; grdDatos.CurrentCell = grdDatos[0, mtto55.Count - 1]; } } CargarMantenimiento(); } } } catch (Exception ex1) { MessageBox.Show(this, "El renglon ha sido eliminado satisfactoriamente", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnQuitar_Click(object sender, EventArgs e) { try { if (renglon1.Count > 0) { if (MessageBox.Show(this, "Desea eliminar este renglón?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { foreach (var item in renglon1) { var J = grddatos1.CurrentRow.Cells[7].Value; using (var context = new Profit_RGEntities()) { renglon1.RemoveAt(grddatos1.CurrentCell.RowIndex); context.pGIT_Asign_EquipoEliminar(Guid.Parse(J.ToString())); grddatos1.DataSource = ""; grddatos1.DataSource = renglon1; grddatos1.CurrentCell = grddatos1[0, renglon1.Count - 1]; } CargarAsignaciones(); } } } } catch (Exception ex1) { MessageBox.Show(this, "Su registro ha sido eliminado satisfactoriamente.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void CargarCombos() { try { using (var context = new Profit_RGEntities()) { Empresa.DataSource = context.GIT_Ubicaciones.ToList(); Empresa.DisplayMember = "descrip"; Empresa.ValueMember = "co_ubic"; consul.DataSource = context.GIT_Consultor.ToList(); consul.DisplayMember = "nombre"; consul.ValueMember = "co_consultor"; Empleado.DataSource = context.pSeleccionarEmpleados().ToList(); Empleado.DisplayMember = "nombre_completo".Trim(); Empleado.ValueMember = "cod_emp"; } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAgregarR_Click(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { grddatos1.DataSource = ""; renglon1.Add(new RenglonesDG { codigo = 0, empleado = "", empresa = "", activo = lActivo.Trim(), desde = new DateTime(DateTime.Now.Ticks), hasta = new DateTime(DateTime.Now.Ticks), consultor = "" }); grddatos1.DataSource = renglon1; grddatos1.AutoGenerateColumns = true; grddatos1.Refresh(); } } catch (Exception ex1) { MessageBox.Show(this, ex1.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void Guardar(Boolean Tipo1) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { if (Tipo1 == true) { context.pGIT_ConsultorInsertar(txtCo_consultor.Text.Trim(), txtDescripcion.Text.Trim()); } else { context.pGIT_ConsultorActualizar(txtCo_consultor.Text.Trim(), txtDescripcion.Text.Trim(), consultor1.Rowguid); } Navegar(5); MessageBox.Show(this, "Los datos fueron registrados exitosamente.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (EntityException ex1) { MessageBox.Show(this, ex1.InnerException.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(this, ex1.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Navegar(int p) { try { Nuevo = false; txtCo_consultor.Enabled = false; using (Profit_RGEntities context = new Profit_RGEntities()) { var pubi4 = context.pObtenerTablaStr(txtCo_consultor.Text.Trim(), "co_consultor", p, "GIT_Consultor").ToList(); if (pubi4.Count > 0) { consultor1 = context.pSeleccionarGIT_Consultor(pubi4[0].Trim()).FirstOrDefault(); txtCo_consultor.Text = consultor1.co_consultor; txtDescripcion.Text = consultor1.nombre; //var Imagen = ImagenBD.BytesToImage(Usuario.ilustracion) } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnQuitar_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Desea eliminar este articulo del embarque?", "Profit Administrativo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { using (Profit_RGEntities context = new Profit_RGEntities()) { if (grdDatos.RowCount > -1 && grdDatos.CurrentCell.RowIndex > -1) { System.Guid?R = new Guid(grdDatos[6, grdDatos.CurrentCell.RowIndex].Value.ToString()); context.pEliminarReng_emb(R); } CargarDetalle(context, txtViaje.Value); } } } catch (DataException ex0) { MessageBox.Show(ex0.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FrmMantActivo_Load(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { grdDatos.DataSource = ""; grdDatos.AutoGenerateColumns = false; CargarCombo(); if (context.pSeleccionarGIT_Mantenimiento(lActivo.Trim()).Count() > 0) { CargarMantenimiento(); } else if (context.pSeleccionarGIT_Asign_Equipo(lActivo.Trim()).Count() <= 0) { CargarCombo(); // renglon1.Add("1", "000002", "H1",lActivo.Trim (),new DateTime (DateTime.Now.Ticks), new DateTime(DateTime.Now.Ticks),"C001"); grdDatos.DataSource = ""; } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtCo_shipper_Leave(object sender, EventArgs e) { try { if (txtCo_shipper.Text.Trim().Length > 0) { pSeleccionarProv_Result shipper = new pSeleccionarProv_Result(); using (Profit_RGEntities context = new Profit_RGEntities()) { shipper = context.pSeleccionarProv(txtCo_consig.Text.Trim(), txtCo_shipper.Text.Trim()).FirstOrDefault(); } if (shipper == null) { txtShipper_des.Text = "NO ENCONTRADO"; } else { txtShipper_des.Text = shipper.prov_des.Trim(); } } } catch (DataException ex0) { MessageBox.Show(ex0.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Cargar el Combo para la autorizacion del movimiento. /// </summary> /// <param name="Codigo del Empleado"></param> /// <param name="e"></param> private void cbo_empleados_G_SelectedIndexChanged(object sender, EventArgs e) { try { using (var context = new Profit_RGEntities()) { var d = context.pseleccionarActivo_Asign_Super(searchE[cbo_empleados_G.SelectedIndex].cod_emp).Count(); if (d > 0) { var b = searchE[cbo_empleados_G.SelectedIndex].cod_emp.Trim().ToString(); cbo_activo23.DataSource = context.pSeleccionarEmpleadoSupervisado(b).ToList(); cbo_activo23.DisplayMember = "Datos"; cbo_activo23.ValueMember = "id_activo"; // cbo_activo23.Text = context.pSeleccionarEmpleadoSupervisado(b).ToList().ToString (); } else { MessageBox.Show("El empelado no tiene activos Asignados", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); cbo_empleados_G.SelectedItem = -1; cbo_activo23.SelectedItem = -1; } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAnular_Click(object sender, EventArgs e) { try { if (GrdDatos.RowCount > 0) { if (MessageBox.Show("Desea anular esta clave?", "Profit Expansion", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { if (GrdDatos[6, GrdDatos.CurrentCell.RowIndex].Value.ToString() != "ANU") { using (Profit_RGEntities context = new Profit_RGEntities()) { context.pAnulaClave(GrdDatos[8, GrdDatos.CurrentCell.RowIndex].Value.ToString().Trim()); GrdDatos.AutoGenerateColumns = false; GrdDatos.DataSource = context.pSeleccionarGene_Claves().ToList(); } } else { MessageBox.Show("La clave ya ha sido anulada!", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } catch (EntityException ex0) { MessageBox.Show(ex0.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FrmAutorizaG_Load(object sender, EventArgs e) { try { using (var context = new Profit_RGEntities()) { System.DateTime D1 = System.DateTime.Now; txt_fecha_actual_G.Text = D1.ToShortDateString(); txt_fecha_S.Text = D1.ToShortDateString(); radPageAutorizaG.Focus(); bloquearControles(); cargarcombo(); // date_desde.Value = DateTime.Now; //Frmlogin KL = new Frmlogin(); //labelX1.Text = KL.txtUsuario.Text.Trim ().ToString (); } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FrmClave_Load(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { var Lu = context.pUsuariosProfit().ToList(); cboUsuario.DataSource = Lu; cboUsuario.DisplayMember = "last_name"; cboUsuario.ValueMember = "employee_i"; cboEmpresa.DataSource = context.Empresas.ToList(); cboEmpresa.DisplayMember = "des_emp"; cboEmpresa.ValueMember = "co_empresa"; GrdDatos.AutoGenerateColumns = false; GrdDatos.DataSource = context.pSeleccionarGene_Claves().ToList(); } txtFec_Venc.Value = System.DateTime.Now; } catch (EntityException ex0) { MessageBox.Show(ex0.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void grdArt_CellClick(object sender, DataGridViewCellEventArgs e) { if (grdArt.RowCount > 0) { using (Profit_RGEntities context = new Profit_RGEntities()) { txtCo_art_Leave(sender, e); GrdStock.AutoGenerateColumns = false; var lEmpAut = context.pSeleccionarEmpresasCA(Co_usu.Trim()).ToList(); List <Stock> LStock = new List <Stock>(); foreach (var item in lEmpAut) { var lstStock = context.pSeleccionarStock(item.co_empresa.Trim(), txtCo_alma.Text.Trim(), grdArt[0, e.RowIndex].Value.ToString().Trim()).ToList(); if (lstStock.Count > 0) { LStock.Add(new Stock { empresa = item.co_empresa, stock_act = lstStock[0].STOCK_ACT, stock_com = lstStock[0].STOCK_COM, stock_dis = lstStock[0].STOCK_DIS, stock_lle = lstStock[0].STOCK_Lle }); } } GrdStock.DataSource = LStock; } } }
private void ObtenerNombre(int N) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { switch (N) { case 1: txtNombre1.Text = context.Usuarios.Where(u => u.co_usuario.Trim() == txtAutorizaN1.Text.Trim()).FirstOrDefault().nombre.Trim(); break; case 2: txtNombre2.Text = context.Usuarios.Where(u => u.co_usuario.Trim() == txtAutorizaN2.Text.Trim()).FirstOrDefault().nombre.Trim(); break; } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void GrdStock_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (GrdStock.RowCount > 0) { using (Profit_RGEntities context = new Profit_RGEntities()) { GrdFact.AutoGenerateColumns = false; string em = GrdStock[0, e.RowIndex].Value.ToString(); GrdFact.DataSource = context.pUltimasFacturas(em, txtCo_alma.Text.Trim(), txtCo_art.Text.Trim()); GrdPed.AutoGenerateColumns = false; GrdPed.DataSource = context.pPedidosPendientes(em, txtCo_alma.Text.Trim(), txtCo_art.Text.Trim()); } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { if (Nuevo == true) { context.pInsertarPantalla_Stock(txtUsuario.Text.Trim(), txtEmpresa.Text.Trim(), txtAlmacen.Text.Trim()); } else { context.pActualizarPantalla_Stock(txtEmpresa.Text.Trim(), txtAlmacen.Text.Trim(), Validador); } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FrmArt_Load(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { var Pstock = context.pSeleccionarPantalla_Stock(Co_usu.Trim()).ToList(); if (Pstock.Count == 0) { MessageBox.Show("Debe configurar la pantalla para el usuario activo.", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); btnBuscar.Enabled = false; } else { txtCo_alma.Text = Pstock[0].Almacen.Trim(); txtAlm_des.Text = context.pSeleccionarAlmacenEmpresa(Pstock[0].Almacen.Trim(), Pstock[0].Emp_Art.Trim()).First().alm_des.Trim(); Emp = Pstock[0].Emp_Art.Trim(); txtCo_art.Focus(); } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtEmpresa_Leave(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { var em = context.Empresas.First(emp => emp.co_empresa == txtEmpresa.Text.Trim()); if (em == null) { txtDes_emp.Text = "NO ENCONTRADO"; } else { txtDes_emp.Text = em.des_emp.Trim(); } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtCo_consig_Leave(object sender, EventArgs e) { try { if (txtCo_consig.Text.Trim().Length > 0) { //ProfitDsTableAdapters.empresasTableAdapter emp = new ProfitDsTableAdapters.empresasTableAdapter(); //ProfitDs.empresasDataTable Dt = new ProfitDs.empresasDataTable(); //emp.Fill(Dt); List <Empresa> Dt = new List <Empresa>(); using (Profit_RGEntities context = new Profit_RGEntities()) { Dt = context.Empresas.ToList(); } var Emp = Dt.FirstOrDefault(c => c.co_empresa.Trim() == txtCo_consig.Text.Trim()); if (Emp == null) { txtDes_consig.Text = "NO ENCONTRADO"; } else { txtDes_consig.Text = Emp.des_emp.Trim(); } } } catch (DataException ex0) { MessageBox.Show(ex0.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cboReporte_Click(object sender, EventArgs e) { try { using (Profit_RGEntities context = new Profit_RGEntities()) { var filtros = context.Filtros.Where(f => f.cod_rep == cboReporte.SelectedValue.ToString()).ToList(); var reporte = context.Reportes.Where(r => r.cod_rep.Trim() == cboReporte.SelectedValue.ToString().Trim()).First(); StoreProcedure = reporte.funcion.Trim(); foreach (var item in filtros) { switch (item.tipo.Trim()) { case "Char": TextBox F1 = new System.Windows.Forms.TextBox(); F1.Location = new System.Drawing.Point(cboReporte.Left, cboReporte.Top + 30); F1.Name = "F1"; F1.Size = new System.Drawing.Size(88, 21); F1.TabIndex = 0; F1.Text = ""; Controls.Add(F1); break; } } } } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Buscar() { try { Nuevo = false; using (Profit_RGEntities context = new Profit_RGEntities()) { pSeleccionarGIT_Ubicaciones_Result Ubicacion1 = new pSeleccionarGIT_Ubicaciones_Result(); var pubi1 = context.GIT_Consultor.Where(xD => xD.co_consultor == txtBuscar.Text.Trim()).ToList(); if (pubi1.Count > 0) { consultor1 = context.pSeleccionarGIT_Consultor(pubi1[0].co_consultor.Trim().ToUpper()).FirstOrDefault(); txtCo_consultor.Text = consultor1.co_consultor.Trim(); txtDescripcion.Text = consultor1.nombre.Trim(); txtBuscar.Text = ""; txtCo_consultor.Focus(); } else { MessageBox.Show("El registro no existe", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); txtBuscar.Focus(); } } } catch (EntityException ex) { MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }