public List <ATTACHMENTDC> Insert(List <ATTACHMENTDC> objATTACHMENTs) { List <ATTACHMENTDC> attachmentsList = new List <ATTACHMENTDC>(); DBConnection objConnection = new DBConnection(); ATTACHMENTDA objATTACHMENTDA = new ATTACHMENTDA(); try { var attachments = SetNecessaryFields(objATTACHMENTs); objConnection.Open(true); attachmentsList = objATTACHMENTDA.Insert(objConnection, attachments); objConnection.Commit(); } catch (Exception ex) { objConnection.Rollback(); throw ex; } finally { objConnection.Close(); } return(attachmentsList); }
public ATTACHMENTDC Insert(ATTACHMENTDC objATTACHMENT) { ATTACHMENTDC addedAttachmentdc; DBConnection objConnection = new DBConnection(); ATTACHMENTDA objATTACHMENTDA = new ATTACHMENTDA(); try { objConnection.Open(true); objATTACHMENT.FILE_SIZE = TransformFileSize(objATTACHMENT.FILE_SIZE); addedAttachmentdc = objATTACHMENTDA.Insert(objConnection, objATTACHMENT); objConnection.Commit(); } catch (Exception ex) { objConnection.Rollback(); throw ex; } finally { objConnection.Close(); } return(addedAttachmentdc); }