public QccustomerlibraryModelList GetModelList(QccustomerlibraryModel model) { QccustomerlibraryTable table = new QccustomerlibraryTable(); QcmaininfoTable main = new QcmaininfoTable(); SelectSqlSection sql = DataAccess.DefaultDB.Select(table, table.AllColumns(), main.Status); sql.Join(main, table.QualityCode == main.QualityCode); if (model.QualityCode != "") { sql.Where(table.QualityCode == model.QualityCode); } using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader())) { QccustomerlibraryModelList result = new QccustomerlibraryModelList(); while (sdr.Read()) { QccustomerlibraryModel m = new QccustomerlibraryModel(); m.Status = sdr.GetString(main.Status); m.QualityCode = sdr.GetString(table.QualityCode); m.BuyerId = sdr.GetString(table.BuyerId); m.Brand = sdr.GetString(table.Brand); m.CustomerQualityId = sdr.GetString(table.CustomerQualityId); m.Sales = sdr.GetString(table.Sales); m.SalesGroup = sdr.GetString(table.SalesGroup); m.MillComments = sdr.GetString(table.MillComments); m.IsFirstOwner = sdr.GetString(table.IsFirstOwner); m.CreateDate = sdr.GetDateTime(table.CreateDate); m.Creator = sdr.GetString(table.Creator); result.Add(m); } return(result); } }
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); } }
public SelectSqlSection Join(SelectSqlSection sqlSectin) { bool IsAlias = !string.IsNullOrEmpty(this.AliasName); switch (this.JoinType) { case EJoinType.Join: if (IsAlias) { sqlSectin.Join(this.JoinQueryTable, this.AliasName, this.JoinWhere); } else { sqlSectin.Join(this.JoinQueryTable, this.JoinWhere); } break; case EJoinType.LeftJoin: if (IsAlias) { sqlSectin.LeftJoin(this.JoinQueryTable, this.AliasName, this.JoinWhere); } else { sqlSectin.LeftJoin(this.JoinQueryTable, this.JoinWhere); } break; case EJoinType.RightJoin: if (IsAlias) { sqlSectin.RightJoin(this.JoinQueryTable, this.AliasName, this.JoinWhere); } else { sqlSectin.RightJoin(this.JoinQueryTable, this.JoinWhere); } break; } return(sqlSectin); }