Exemplo n.º 1
0
        public QcfinishdtlModelList GetModelList(QcfinishdtlModel model)
        {
            QcfinishdtlTable  table       = new QcfinishdtlTable();
            PbknitfinishTable finishTable = new PbknitfinishTable();
            SelectSqlSection  sql         = DataAccess.DefaultDB.Select(table, table.AllColumns(), finishTable.FinishingName);

            sql.Join(finishTable, table.FinishingCode == finishTable.FinishingCode);
            if (model.QualityCode != "")
            {
                sql.Where(table.QualityCode == model.QualityCode);
            }
            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                QcfinishdtlModelList result = new QcfinishdtlModelList();
                while (sdr.Read())
                {
                    QcfinishdtlModel m = new QcfinishdtlModel();
                    m.Iden          = sdr.GetInt32(table.Iden);
                    m.Description   = sdr.GetString(finishTable.FinishingName);
                    m.QualityCode   = sdr.GetString(table.QualityCode);
                    m.FinishingCode = sdr.GetString(table.FinishingCode);

                    result.Add(m);
                }
                return(result);
            }
        }
Exemplo n.º 2
0
        public void CheckModel(QcfinishdtlModel model, bool isNew)
        {
            Validator v = new Validator();

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
Exemplo n.º 3
0
        protected bool Exists(QcfinishdtlModel model, bool isNew)
        {
            QcfinishdtlTable table = new QcfinishdtlTable();
            SelectSqlSection sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                     .Where(table.Iden == model.Iden &&
                                            table.QualityCode == model.QualityCode &&
                                            table.FinishingCode == model.FinishingCode
                                            );

            return(sql.ToScalar <int>() > 0);
        }
Exemplo n.º 4
0
        public void UpdateModel(QcfinishdtlModel model, DbTransaction tran)
        {
            QcfinishdtlTable table = new QcfinishdtlTable();
            UpdateSqlSection sql   = DataAccess.DefaultDB.Update(table);

            if (tran != null)
            {
                sql.SetTransaction(tran);
            }
            sql.AddColumn(table.FinishingCode, model.FinishingCode)
            .Execute();
        }
Exemplo n.º 5
0
 public void DeleteModel(QcfinishdtlModel model, DbTransaction tran)
 {
     if (tran == null)
     {
         QcfinishdtlTable table = new QcfinishdtlTable();
         DataAccess.DefaultDB.Delete(table).Where(table.QualityCode == model.QualityCode)
         .Execute();
     }
     else
     {
         QcfinishdtlTable table = new QcfinishdtlTable();
         DataAccess.DefaultDB.Delete(table).SetTransaction(tran).Where(table.QualityCode == model.QualityCode)
         .Execute();
     }
 }
Exemplo n.º 6
0
        public void AddModel(QcfinishdtlModel model, DbTransaction tran)
        {
            //model.CreateTime = System.DateTime.Now;
            QcfinishdtlTable table     = new QcfinishdtlTable();
            InsertSqlSection insertSql = DataAccess.DefaultDB.Insert(table);

            if (tran != null)
            {
                insertSql.SetTransaction(tran);
            }
            int iden = DataAccess.DefaultDB.CustomSql("select QCFINISHDTLIDEN.nextval from dual").ToScalar <int>();

            insertSql.AddColumn(table.QualityCode, model.QualityCode)
            .AddColumn(table.FinishingCode, model.FinishingCode)
            .AddColumn(table.Iden, iden)
            .Execute();
        }
Exemplo n.º 7
0
        public QcfinishdtlModelList GetModelListOne(QcfinishdtlModel model)
        {
            QcfinishdtlTable  table  = new QcfinishdtlTable();
            PbknitfinishTable table1 = new PbknitfinishTable();
            SelectSqlSection  sql    = DataAccess.DefaultDB.Select(table1, table1.FinishingName).Join(table, table.FinishingCode == table1.FinishingCode);

            if (model.QualityCode != "")
            {
                sql.Where(table.QualityCode == model.QualityCode);
            }
            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                QcfinishdtlModelList result = new QcfinishdtlModelList();
                while (sdr.Read())
                {
                    QcfinishdtlModel m = new QcfinishdtlModel();
                    m.FinishingCode = sdr.GetString(table1.FinishingName);
                    result.Add(m);
                }
                return(result);
            }
        }