Exemplo n.º 1
0
        public QcyarndtlModelList GetModelList(QcyarndtlModel model)
        {
            QcyarndtlTable   table = new QcyarndtlTable();
            SelectSqlSection sql   = DataAccess.DefaultDB.Select(table, table.AllColumns());

            if (model.QualityCode != "")
            {
                sql.Where(table.QualityCode == model.QualityCode);
            }
            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                QcyarndtlModelList result = new QcyarndtlModelList();
                while (sdr.Read())
                {
                    QcyarndtlModel m = new QcyarndtlModel();
                    m.Iden          = sdr.GetInt32(table.Iden);
                    m.QualityCode   = sdr.GetString(table.QualityCode);
                    m.YarnType      = sdr.GetString(table.YarnType);
                    m.YarnCount     = sdr.GetString(table.YarnCount);
                    m.Threads       = sdr.GetInt32(table.Threads);
                    m.YarnRatio     = sdr.GetDecimal(table.YarnRatio);
                    m.YarnComponent = sdr.GetString(table.YarnComponent);
                    m.WarpWeft      = sdr.GetString(table.WarpWeft);
                    m.YarnDensity   = sdr.GetInt32(table.YarnDensity);
                    result.Add(m);
                }
                return(result);
            }
        }
Exemplo n.º 2
0
        public void DeleteModel(QcyarndtlModel model, DbTransaction tran)
        {
            QcyarndtlTable   table = new QcyarndtlTable();
            DeleteSqlSection sql   = DataAccess.DefaultDB.Delete(table);

            if (tran != null)
            {
                sql.SetTransaction(tran);
            }
            sql.Where(table.QualityCode == model.QualityCode)
            .Execute();
        }
Exemplo n.º 3
0
        protected bool Exists(QcyarndtlModel model, bool isNew)
        {
            QcyarndtlTable   table = new QcyarndtlTable();
            SelectSqlSection sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                     .Where(table.Iden == model.Iden &&
                                            table.QualityCode == model.QualityCode &&
                                            table.YarnType == model.YarnType &&
                                            table.YarnCount == model.YarnCount &&
                                            table.Threads == model.Threads &&
                                            table.YarnRatio == model.YarnRatio &&
                                            table.WarpWeft == model.WarpWeft &&
                                            table.YarnDensity == model.YarnDensity
                                            );

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

            if (tran != null)
            {
                sql.SetTransaction(tran);
            }
            sql.AddColumn(table.YarnType, model.YarnType)
            .AddColumn(table.YarnCount, model.YarnCount)
            .AddColumn(table.Threads, model.Threads)
            .AddColumn(table.YarnRatio, model.YarnRatio)
            .AddColumn(table.YarnComponent, model.YarnComponent)
            .Where(table.QualityCode == model.QualityCode)
            .Execute();
        }
Exemplo n.º 5
0
        public void AddModel(QcyarndtlModel model, DbTransaction tran)
        {
            //model.CreateTime = System.DateTime.Now;
            QcyarndtlTable   table     = new QcyarndtlTable();
            InsertSqlSection insertSql = DataAccess.DefaultDB.Insert(table);

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

            insertSql.AddColumn(table.QualityCode, model.QualityCode)
            .AddColumn(table.YarnType, model.YarnType)
            .AddColumn(table.YarnCount, model.YarnCount)
            .AddColumn(table.Threads, model.Threads)
            .AddColumn(table.YarnRatio, model.YarnRatio)
            .AddColumn(table.WarpWeft, model.WarpWeft)
            .AddColumn(table.YarnDensity, model.YarnDensity)
            .AddColumn(table.YarnComponent, model.YarnComponent)
            .AddColumn(table.Iden, iden)
            .Execute();
        }