Esempio n. 1
0
        public void CheckModel(QcconstructiondtlModel model, bool isNew)
        {
            Validator v = new Validator();

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
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();
        }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        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);
            }
        }