private void verPolizasToolStripMenuItem_Click(object sender, EventArgs e) { if (b == null) { b = new busqueda(); b.MdiParent = this; b.FormClosed += new FormClosedEventHandler(busqueda_FormClosed); b.Show(); } else { b.Activate(); } }
public BusquedaEmpleoViewModel(busqueda entity) { this.id = entity.Id; this.title = entity.title; this.detail = entity.detail; this.price = entity.price; this.date = entity.date; this.customer_id = entity.customer_id; this.category_Id = entity.category_Id; this.resources = entity.resources; this.opcion_empleo = entity.opcion_empleo; this.compania = entity.compania; this.tiempo = entity.tiempo; this.experiencia = entity.experiencia; this.pago = entity.pago; this.salario = entity.salario; this.tipo = entity.tipo; }
private void Busquedas() { int total = 0; var data = new List <busqueda>(); using (var cmd = new SqlCommand(@"SELECT B.[Date], B.[ColectivoId], A.Name FROM[ASPAD_MSCRM].[dbo].[AspadLand_Traces] AS B WITH(NOLOCK) INNER JOIN account A WITH(NOLOCK) ON A.AccountId = B.ColectivoId WHERE Type = 9 AND A.AccountId <> '5D1AFCF7-77B1-E211-BD57-0050568A7D4D'")) { using (var cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["cns"].ConnectionString)) { cmd.Connection = cnn; cmd.CommandType = CommandType.Text; try { cmd.Connection = cnn; cmd.Connection.Open(); using (var rdr = cmd.ExecuteReader()) { while (rdr.Read()) { total++; var colectivoId = rdr.GetGuid(1); var name = rdr.GetString(2); var date = rdr.GetDateTime(0); var m = date > DateTime.Now.AddDays(-30) ? 1 : 0; var w = date > DateTime.Now.AddDays(-7) ? 1 : 0; if (!data.Any(d => d.id == colectivoId)) { data.Add(new busqueda { id = colectivoId, name = name, date = date, t = 1, m = m, w = w }); } else { var temp = new List <busqueda>(); foreach (var d1 in data) { if (d1.id == colectivoId) { var d2 = new busqueda { t = d1.t + 1, m = d1.m + m, w = d1.w + w, id = colectivoId, name = name }; temp.Add(d2); } else { temp.Add(d1); } } data = temp; } } } } finally { if (cmd.Connection.State != ConnectionState.Closed) { cmd.Connection.Close(); } } } } data = data.OrderBy(d => d.name).ToList(); var table = new StringBuilder(); var res = new StringBuilder(); bool first = true; foreach (var d in data) { table.AppendFormat(CultureInfo.InstalledUICulture, @"<tr><td>{0}</td><td align=""right"">{1}</td></tr>", d.name, d.t); if (first) { first = false; } else { res.Append(","); } res.AppendFormat( CultureInfo.InvariantCulture, @"{{""label"": ""{0}"", ""value"": {1} }}", d.name, d.t); } this.LtBusquedaData.Text = table.ToString(); this.LtBusquedasTotal.Text = total.ToString(); this.BusquedasScript = res.ToString(); }
void busqueda_FormClosed(object sender, EventArgs e) { b = null; }