Exemplo n.º 1
0
        public bool CreateDocuments(List <Document> docs)
        {
            if (docs == null | docs?.Count == 0)
            {
                return(false);
            }

            foreach (Document doc in docs)
            {
                var query = SqlQueryBuilder.InsertDoc(doc, DBConnection);
                CommitDML(query);
                //try
                //{
                //    query.Transaction = DBConnection.BeginTransaction(IsolationLevel.Serializable);
                //    query.ExecuteNonQuery();
                //    query.Transaction.Commit();
                //}
                //catch (Exception e)
                //{
                //    query.Transaction.Rollback();
                //    MessageBox.Show("Ошибка в функции создания документа: " + e.Message);
                //    return false;
                //}
            }
            return(true);
        }
Exemplo n.º 2
0
        public bool InsertDocuments(List <Document> docsAfterEdit)
        {
            if (docsAfterEdit == null)
            {
                return(false);
            }

            bool result = true;

            foreach (Document doc in docsAfterEdit)
            {
                var insert = SqlQueryBuilder.InsertDoc(doc, DBConnection);
                result &= CommitDML(insert);
            }

            return(result);
        }