public List <BJRecord> GetBookByIDMAIN(int IDMAIN, Bases fund) { if (fund == Bases.BJACC) { DA.SelectCommand.CommandText = "select A.*,B.PLAIN from BJACC..DATAEXT A " + " left join BJACC..DATAEXTPLAIN B on A.ID = B.IDDATAEXT where A.IDMAIN = " + IDMAIN; } else { DA.SelectCommand.CommandText = "select A.*,B.PLAIN from BJACC..DATAEXT A " + " left join BJVVV..DATAEXTPLAIN B on A.ID = B.IDDATAEXT where A.IDMAIN = " + IDMAIN; } DS = new DataSet(); DA.Fill(DS, "t"); List <BJRecord> Book = new List <BJRecord>(); BJRecord rec; foreach (DataRow r in DS.Tables["t"].Rows) { rec = new BJRecord(); rec.ID = (int)r["ID"]; rec.IDDATA = (int)r["IDDATA"]; rec.IDINLIST = (int)r["IDINLIST"]; rec.IDMAIN = IDMAIN; rec.MNFIELD = (int)r["MNFIELD"]; rec.MSFIELD = r["MSFIELD"].ToString(); rec.PLAIN = r["PLAIN"].ToString(); rec.SORT = r["SORT"].ToString(); rec.Fund = fund; Book.Add(rec); } return(Book); }
public List <BJRecord> GetBookByBAR(string BAR) { DA.SelectCommand.CommandText = "select A.*,B.PLAIN from BJACC..DATAEXT A " + " left join BJACC..DATAEXTPLAIN B on A.ID = B.IDDATAEXT " + " where A.IDMAIN = (select top 1 IDMAIN from BJACC..DATAEXT where MNFIELD = 899 and MSFIELD = '$w' and SORT = '" + BAR + "')"; DS = new DataSet(); int i = DA.Fill(DS, "t"); Bases fund = Bases.BJACC; if (i == 0) { DA.SelectCommand.CommandText = "select A.*,B.PLAIN from BJVVV..DATAEXT A " + " left join BJVVV..DATAEXTPLAIN B on A.ID = B.IDDATAEXT " + " where A.IDMAIN = (select top 1 IDMAIN from BJVVV..DATAEXT where MNFIELD = 899 and MSFIELD = '$w' and SORT = '" + BAR + "')"; fund = Bases.BJVVV; } DS = new DataSet(); i = DA.Fill(DS, "t"); List <BJRecord> Book = new List <BJRecord>(); BJRecord rec; foreach (DataRow r in DS.Tables["t"].Rows) { rec = new BJRecord(); rec.ID = (int)r["ID"]; rec.IDDATA = (int)r["IDDATA"]; rec.IDINLIST = (int)r["IDINLIST"]; rec.IDMAIN = (int)r["IDMAIN"]; rec.MNFIELD = (int)r["MNFIELD"]; rec.MSFIELD = r["MSFIELD"].ToString(); rec.PLAIN = r["PLAIN"].ToString(); rec.SORT = r["SORT"].ToString(); rec.Fund = fund; Book.Add(rec); } return(Book); }