public void Delete(SqlTransaction trans = null)
        {
            if (local == true)
            {
                throw new Exception("Can't call ChemicalQuery.Delete() method in Local transaction mode!");
            }

            string mainNo = MainSet.RecNo;

            trans = AppRes.DB.BeginTrans();

            try
            {
                ImageSet.RecNo = mainNo;
                ImageSet.Delete(trans);
                JoinSet.RecNo = mainNo;
                JoinSet.Delete(trans);
                P2Set.MainNo = mainNo;
                P2Set.Delete(trans);
                P2ExtendSet.RecNo = mainNo;
                P2ExtendSet.Delete(trans);
                MainSet.Delete(trans);
                ResetReportValidation(trans);

                AppRes.DB.CommitTrans();
            }
            catch
            {
                AppRes.DB.RollbackTrans();
            }
        }
        private void InsertJoin(SqlTransaction trans)
        {
            string[] items = MainSet.P1ItemNo.Split(',');

            JoinSet.RecNo = MainSet.RecNo;
            foreach (string item in items)
            {
                JoinSet.PartNo = item.Trim();
                JoinSet.Insert(trans);
            }
        }
Example #3
0
        public FromClause Prepare(IExpressionPreparer preparer)
        {
            var clause = new FromClause();

            clause.JoinSet = JoinSet.Prepare(preparer);

            // Prepare the StatementTree sub-queries in the from tables
            foreach (FromTable table in fromTableList)
            {
                clause.fromTableList.Add(table.Prepare(preparer));
            }

            return(clause);
        }
Example #4
0
        private void AddFromTable(ObjectName tableName, FromTable table)
        {
            if (tableName != null)
            {
                if (allTableNames.Contains(tableName))
                {
                    throw new ApplicationException("Duplicate table name in FROM clause: " + tableName);
                }

                allTableNames.Add(tableName);
            }

            // Create a new unique key for this table
            string key = CreateNewKey();

            table.UniqueKey = key;
            // Add the table key to the join set
            JoinSet.AddTable(key);
            // Add to the alias def map
            fromTableList.Add(table);
        }
Example #5
0
 public void AddJoin(JoinType type, Expression onExpression)
 {
     JoinSet.AddJoin(type, onExpression);
 }
Example #6
0
 public void AddJoin(JoinType type)
 {
     JoinSet.AddJoin(type);
 }