//"http://localhost:63029/ws.svc/", protected void GridViewHash_RowCommand(object sender, GridViewCommandEventArgs e) { C_comunityManager objCM = new C_comunityManager(); string codigoCM; string codigoRS; string[] commandArgs; // switch (e.CommandName) { case "GuardarHash": // //string CMNuevo = ((TextBox)GridViewHash.FooterRow.FindControl("tbHashIdNuevo")).Text; //// public int guardarCM(int codigoRS, string codigoCM, string nombre, string nickname,/* bool activo,*/ int numAmigos, string agrupacion, string localizacion, bool asignado, string idLocalizacion, string contacto, int id_room, bool hashtag) //string RSNuevo = ((DropDownList)GridViewHash.FooterRow.FindControl("dpRsHashNew")).SelectedValue.ToString(); //int id_room_nuevo = Convert.ToInt32(dpRooms.SelectedItem.Value.ToString()); //int result = objCM.guardarCM(Convert.ToInt32(RSNuevo), CMNuevo, "", "", 0, null, "", true, "", "", id_room_nuevo, true); //gvPost.EditIndex = -1; //bindDatos(); //int resultado = objCM.guardarCM(Convert.ToInt32(codigoRS), codigoCM, nombre, nickname, /*activo,*/ Convert.ToInt32(nAmigos), agrupacion, pais, asignado, idpais, contacto, id_room, hashtag); //gvPost.EditIndex = -1; //bindDatos(); break; case "BorrarHash": codigoCM = e.CommandArgument.ToString(); int id_room_borrar = Convert.ToInt32(dpRooms.SelectedItem.Value.ToString()); objCM.deleteCM(codigoCM, id_room_borrar); gvPost.EditIndex = -1; bindDatos(); break; case "GuardarNuevoHash": // string CMNuevo = ((TextBox)GridViewHash.FooterRow.FindControl("tbHashIdNuevo")).Text; // public int guardarCM(int codigoRS, string codigoCM, string nombre, string nickname,/* bool activo,*/ int numAmigos, string agrupacion, string localizacion, bool asignado, string idLocalizacion, string contacto, int id_room, bool hashtag) string RSNuevo = ((DropDownList)GridViewHash.FooterRow.FindControl("dpRsHashNew")).SelectedValue.ToString(); int id_room_nuevo = Convert.ToInt32(dpRooms.SelectedItem.Value.ToString()); string nickname = "#" + CMNuevo; int result = objCM.guardarCM(Convert.ToInt32(RSNuevo), CMNuevo, "", nickname, 0, null, "", false, "", "", id_room_nuevo, true); gvPost.EditIndex = -1; bindDatos(); break; } }
protected void gvPost_RowCommand(object sender, GridViewCommandEventArgs e) { C_comunityManager objCM = new C_comunityManager(); string codigoCM; string codigoRS; string[] commandArgs; // switch (e.CommandName) { case "Guardar": // codigoCM = ((TextBox)gvPost.Rows[gvPost.EditIndex].FindControl("hidCM")).Text; codigoRS = ((TextBox)gvPost.Rows[gvPost.EditIndex].FindControl("hidRS")).Text; //string codigoCMNew = ((TextBox)gvPost.Rows[gvPost.EditIndex].FindControl("tbCM")).Text; //string codigoRSNew = ((DropDownList)gvPost.Rows[gvPost.EditIndex].FindControl("dpRS")).SelectedValue; string nombre = ((TextBox)gvPost.Rows[gvPost.EditIndex].FindControl("tbNombre")).Text; string nickname = ((Label)gvPost.Rows[gvPost.EditIndex].FindControl("tbNickName")).Text; string nAmigos = ((Label)gvPost.Rows[gvPost.EditIndex].FindControl("tbNAmigos")).Text; string agrupacion = ((DropDownList)gvPost.Rows[gvPost.EditIndex].FindControl("dpAgrupacion")).SelectedValue.ToString(); string idpais = hidCodPais.Value; string pais = ((TextBox)gvPost.Rows[gvPost.EditIndex].FindControl("tbPais")).Text; // DUDA string contacto = ((TextBox)gvPost.Rows[gvPost.EditIndex].FindControl("tbContacto")).Text; //bool activo = ((CheckBox)gvPost.Rows[gvPost.EditIndex].FindControl("chkActivo")).Checked; bool asignado = ((CheckBox)gvPost.Rows[gvPost.EditIndex].FindControl("chkAsignado")).Checked; bool hashtag = false; int id_room = Convert.ToInt32(dpRooms.SelectedItem.Value.ToString()); if (nAmigos.Trim() == "") { nAmigos = "0"; } if (nombre.Trim() == "" || nickname.Trim() == "" || nAmigos.Trim() == "" || agrupacion.Trim() == "" || pais.Trim() == "") { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "validacionEditar", "alert('Por favor, debes rellenar todos los campos');", true); } else { int resultado = objCM.guardarCM(Convert.ToInt32(codigoRS), codigoCM, nombre, nickname, /*activo,*/ Convert.ToInt32(nAmigos), agrupacion, pais, false, idpais, contacto, id_room, false); gvPost.EditIndex = -1; bindDatos(); } break; case "Borrar": // codigoCM = e.CommandArgument.ToString(); int id_room_borrar = Convert.ToInt32(dpRooms.SelectedItem.Value.ToString()); objCM.deleteCM(codigoCM, id_room_borrar); gvPost.EditIndex = -1; bindDatos(); break; case "GuardarNuevo": // string CMNuevo = ((TextBox)gvPost.FooterRow.FindControl("tbNuevoCM")).Text; string nombreNuevo = ((TextBox)gvPost.FooterRow.FindControl("tbNuevoNombre")).Text; string nicknameNuevo = ((TextBox)gvPost.FooterRow.FindControl("tbNuevoNickName")).Text; string RSNuevo = ((DropDownList)gvPost.FooterRow.FindControl("dpNuevoRS")).SelectedValue.ToString(); string nAmigosNuevo = ((TextBox)gvPost.FooterRow.FindControl("tbNuevoNAmigos")).Text; string agrupacionNuevo = ((DropDownList)gvPost.FooterRow.FindControl("dpNuevoAgrupacion")).SelectedValue.ToString(); string idpaisNuevo = hidCodPais.Value; string paisNuevo = ((TextBox)gvPost.FooterRow.FindControl("tbNuevoPais")).Text; int id_room_nuevo = Convert.ToInt32(dpRooms.SelectedItem.Value.ToString()); // DUDA string contactoNuevo = ((TextBox)gvPost.FooterRow.FindControl("tbNuevoContacto")).Text; //bool activoNuevo = ((CheckBox)gvPost.FooterRow.FindControl("chkNuevoActivo")).Checked; //bool asignadoNuevo = ((CheckBox)gvPost.FooterRow.FindControl("chkNuevoAsignado")).Checked; if (nAmigosNuevo.Trim() == "") { nAmigosNuevo = "0"; } if (CMNuevo.Trim() == "" || nombreNuevo.Trim() == "" || nicknameNuevo.Trim() == "" || RSNuevo.Trim() == "" || nAmigosNuevo.Trim() == "" || agrupacionNuevo.Trim() == "" || paisNuevo.Trim() == "") { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "validacionNuevo", "alert('Por favor, debes rellenar todos los campos');", true); } else { int result = objCM.guardarCM(Convert.ToInt32(RSNuevo), CMNuevo, nombreNuevo, nicknameNuevo, Convert.ToInt32(nAmigosNuevo), agrupacionNuevo, paisNuevo, false, idpaisNuevo, contactoNuevo, id_room_nuevo, false); gvPost.EditIndex = -1; bindDatos(); } break; } }