protected void rdgCursos_DeleteCommand(object sender, GridCommandEventArgs e) { try { string strResultado = string.Empty; GridEditableItem ObjItem = (GridEditableItem)e.Item; Hashtable ObjHashtable = new Hashtable(); course objCurso = new course(); ObjItem.ExtractValues(ObjHashtable); objCurso.id = Convert.ToInt32(ObjHashtable["idCurso"]); clsCurso curso = new clsCurso(); curso.prCurso = objCurso; strResultado = curso.EliminarCurso(); if (string.IsNullOrEmpty(strResultado)) { rdgCursos.Rebind(); base.EnvioMensaje("Registro eliminado correctamente.", 2, Manejador); } else { rdgCursos.Rebind(); base.EnvioMensaje(strResultado, 1, Manejador); } } catch (Exception ex) { base.EnvioMensaje("Error al eliminar datos.", 1, this.Manejador); } }
protected void Grabar() { string strResultado = string.Empty; strResultado = ReglasNegocio(); if (string.IsNullOrEmpty(strResultado)) { course objCurso = new course(); objCurso.name = this.txtName.Text; objCurso.id_career = Convert.ToInt32(this.cmbCarrera.SelectedValue); objCurso.is_enabled = true; clsCurso curso = new clsCurso(); curso.prCurso = objCurso; strResultado = curso.AgregarCurso(); if (string.IsNullOrEmpty(strResultado)) { base.EnvioMensaje("Registro agregado correctamente.", 2, this.Manejador); } else { base.EnvioMensaje(strResultado, 1, this.Manejador); } } else { base.EnvioMensaje(strResultado, 1, this.Manejador); } }
protected void rdgCursos_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { try { string strResultado = string.Empty; GridEditableItem ObjItem = (GridEditableItem)e.Item; Hashtable ObjHashTable = new Hashtable(); course objCurso = new course(); ObjItem.ExtractValues(ObjHashTable); objCurso.id = Convert.ToInt32(ObjHashTable["idCurso"]); objCurso.name = IsNull(ObjHashTable["nombre"]) ? "" : ObjHashTable["nombre"].ToString(); objCurso.id_career = IsNull(ObjHashTable["name"]) ? 0 : Convert.ToInt32(ObjHashTable["name"]); strResultado = ReglasNegocio(objCurso); if (strResultado.Equals(string.Empty)) { clsCurso curso = new clsCurso(); curso.prCurso = objCurso; strResultado = curso.EditarCurso(); if (strResultado.Equals(string.Empty)) { base.EnvioMensaje("Datos actualizados correctamente.", 2, this.Manejador); this.rdgCursos.Rebind(); } else { base.EnvioMensaje(strResultado, 2, this.Manejador); } } else { base.EnvioMensaje(strResultado, 1, this.Manejador); } } catch (Exception ex) { this.rdgCursos.MasterTableView.ClearEditItems(); base.EnvioMensaje("Error al actualizar datos: " + ex.Message.ToString(), 1, this.Manejador); } }