public void OnAsignacionHandler(object sender, DataEventArgs e) { // cargar el nodo var exp = new e_expedientes(); var llam = new z_llamados(); try { exp = exp.getObjecte_expedientes(e.Id); llam = llam.getObjectz_llamados(exp.codigo_llamado); var tn = new LlamadoTreeNode(exp.seis2 + " / " + exp.cero5) { ImageKey = llam.clave, SelectedImageKey = llam.clave, NodeId = exp.id_expediente, NodeType = TipoElemento.Expediente }; // carros pedidos // agregar al árbol treeExpedientes.Nodes.Add(tn); treeExpedientes.SelectedNode = tn; } catch (Exception ex) { Log.Write(ex); MessageBox.Show("No se pudo completar la operación debido a un error de Base de Datos.", "Mensaje de ZEUS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } //CargarExpedientes(_id_operadora); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { var id_operadora = (int)((object[])e.Argument)[0]; var exps = new e_expedientes(); //treeExpedientes.Nodes.Clear(); var nodes = new List <TreeNode>(); try { // expedientes normales DataSet ds = exps.Gete_expedientes_operadora_all(id_operadora); // agregar al árbol foreach (DataRow dr in ds.Tables[0].Rows) { var tn = new LlamadoTreeNode(dr["seis2"] + " / " + dr["cero5"]) { ImageKey = dr["clave"].ToString(), SelectedImageKey = (dr["clave"] + "s") }; if ((bool)dr["sit_controlada"]) { tn.ImageKey = dr["clave"] + "-ok"; tn.SelectedImageKey = dr["clave"] + "-oks"; } tn.NodeId = (int)dr["id_expediente"]; tn.Fecha = (DateTime)dr["fecha"]; tn.NodeType = TipoElemento.Expediente; // carros pedidos var carros = new e_carros_usados(); DataSet dt = carros.Gete_carros_exp(tn.NodeId); foreach (DataRow dw in dt.Tables[0].Rows) { var te = new LlamadoTreeNode(dw["nombre"].ToString()) { ImageKey = ((string)dw["seis"]), SelectedImageKey = ((string)dw["seis"] + "s"), NodeId = ((int)dw["id_carro"]), NodeType = TipoElemento.Carro, NodeOrder = Convert.ToInt64(dw["id_despachado"]) }; tn.Nodes.Add(te); } // agregar al árbol //treeExpedientes.Nodes.Add(tn); nodes.Add(tn); } // expedientes falsos (claves de servicios) var ec = new e_carros_usados(); // -1: 6-13 ds = ec.Gete_carros_exp(-1); if (ds.Tables[0].Rows.Count != 0) { var tn = new LlamadoTreeNode("TRAMITE DE COMPAÑIA") { NodeId = (-1), Fecha = DateTime.MinValue, ImageKey = "6-13", SelectedImageKey = "6-13s", NodeType = TipoElemento.Servicio }; foreach (DataRow dr in ds.Tables[0].Rows) { var te = new LlamadoTreeNode(dr["nombre"].ToString()) { ImageKey = ((string)dr["seis"]), SelectedImageKey = ((string)dr["seis"] + "s"), NodeId = ((int)dr["id_carro"]), NodeType = TipoElemento.Carro, NodeOrder = Convert.ToInt64(dr["id_despachado"]) }; tn.Nodes.Add(te); } //treeExpedientes.Nodes.Add(tn); nodes.Add(tn); } // -2: 6-14 ds = ec.Gete_carros_exp(-2); if (ds.Tables[0].Rows.Count != 0) { var tn = new LlamadoTreeNode("CARGA DE COMBUSTIBLE") { NodeId = (-2), Fecha = DateTime.MinValue, ImageKey = "6-14", SelectedImageKey = "6-14s", NodeType = TipoElemento.Servicio }; foreach (DataRow dr in ds.Tables[0].Rows) { var te = new LlamadoTreeNode(dr["nombre"].ToString()) { ImageKey = ((string)dr["seis"]), SelectedImageKey = ((string)dr["seis"] + "s"), NodeId = ((int)dr["id_carro"]), NodeType = TipoElemento.Carro, NodeOrder = Convert.ToInt64(dr["id_despachado"]) }; tn.Nodes.Add(te); } //treeExpedientes.Nodes.Add(tn); nodes.Add(tn); } // -3: 6-15 ds = ec.Gete_carros_exp(-3); if (ds.Tables[0].Rows.Count != 0) { var tn = new LlamadoTreeNode("SE DIRIGE A SERVICIO DE SALUD") { NodeId = (-3), Fecha = DateTime.MinValue, ImageKey = "6-15", SelectedImageKey = "6-15s", NodeType = TipoElemento.Servicio }; foreach (DataRow dr in ds.Tables[0].Rows) { var te = new LlamadoTreeNode(dr["nombre"].ToString()) { ImageKey = ((string)dr["seis"]), SelectedImageKey = ((string)dr["seis"] + "s"), NodeId = ((int)dr["id_carro"]), NodeType = TipoElemento.Carro, NodeOrder = Convert.ToInt64(dr["id_despachado"]) }; tn.Nodes.Add(te); } //treeExpedientes.Nodes.Add(tn); nodes.Add(tn); } } catch (Exception ex) { Log.ShowAndLog(ex); } e.Result = new[] { nodes.ToArray(), ((object[])e.Argument)[1] }; }