protected bool Exists(QcconstructiondtlModel model, bool isNew)
        {
            QcconstructiondtlTable table = new QcconstructiondtlTable();
            SelectSqlSection       sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                           .Where(table.Iden == model.Iden &&
                                                  table.QualityCode == model.QualityCode &&
                                                  table.Construction == model.Construction
                                                  );

            return(sql.ToScalar <int>() > 0);
        }
        public void DeleteModel(QcconstructiondtlModel model, DbTransaction tran)
        {
            QcconstructiondtlTable table = new QcconstructiondtlTable();
            DeleteSqlSection       sql   = DataAccess.DefaultDB.Delete(table);

            if (tran != null)
            {
                sql.SetTransaction(tran);
            }
            sql.Where(table.QualityCode == model.QualityCode)
            .Execute();
        }
        public void UpdateModel(QcconstructiondtlModel model, DbTransaction tran)
        {
            QcconstructiondtlTable table = new QcconstructiondtlTable();
            UpdateSqlSection       sql   = DataAccess.DefaultDB.Update(table);

            if (tran != null)
            {
                sql.SetTransaction(tran);
            }

            sql.AddColumn(table.Construction, model.Construction)
            .Execute();
        }
        public void AddModel(QcconstructiondtlModel model, DbTransaction tran)
        {
            //model.CreateTime = System.DateTime.Now;


            QcconstructiondtlTable table = new QcconstructiondtlTable();
            int iden = DataAccess.DefaultDB.CustomSql("select QCCONSTRUCTIONDTLIDEN.nextval from dual").ToScalar <int>();
            InsertSqlSection insertSql = DataAccess.DefaultDB.Insert(table);

            if (tran != null)
            {
                insertSql.SetTransaction(tran);
            }
            insertSql.AddColumn(table.QualityCode, model.QualityCode)
            .AddColumn(table.Construction, model.Construction)
            .AddColumn(table.Iden, iden)
            .Execute();
        }
        public QcconstructiondtlModelList GetModelListOne(QcconstructiondtlModel model)
        {
            QcconstructiondtlTable  table  = new QcconstructiondtlTable();
            PbknitconstructionTable table1 = new PbknitconstructionTable();
            SelectSqlSection        sql    = DataAccess.DefaultDB.Select(table1, table1.Description).Join(table, table1.Construction == table.Construction);

            if (model.QualityCode != "")
            {
                sql.Where(table.QualityCode == model.QualityCode);
            }
            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                QcconstructiondtlModelList result = new QcconstructiondtlModelList();
                while (sdr.Read())
                {
                    QcconstructiondtlModel m = new QcconstructiondtlModel();
                    m.Construction = sdr.GetString(table1.Description);
                    result.Add(m);
                }
                return(result);
            }
        }
        public QcconstructiondtlModelList GetModelList(QcconstructiondtlModel model)
        {
            QcconstructiondtlTable table = new QcconstructiondtlTable();
            SelectSqlSection       sql   = DataAccess.DefaultDB.Select(table, table.AllColumns());

            if (model.QualityCode != "")
            {
                sql.Where(table.QualityCode == model.QualityCode);
            }
            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                QcconstructiondtlModelList result = new QcconstructiondtlModelList();
                while (sdr.Read())
                {
                    QcconstructiondtlModel m = new QcconstructiondtlModel();
                    m.Iden         = sdr.GetInt32(table.Iden);
                    m.QualityCode  = sdr.GetString(table.QualityCode);
                    m.Construction = sdr.GetString(table.Construction);
                    result.Add(m);
                }
                return(result);
            }
        }