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 SavePage2(EReportArea area, SqlTransaction trans)
        {
            if (area == EReportArea.US)
            {
                List <ChemicalPage2ExtendRow> extendRows = CtrlUs.P2ExtendRows;

                foreach (ChemicalPage2ExtendRow row in extendRows)
                {
                    P2ExtendSet.RecNo       = row.RecNo;
                    P2ExtendSet.FormatValue = row.FormatValue;
                    P2ExtendSet.Update(trans);
                }
            }

            List <ChemicalPage2Row> rows = (area == EReportArea.US) ? CtrlUs.P2Rows : CtrlEu.P2Rows;

            foreach (ChemicalPage2Row row in rows)
            {
                P2Set.RecNo       = row.RecNo;
                P2Set.FormatValue = row.FormatValue;
                P2Set.Update(trans);
            }
        }
        private void InsertPage2Extend(string jobNo, SqlTransaction trans)
        {
            if (string.IsNullOrWhiteSpace(jobNo) == true)
            {
                return;
            }

            ProfJobSchemeSet.JobNo = jobNo;
            ProfJobSchemeSet.Select(trans);

            if (ProfJobSchemeSet.Empty == false)
            {
                ProfJobSchemeSet.Fetch();

                P2ExtendSet.RecNo       = MainSet.RecNo;
                P2ExtendSet.Name        = ProfJobSchemeSet.Name;
                P2ExtendSet.LoValue     = ProfJobSchemeSet.LoValue;
                P2ExtendSet.HiValue     = ProfJobSchemeSet.HiValue;
                P2ExtendSet.ReportValue = ProfJobSchemeSet.ReportValue;
                P2ExtendSet.FormatValue = ProfJobSchemeSet.FormatValue;
                P2ExtendSet.Insert(trans);
            }
        }