protected void FunCargarMantenimiento() { try { _dts = new ConsultaDatosDAO().FunConsultaDatos(180, int.Parse(ViewState["CodigoCEDE"].ToString()), 0, 0, "", "", "", Session["Conectar"].ToString()); ViewState["NivelArbol"] = _dts.Tables[0].Rows[0]["Nivel"].ToString(); ViewState["CodigoSpeechCab"] = "0"; lblEstado.Visible = false; ChkEstadoB.Visible = false; ChkEstadoB.Checked = true; TxtEditor1.Content = ""; TxtEditor2.Content = ""; ImgAddSpeech.Enabled = true; ImgModiSpeech.Enabled = false; GrdvSpeech.DataSource = null; GrdvSpeech.DataBind(); SoftCob_SPEECH_CABECERA _datos = new ArbolDecisionDAO().FunGetSpeechPorID(int.Parse(ViewState["CodigoCPCE"].ToString())); if (_datos != null) { ViewState["CodigoSpeechCab"] = _datos.SPCA_CODIGO; TxtEditor1.Content = _datos.spca_speechbv; ChkEstadoB.Visible = true; lblEstado.Visible = true; ChkEstadoB.Checked = _datos.spca_estado; ChkEstadoB.Text = _datos.spca_estado ? "Activo" : "Inactivo"; ViewState["usucreacion"] = _datos.spca_usuariocreacion; ViewState["fechacreacion"] = _datos.spca_fechacreacion; ViewState["terminalcreacion"] = _datos.spca_terminalcreacion; switch (ViewState["NivelArbol"].ToString()) { case "3": _dts = new ArbolDecisionDAO().FunGetArbolSpeechDet1(_datos.SPCA_CODIGO); break; case "4": _dts = new ArbolDecisionDAO().FunGetArbolSpeechDet(_datos.SPCA_CODIGO); break; } if (_dts.Tables[0].Rows.Count > 0) { ViewState["SpeechArbol"] = _dts.Tables[0]; GrdvSpeech.DataSource = _dts; GrdvSpeech.DataBind(); } } } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }
protected void ImgDelete_Click(object sender, ImageClickEventArgs e) { try { if (ViewState["CodigoArbol"].ToString() == "CEDENTE") { new FuncionesDAO().FunShowJSMessage("No se puede eliminar Cedente..!", this); return; } //_dtbaccion = (DataTable)ViewState["ArbolAccion"]; //_dtbefecto = (DataTable)ViewState["ArbolEfecto"]; //_dtbrespuesta = (DataTable)ViewState["ArbolRespuesta"]; //_dtbcontacto = (DataTable)ViewState["ArbolContacto"]; if (ViewState["CodigoArbol"].ToString() == "ACCION") { _dts = new ConsultaDatosDAO().FunConsultaDatos(122, 0, int.Parse(ViewState["CodigoARAC"].ToString()), 0, "", "", "", Session["Conectar"].ToString()); if (_dts.Tables[0].Rows.Count > 0) { new FuncionesDAO().FunShowJSMessage("No se puede Eliminar, existen gestiones registradas..!", this); return; } _dts = new ConsultaDatosDAO().FunConsultaDatos(142, 0, int.Parse(ViewState["CodigoARAC"].ToString()), 0, "", "", "", Session["Conectar"].ToString()); if (_dts.Tables[0].Rows.Count > 0) { new FuncionesDAO().FunShowJSMessage("Elimine primero los Efectos Registrados..!", this); return; } } if (ViewState["CodigoArbol"].ToString() == "EFECTO") { _dts = new ConsultaDatosDAO().FunConsultaDatos(122, 1, int.Parse(ViewState["CodigoAREF"].ToString()), 0, "", "", "", Session["Conectar"].ToString()); if (_dts.Tables[0].Rows.Count > 0) { new FuncionesDAO().FunShowJSMessage("No se puede Eliminar, existen gestiones registradas..!", this); return; } _dts = new ConsultaDatosDAO().FunConsultaDatos(142, 1, int.Parse(ViewState["CodigoAREF"].ToString()), 0, "", "", "", Session["Conectar"].ToString()); if (_dts.Tables[0].Rows.Count > 0) { new FuncionesDAO().FunShowJSMessage("Elimine primero las Respuestas Registradas..!", this); return; } } if (ViewState["CodigoArbol"].ToString() == "RESPUESTA") { _dts = new ConsultaDatosDAO().FunConsultaDatos(122, 2, int.Parse(ViewState["CodigoARRE"].ToString()), 0, "", "", "", Session["Conectar"].ToString()); if (_dts.Tables[0].Rows.Count > 0) { new FuncionesDAO().FunShowJSMessage("No se puede Eliminar, existen gestiones registradas..!", this); return; } _dts = new ConsultaDatosDAO().FunConsultaDatos(142, 2, int.Parse(ViewState["CodigoARRE"].ToString()), 0, "", "", "", Session["Conectar"].ToString()); if (_dts.Tables[0].Rows.Count > 0) { new FuncionesDAO().FunShowJSMessage("Elimine primero los Contacto Registrados..!", this); return; } } if (ViewState["CodigoArbol"].ToString() == "CONTACTO") { _dts = new ConsultaDatosDAO().FunConsultaDatos(122, 3, int.Parse(ViewState["CodigoARCO"].ToString()), 0, "", "", "", Session["Conectar"].ToString()); if (_dts.Tables[0].Rows.Count > 0) { new FuncionesDAO().FunShowJSMessage("No se puede Eliminar, existen gestiones registradas..!", this); return; } } foreach (TreeNode node in TrvCedenteArbol.Nodes[0].ChildNodes) { foreach (TreeNode childcpce in node.ChildNodes) { _codigocpce = childcpce.Value; _namecpce = childcpce.Text; if (_codigocpce == ViewState["CodigoCPCE"].ToString()) { foreach (TreeNode childaccion in childcpce.ChildNodes) { _namearac = childaccion.Text; _codigoarac = childaccion.Value; if (_codigoarac == ViewState["CodigoARAC"].ToString()) { if (ViewState["CodigoArbol"].ToString() == "ACCION") { childcpce.ChildNodes.Remove(TrvCedenteArbol.SelectedNode); _mensaje = new ArbolDecisionDAO().FunDelAccion(int.Parse(ViewState["CodigoARAC"].ToString()), int.Parse(ViewState["CodigoCPCE"].ToString())); break; } foreach (TreeNode childefecto in childaccion.ChildNodes) { _codigoaref = childefecto.Value; _namearef = childefecto.Text; if (_codigoaref == ViewState["CodigoAREF"].ToString()) { if (ViewState["CodigoArbol"].ToString() == "EFECTO") { childaccion.ChildNodes.Remove(TrvCedenteArbol.SelectedNode); _mensaje = new ArbolDecisionDAO().FunDelEfecto(int.Parse(ViewState["CodigoAREF"].ToString()), int.Parse(ViewState["CodigoCPCE"].ToString())); break; } foreach (TreeNode childrespuesta in childefecto.ChildNodes) { _codigoarre = childrespuesta.Value; _namearre = childrespuesta.Text; if (_codigoarre == ViewState["CodigoARRE"].ToString()) { if (ViewState["CodigoArbol"].ToString() == "RESPUESTA") { childefecto.ChildNodes.Remove(TrvCedenteArbol.SelectedNode); _mensaje = new ArbolDecisionDAO().FunDelRespuesta(int.Parse(ViewState["CodigoARRE"].ToString()), int.Parse(ViewState["CodigoCPCE"].ToString())); break; } } foreach (TreeNode childcontacto in childrespuesta.ChildNodes) { _codigoarco = childcontacto.Value; _namearco = childcontacto.Text; if (_codigoarco == ViewState["CodigoARCO"].ToString()) { if (ViewState["CodigoArbol"].ToString() == "CONTACTO") { childrespuesta.ChildNodes.Remove(TrvCedenteArbol.SelectedNode); _mensaje = new ArbolDecisionDAO().FunDelContacto(int.Parse(ViewState["CodigoARCO"].ToString()), int.Parse(ViewState["CodigoCPCE"].ToString())); break; } } } } } } } } } } } ImgDelete.Visible = false; LblDefinicion.InnerText = ""; PnlOpciones.Visible = false; } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }
protected void BtnGrabar_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(TxtEditor1.Content.Trim())) { new FuncionesDAO().FunShowJSMessage("Ingrese Speech de BienVenida..", this); return; } if (int.Parse(ViewState["CodigoCPCE"].ToString()) == 0) { new FuncionesDAO().FunShowJSMessage("Seleccione Catálogo del Cedente..", this); return; } SoftCob_SPEECH_CABECERA _datos = new SoftCob_SPEECH_CABECERA(); { _datos.SPCA_CODIGO = int.Parse(ViewState["CodigoSpeechCab"].ToString()); _datos.spca_cedecodigo = int.Parse(ViewState["CodigoCEDE"].ToString()); _datos.spca_cpcecodigo = int.Parse(ViewState["CodigoCPCE"].ToString()); _datos.spca_speechbv = TxtEditor1.Content; _datos.spca_estado = ChkEstadoB.Checked; _datos.spca_auxv1 = ""; _datos.spca_auxv2 = ""; _datos.spca_auxi1 = 0; _datos.spca_auxi2 = 0; _datos.spca_fum = DateTime.Now; _datos.spca_uum = int.Parse(Session["usuCodigo"].ToString()); _datos.spca_tum = Session["MachineName"].ToString(); } if (int.Parse(ViewState["CodigoSpeechCab"].ToString()) == 0) { _datos.spca_fechacreacion = DateTime.Now; _datos.spca_usuariocreacion = int.Parse(Session["usuCodigo"].ToString()); _datos.spca_terminalcreacion = Session["MachineName"].ToString(); } else { _datos.spca_fechacreacion = DateTime.Parse(ViewState["fechacreacion"].ToString()); _datos.spca_usuariocreacion = int.Parse(ViewState["usucreacion"].ToString()); _datos.spca_terminalcreacion = ViewState["terminalcreacion"].ToString(); } _dtbspeech = (DataTable)ViewState["SpeechArbol"]; if (_dtbspeech.Rows.Count > 0) { List <SoftCob_SPEECH_DETALLE> datos1 = new List <SoftCob_SPEECH_DETALLE>(); foreach (DataRow dr in _dtbspeech.Rows) { _codigo = new ArbolDecisionDAO().FunGetCodigoSpeechDet(int.Parse(ViewState["CodigoSpeechCab"].ToString()), int.Parse(dr["Codigo"].ToString())); datos1.Add(new SoftCob_SPEECH_DETALLE() { SPDE_CODIGO = _codigo, SPCA_CODIGO = int.Parse(ViewState["CodigoSpeechCab"].ToString()), spde_araccodigo = int.Parse(dr["codigoARAC"].ToString()), spde_arefcodigo = int.Parse(dr["codigoAREF"].ToString()), spde_arrecodigo = int.Parse(dr["codigoARRE"].ToString()), spde_arcocodigo = int.Parse(dr["codigoARCO"].ToString()), spde_speechad = dr["Speech"].ToString(), spde_observacion = dr["Observacion"].ToString(), spde_estado = dr["Estado"].ToString() == "Activo" ? true : false, spde_auxv1 = dr["auxv1"].ToString(), spde_auxv2 = dr["auxv2"].ToString(), spde_auxi1 = int.Parse(dr["auxi1"].ToString()), spde_auxi2 = int.Parse(dr["auxi2"].ToString()) }); } _datos.SoftCob_SPEECH_DETALLE = new List <SoftCob_SPEECH_DETALLE>(); foreach (SoftCob_SPEECH_DETALLE addDatos in datos1) { _datos.SoftCob_SPEECH_DETALLE.Add(addDatos); } } if (_datos.SPCA_CODIGO == 0) { _codigo = new ArbolDecisionDAO().FunCrearArbolSpeech(_datos); ViewState["CodigoSpeechCab"] = _codigo; } else { _codigo = new ArbolDecisionDAO().FunEditArbolSpeech(_datos); } if (_codigo == -1) { Lblerror.Text = "Error Inserción datos Arbol Sepeech.."; } else { _response = string.Format("{0}?MensajeRetornado={1}", Request.Url.AbsolutePath, "Guardado con Éxito"); Response.Redirect(_response, true); } } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }