//REALIZA MANTENIMIENTO DE DE AREAS public Area_Result Managment_Area(Area _area, int Action) { P_Area dao = new P_Area(); Area_Result ar = dao.Managment_Area(_area, Action); return(ar); }
public String Managment_Area(Area_S _area) { B_Area b_Area = new B_Area(); Area_Result a = b_Area.Managment_Area(new Area(_area.AreaId, _area.are_Nombre, _area.are_Descripcion, _area.are_Estado), _area.Action); var jsonSerialiser = new JavaScriptSerializer(); var json = jsonSerialiser.Serialize(a); return(json); }
public Area_Result Managment_Area(Area _area, int Action) { Area_Result resu = new Area_Result(); using (SqlConnection connection = new SqlConnection(cadena)) { try { String id = ""; connection.Open(); SqlCommand command = new SqlCommand("VR_Managment_Area", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@AreaId", SqlDbType.Int).Value = _area.AreaId; command.Parameters.Add("@are_Nombre", SqlDbType.VarChar).Value = _area.are_Nombre; command.Parameters.Add("@are_Descripcion", SqlDbType.VarChar).Value = _area.are_Descripcion; command.Parameters.Add("@are_Estado", SqlDbType.Int).Value = _area.are_Estado; command.Parameters.Add("@Action", SqlDbType.Int).Value = Action; SqlDataReader reader = command.ExecuteReader(CommandBehavior.SingleResult); if (reader.HasRows) { if (reader.Read()) { id = reader.GetValue(0).ToString(); } } reader.Close(); connection.Close(); resu.Result = 1; resu.Message = id; } catch (Exception e) { connection.Close(); resu.Result = 0; resu.Message = e.Message; } } return(resu); }