void CargarSalidas() { try { using (Profit_RGEntities context = new Profit_RGEntities()) { var G = context.pConfirmarSalidaPCP().ToList(); pcpClass.Clear(); foreach (var item in G) { pcpClass.Add(new SalidaPCP { id_movimiento = item.ID, gerente = item.Gerente, empleado = item.Empleado, autorizacion = item.Razon, activo = item.Descripcion_del_Activo, seria1 = item.serial, desde = Convert.ToDateTime(item.Desde).ToString(), hasta = Convert.ToDateTime(item.Hasta).ToString(), salida = Convert.ToDateTime(item.Salida).ToString(), }); } grdSalida.DataSource = ""; grdSalida.DataSource = pcpClass; grdSalida.AutoGenerateColumns = false; grdSalida.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 FrmPCP_Load(object sender, EventArgs e) { try { using (var context = new Profit_RGEntities()) { timer1.Start(); timer1.Interval = 10000; var X = Screen.PrimaryScreen.Bounds.Width; var Y = Screen.PrimaryScreen.Bounds.Height; this.DesktopLocation = new Point(X - this.Width, Y - this.Height - 40); grdSalida.DataSource = ""; grdSalida.AutoGenerateColumns = false; var L = context.pConfirmarSalidaPCP().Count(); if (L > 0) { grdSalida.DataSource = ""; CargarSalidas(); } else { labelX1.Text = ""; lbl_noti.Text = "No hay Salidas para hoy."; //MessageBox.Show("No hay salidas pendientes","Profit Expansion",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); //this.Hide(); } } } 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); } }