public Int32 CreaJunta(Junta objJunta) { try { objconeccion = new SqlConnection(CadenaConexionSQL); SqlCommand objcomand = new SqlCommand("insertar_junta", objconeccion); objcomand.CommandType = CommandType.StoredProcedure; objcomand.Parameters.Add("@D_Fecha", SqlDbType.Date); objcomand.Parameters["@D_Fecha"].Value = objJunta.D_Fecha; objcomand.Parameters.Add("@C_Hora", SqlDbType.VarChar, 10); objcomand.Parameters["@C_Hora"].Value = objJunta.C_Hora; objcomand.Parameters.Add("@C_Tema", SqlDbType.VarChar,200); objcomand.Parameters["@C_Tema"].Value = objJunta.C_Tema; objcomand.Parameters.Add("@C_Acuerdo", SqlDbType.VarChar, 1000); objcomand.Parameters["@C_Acuerdo"].Value = objJunta.C_Acuerdo; objconeccion.Open(); Int32 id; id = Convert.ToInt32(objcomand.ExecuteScalar()); objconeccion.Close(); return id; } catch (Exception ex) { if (objconeccion.State == ConnectionState.Open) objconeccion.Close(); throw new Exception(ex.Message); } }
public int CreaJunta(DateTime D_Fecha, string C_Hora, string C_Tema, string C_Acuerdo) { try { Junta ObjJunta = new Junta(); ObjJunta.D_Fecha = D_Fecha; ObjJunta.C_Hora = C_Hora; ObjJunta.C_Tema = C_Tema; ObjJunta.C_Acuerdo = C_Acuerdo; return ObjjuntaDAO.CreaJunta(ObjJunta); } catch (Exception exception) { throw new FaultException<RetornaMensaje> (new RetornaMensaje { Mensage = string.Format(resMensajes.msjNoRegistrado, "Cuota"), CodigoError = exception.GetHashCode().ToString(), Exito = false } , new FaultReason(exception.Message)); } }