public static List <OrdDiscntChrge> GetAll(string IDS) { DBCon Con = new DBCon(); SqlCommand cmd = null; SqlDataReader SDR = null; List <OrdDiscntChrge> TmpList = new List <OrdDiscntChrge>(); try { string Query = "SELECT * FROM OrderDiscntCharge where ID IN(" + IDS + ")"; cmd = new SqlCommand(Query, Con.Con); SDR = cmd.ExecuteReader(); while (SDR.Read()) { int Index = 0; OrdDiscntChrge ObjTmp = new OrdDiscntChrge(); ObjTmp.ID = SDR.GetInt32(Index++); ObjTmp.Title = SDR.GetString(Index++); ObjTmp.OID = SDR.GetInt64(Index++); ObjTmp.Type = SDR.GetInt32(Index++); ObjTmp.Amt = SDR.GetDouble(Index++); ObjTmp.Tax = SDR.GetDouble(Index++); ObjTmp.Remark = SDR.GetString(Index++); ObjTmp.Datetime = SDR.GetDateTime(Index++); ObjTmp.CBID = SDR.GetInt32(Index++); TmpList.Add(ObjTmp); } } catch (Exception e) { e.ToString(); } finally { SDR.Close(); cmd.Dispose(); Con.Con.Close(); Con = null; } return(TmpList); }
public static OrdDiscntChrge GetOne(int ID) { OrdDiscntChrge ordDiscntChrge = GetAll(ID.ToString()).FirstOrDefault(); return(ordDiscntChrge); }