protected void btnGuardarRols_Click(object sender, EventArgs e) { clsRol rol = new clsRol(); rol.SRol_name = txtRol.Text; if (string.IsNullOrEmpty(txtCodigo.Text)) { int iRol_id = CRol.Insert(rol); txtCodigo.Text = iRol_id.ToString(); pnlBuscar.Visible = true; LoadRoles(); grdRols.Enabled = true; } else { rol.IRol_id = Convert.ToInt32(txtCodigo.Text); rol.sStatus = 0; CRol.Update(rol); LoadRoles(); pnlNuevo.Visible = false; grdRols.Enabled = true; } }
private static clsRol Load(DataRow fila) { clsRol objProxy = new clsRol(); objProxy.IRol_id = Convert.ToInt32(fila["iRol_id"]); objProxy.SRol_name = fila["sRol_name"].ToString(); objProxy.sStatus = Convert.ToInt32(fila["bStatus"]); return objProxy; }
public static int Insert(clsRol objProxy) { ValidationException x = new ValidationException(); if (string.IsNullOrEmpty(objProxy.SRol_name)) x.AgregarError("Ingrese el nombre del rol"); if (x.Cantidad > 0) throw x; DAORol daoProxy = new DAORol(); return daoProxy.Insert(objProxy.SRol_name,objProxy.sStatus); }